Commit 9b33ad7d258f3a87547493217d61cd6cfc7948ff
1 parent
ecbb947a
Exists in
master
redmine #4286 Construção
Showing
13 changed files
with
121 additions
and
10 deletions
Show diff stats
cit-contratos-api/src/main/java/br/com/centralit/api/dao/ContratoEmpenhoDao.java
@@ -44,5 +44,5 @@ public interface ContratoEmpenhoDao extends CitGenericDAO { | @@ -44,5 +44,5 @@ public interface ContratoEmpenhoDao extends CitGenericDAO { | ||
44 | Collection<ContratoEmpenho> findAllByContrato(Long contratoId); | 44 | Collection<ContratoEmpenho> findAllByContrato(Long contratoId); |
45 | 45 | ||
46 | Collection<ContratoEmpenho> findEmpenhoParaLiberacao(Long contratoId); | 46 | Collection<ContratoEmpenho> findEmpenhoParaLiberacao(Long contratoId); |
47 | - | 47 | + |
48 | } | 48 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/dao/EventoLiberacaoPagamentoEmpenhoDao.java
@@ -23,4 +23,6 @@ public interface EventoLiberacaoPagamentoEmpenhoDao extends CitGenericDAO { | @@ -23,4 +23,6 @@ public interface EventoLiberacaoPagamentoEmpenhoDao extends CitGenericDAO { | ||
23 | 23 | ||
24 | BigDecimal getValorTotalExecutadoEmpenho(Long empenhoId); | 24 | BigDecimal getValorTotalExecutadoEmpenho(Long empenhoId); |
25 | 25 | ||
26 | + Boolean existeVinculoEmpenhoComLiberacaoPagamento(Long idEmpenho); | ||
27 | + | ||
26 | } | 28 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/dao/impl/ContratoEmpenhoDaoHibernate.java
@@ -57,5 +57,6 @@ public class ContratoEmpenhoDaoHibernate extends CitGenericDAOImpl implements Co | @@ -57,5 +57,6 @@ public class ContratoEmpenhoDaoHibernate extends CitGenericDAOImpl implements Co | ||
57 | search.addFilterNotIn("dominioFinalidadeEmpenho.codigo", DominioContrato.CODIGO_TIPO_FINALIDADE_EMPENHO_CONTRATO_ANULACAO); | 57 | search.addFilterNotIn("dominioFinalidadeEmpenho.codigo", DominioContrato.CODIGO_TIPO_FINALIDADE_EMPENHO_CONTRATO_ANULACAO); |
58 | 58 | ||
59 | return this.search(search); | 59 | return this.search(search); |
60 | - } | 60 | + } |
61 | + | ||
61 | } | 62 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/dao/impl/EventoLiberacaoPagamentoEmpenhoDaoHibernate.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; | @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; | ||
8 | import br.com.centralit.api.dao.EventoLiberacaoPagamentoEmpenhoDao; | 8 | import br.com.centralit.api.dao.EventoLiberacaoPagamentoEmpenhoDao; |
9 | import br.com.centralit.api.model.EventoLiberacaoPagamentoEmpenho; | 9 | import br.com.centralit.api.model.EventoLiberacaoPagamentoEmpenho; |
10 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | 10 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
11 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | ||
11 | 12 | ||
12 | import com.googlecode.genericdao.search.Search; | 13 | import com.googlecode.genericdao.search.Search; |
13 | 14 | ||
@@ -50,4 +51,15 @@ public class EventoLiberacaoPagamentoEmpenhoDaoHibernate extends CitGenericDAOIm | @@ -50,4 +51,15 @@ public class EventoLiberacaoPagamentoEmpenhoDaoHibernate extends CitGenericDAOIm | ||
50 | return valorTotalOs; | 51 | return valorTotalOs; |
51 | } | 52 | } |
52 | 53 | ||
54 | + @Override | ||
55 | + public Boolean existeVinculoEmpenhoComLiberacaoPagamento(Long idEmpenho) { | ||
56 | + SearchSeven search = new SearchSeven(this.persistentClass); | ||
57 | + | ||
58 | + search.addFilterEqual("contratoEmpenho.id", idEmpenho); | ||
59 | + | ||
60 | + List<Object> lista = this.search(search, this.persistentClass); | ||
61 | + | ||
62 | + return lista == null || lista.isEmpty() ? false : true; | ||
63 | + } | ||
64 | + | ||
53 | } | 65 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/service/EventoLiberacaoPagamentoEmpenhoService.java
@@ -25,4 +25,6 @@ public interface EventoLiberacaoPagamentoEmpenhoService extends GenericService<E | @@ -25,4 +25,6 @@ public interface EventoLiberacaoPagamentoEmpenhoService extends GenericService<E | ||
25 | 25 | ||
26 | BigDecimal getValorTotalExecutadoEmpenho(Long empenhoId); | 26 | BigDecimal getValorTotalExecutadoEmpenho(Long empenhoId); |
27 | 27 | ||
28 | + Boolean existeVinculoEmpenhoComLiberacaoPagamento(Long idEmpenho); | ||
29 | + | ||
28 | } | 30 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/ContratoEmpenhoServiceImpl.java
@@ -126,6 +126,15 @@ public class ContratoEmpenhoServiceImpl extends GenericServiceImpl<ContratoEmpen | @@ -126,6 +126,15 @@ public class ContratoEmpenhoServiceImpl extends GenericServiceImpl<ContratoEmpen | ||
126 | return entitySaved; | 126 | return entitySaved; |
127 | } | 127 | } |
128 | 128 | ||
129 | + @Override | ||
130 | + public ContratoEmpenho merge(ContratoEmpenho entity) { | ||
131 | + entity.setDataEvento(entity.getData()); | ||
132 | + this.montarDocsObs(entity); | ||
133 | + ContratoEmpenho entitySaved = super.save(entity); | ||
134 | + | ||
135 | + return entitySaved; | ||
136 | + } | ||
137 | + | ||
129 | private void montarDocsObs(ContratoEmpenho entity) { | 138 | private void montarDocsObs(ContratoEmpenho entity) { |
130 | 139 | ||
131 | if (!UtilColecao.isVazio(entity.getObservacoes())) { | 140 | if (!UtilColecao.isVazio(entity.getObservacoes())) { |
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/EventoLiberacaoPagamentoEmpenhoServiceImpl.java
@@ -42,4 +42,9 @@ public class EventoLiberacaoPagamentoEmpenhoServiceImpl extends GenericServiceIm | @@ -42,4 +42,9 @@ public class EventoLiberacaoPagamentoEmpenhoServiceImpl extends GenericServiceIm | ||
42 | return this.eventoLiberacaoPagamentoEmpenhoDao.getValorTotalExecutadoEmpenho(empenhoId); | 42 | return this.eventoLiberacaoPagamentoEmpenhoDao.getValorTotalExecutadoEmpenho(empenhoId); |
43 | } | 43 | } |
44 | 44 | ||
45 | + @Override | ||
46 | + public Boolean existeVinculoEmpenhoComLiberacaoPagamento(Long idEmpenho) { | ||
47 | + return this.eventoLiberacaoPagamentoEmpenhoDao.existeVinculoEmpenhoComLiberacaoPagamento(idEmpenho); | ||
48 | + } | ||
49 | + | ||
45 | } | 50 | } |
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/InicializarContratosServiceImpl.java
@@ -434,6 +434,9 @@ public class InicializarContratosServiceImpl extends UtilStartup { | @@ -434,6 +434,9 @@ public class InicializarContratosServiceImpl extends UtilStartup { | ||
434 | filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoRecebimentoObjetoRepository.js", this.dominioJS, menuAcompanhamento)); | 434 | filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoRecebimentoObjetoRepository.js", this.dominioJS, menuAcompanhamento)); |
435 | filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoRecebimentoObjetoRepository.min.js", this.dominioJS, menuAcompanhamento)); | 435 | filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoRecebimentoObjetoRepository.min.js", this.dominioJS, menuAcompanhamento)); |
436 | 436 | ||
437 | + filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoLiberacaoPagamentoEmpenhoRepository.js", this.dominioJS, menuAcompanhamento)); | ||
438 | + filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoLiberacaoPagamentoEmpenhoRepository.min.js", this.dominioJS, menuAcompanhamento)); | ||
439 | + | ||
437 | 440 | ||
438 | menuAcompanhamento.setIncludes(filesMenuAcompanhamento); | 441 | menuAcompanhamento.setIncludes(filesMenuAcompanhamento); |
439 | 442 |
cit-contratos-api/src/main/resources/script-bd/v1.0.0-alpha11/01-cit-contratos-1.0.0-ALFA-11-postgres.sql
1 | -- ERICK SATO INÍCIO 04/04/2016 | 1 | -- ERICK SATO INÍCIO 04/04/2016 |
2 | ALTER TABLE cnt_contrato ADD COLUMN termoReferencia_id bigint; | 2 | ALTER TABLE cnt_contrato ADD COLUMN termoReferencia_id bigint; |
3 | -- ERICK SATO FIM 04/04/2016 | 3 | -- ERICK SATO FIM 04/04/2016 |
4 | + | ||
5 | +-- LUÍS CÉSAR INÍCIO 05/04/2016 | ||
6 | +INSERT INTO menufile (id, datacriacao, dataedicao, version, ativo, caminho, dominiomenufile_id, menu_id) | ||
7 | +VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true, '/cit-contratos-web/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.js', | ||
8 | + (SELECT id FROM dominio WHERE chave = 'tipoFile' AND codigo = 2), (SELECT id FROM menu WHERE chave = 'ACOMPANHAMENTO')); | ||
9 | + | ||
10 | +INSERT INTO menufile (id, datacriacao, dataedicao, version, ativo, caminho, dominiomenufile_id, menu_id) | ||
11 | +VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true, '/cit-contratos-web/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.min.js', | ||
12 | + (SELECT id FROM dominio WHERE chave = 'tipoFile' AND codigo = 2), (SELECT id FROM menu WHERE chave = 'ACOMPANHAMENTO')); | ||
13 | +-- LUÍS CÉSAR FIM 05/04/2016 |
cit-contratos-web/src/main/java/br/com/centralit/controller/EventoLiberacaoPagamentoEmpenhoController.java
0 → 100644
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +package br.com.centralit.controller; | ||
2 | + | ||
3 | +import org.springframework.beans.factory.annotation.Autowired; | ||
4 | +import org.springframework.stereotype.Controller; | ||
5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
6 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
7 | +import org.springframework.web.bind.annotation.RequestParam; | ||
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
9 | + | ||
10 | +import br.com.centralit.api.model.EventoLiberacaoPagamentoEmpenho; | ||
11 | +import br.com.centralit.api.service.EventoLiberacaoPagamentoEmpenhoService; | ||
12 | +import br.com.centralit.framework.controller.GenericController; | ||
13 | +import br.com.centralit.framework.json.ResponseBodyWrapper; | ||
14 | + | ||
15 | +@Controller | ||
16 | +@RequestMapping("/rest/eventoLiberacaoPagamentoEmpenho") | ||
17 | +public class EventoLiberacaoPagamentoEmpenhoController extends GenericController<EventoLiberacaoPagamentoEmpenho>{ | ||
18 | + | ||
19 | + private EventoLiberacaoPagamentoEmpenhoService eventoLiberacaoPagamentoEmpenhoService; | ||
20 | + | ||
21 | + public EventoLiberacaoPagamentoEmpenhoController() { | ||
22 | + super(); | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * Responsável pela criação de novas instâncias desta classe. | ||
27 | + * | ||
28 | + * @param eventoAtualizacaoStatusService | ||
29 | + */ | ||
30 | + @Autowired | ||
31 | + private EventoLiberacaoPagamentoEmpenhoController( EventoLiberacaoPagamentoEmpenhoService eventoLiberacaoPagamentoEmpenhoService ) { | ||
32 | + | ||
33 | + super(eventoLiberacaoPagamentoEmpenhoService); | ||
34 | + | ||
35 | + this.eventoLiberacaoPagamentoEmpenhoService = eventoLiberacaoPagamentoEmpenhoService; | ||
36 | + | ||
37 | + } | ||
38 | + | ||
39 | + @RequestMapping(value = "/existeVinculoEmpenhoComLiberacaoPagamento", method = RequestMethod.GET, produces = "application/json") | ||
40 | + @ResponseBody | ||
41 | + public ResponseBodyWrapper existeVinculoEmpenhoComLiberacaoPagamento(@RequestParam(value = "idEmpenho") Long idEmpenho) { | ||
42 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(eventoLiberacaoPagamentoEmpenhoService.existeVinculoEmpenhoComLiberacaoPagamento(idEmpenho), getEditView()); | ||
43 | + return responseBody; | ||
44 | + } | ||
45 | + | ||
46 | +} |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/VisaoContratoController.js
@@ -14,6 +14,7 @@ citApp.controller('VisaoContratoController', ['$scope', | @@ -14,6 +14,7 @@ citApp.controller('VisaoContratoController', ['$scope', | ||
14 | 'EventoRecebimentoObjetoRepository', | 14 | 'EventoRecebimentoObjetoRepository', |
15 | 'EventoRescisaoContratoRepository', | 15 | 'EventoRescisaoContratoRepository', |
16 | 'EventoRepactuacaoRepository', | 16 | 'EventoRepactuacaoRepository', |
17 | + 'EventoLiberacaoPagamentoEmpenhoRepository', | ||
17 | function VisaoContratoController($scope, | 18 | function VisaoContratoController($scope, |
18 | $filter, | 19 | $filter, |
19 | $timeout, | 20 | $timeout, |
@@ -27,7 +28,8 @@ citApp.controller('VisaoContratoController', ['$scope', | @@ -27,7 +28,8 @@ citApp.controller('VisaoContratoController', ['$scope', | ||
27 | EventoRegistroNaoConformidadeRepository, | 28 | EventoRegistroNaoConformidadeRepository, |
28 | EventoRecebimentoObjetoRepository, | 29 | EventoRecebimentoObjetoRepository, |
29 | EventoRescisaoContratoRepository, | 30 | EventoRescisaoContratoRepository, |
30 | - EventoRepactuacaoRepository) { | 31 | + EventoRepactuacaoRepository, |
32 | + EventoLiberacaoPagamentoEmpenhoRepository) { | ||
31 | 33 | ||
32 | $scope._START_ITEMS = 0; | 34 | $scope._START_ITEMS = 0; |
33 | $scope._LIMIT_ITEMS = 15; | 35 | $scope._LIMIT_ITEMS = 15; |
@@ -454,8 +456,11 @@ citApp.controller('VisaoContratoController', ['$scope', | @@ -454,8 +456,11 @@ citApp.controller('VisaoContratoController', ['$scope', | ||
454 | break; | 456 | break; |
455 | case 'EMPENHO': | 457 | case 'EMPENHO': |
456 | $scope.visualizarEvento = true; | 458 | $scope.visualizarEvento = true; |
457 | - $scope.editEvento = false; | ||
458 | - $scope.removeEvento = false; | 459 | + $scope.editEvento = true; |
460 | + | ||
461 | + EventoLiberacaoPagamentoEmpenhoRepository.existeVinculoEmpenhoComLiberacaoPagamento($scope.evento.id).then(function(result) { | ||
462 | + $scope.removeEvento = !result; | ||
463 | + }); | ||
459 | break; | 464 | break; |
460 | case 'NAO_CONFORMIDADE': | 465 | case 'NAO_CONFORMIDADE': |
461 | $scope.visualizarEvento = true; | 466 | $scope.visualizarEvento = true; |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.js
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +'use strict'; | ||
2 | + | ||
3 | +citApp.factory('EventoLiberacaoPagamentoEmpenhoRepository', ['RestangularContratos', 'AbstractRepository', function (restangularContratos, AbstractRepository) { | ||
4 | + | ||
5 | + function EventoLiberacaoPagamentoEmpenhoRepository() { | ||
6 | + AbstractRepository.call(this, restangularContratos, 'rest/eventoLiberacaoPagamentoEmpenho'); | ||
7 | + | ||
8 | + this.existeVinculoEmpenhoComLiberacaoPagamento = function(idEmpenho) { | ||
9 | + return restangularContratos.one(this.route + "/existeVinculoEmpenhoComLiberacaoPagamento").get({"idEmpenho": idEmpenho}).then(); | ||
10 | + }; | ||
11 | + } | ||
12 | + | ||
13 | + AbstractRepository.extend(EventoLiberacaoPagamentoEmpenhoRepository); | ||
14 | + | ||
15 | + return new EventoLiberacaoPagamentoEmpenhoRepository(); | ||
16 | +}]); |
cit-contratos-web/src/main/webapp/html/eventos/cnt_ev_empenho.html
@@ -63,13 +63,13 @@ | @@ -63,13 +63,13 @@ | ||
63 | <div class="col-sm-4"> | 63 | <div class="col-sm-4"> |
64 | <div class="control-group" ng-class="{'has-error': numeroEmpenhoObrigatorio}"> | 64 | <div class="control-group" ng-class="{'has-error': numeroEmpenhoObrigatorio}"> |
65 | <label for='contratoEmpenho.numeroEmpenho' class='control-label'><translate>LABEL.NUMERO_EMPENHO</translate> | 65 | <label for='contratoEmpenho.numeroEmpenho' class='control-label'><translate>LABEL.NUMERO_EMPENHO</translate> |
66 | - <span class='red' ng-if='edit'>*</span> | ||
67 | - <i ng-if='edit' ng-show='numeroEmpenhoObrigatorio' class='fa fa-warning red' tooltip-placement='top'></i> | 66 | + <span class='red' ng-if='edit && !evento.id'>*</span> |
67 | + <i ng-if='edit && !evento.id' ng-show='numeroEmpenhoObrigatorio' class='fa fa-warning red' tooltip-placement='top'></i> | ||
68 | </label> | 68 | </label> |
69 | <input type='text' class='form-control' | 69 | <input type='text' class='form-control' |
70 | id='contratoEmpenho.numeroEmpenho' maxlength='30' name='contratoEmpenho.numeroEmpenho' | 70 | id='contratoEmpenho.numeroEmpenho' maxlength='30' name='contratoEmpenho.numeroEmpenho' |
71 | ng-model='contratoEmpenho.numeroEmpenho' ui-mask='9999AA999999' | 71 | ng-model='contratoEmpenho.numeroEmpenho' ui-mask='9999AA999999' |
72 | - ng-disabled='!edit' ng-required='edit'/> | 72 | + ng-disabled='!edit || evento.id' ng-required='edit && !evento.id'/> |
73 | </div> | 73 | </div> |
74 | </div> | 74 | </div> |
75 | <div class="col-sm-4"> | 75 | <div class="col-sm-4"> |
@@ -79,7 +79,7 @@ | @@ -79,7 +79,7 @@ | ||
79 | <div class="col-sm-4"> | 79 | <div class="col-sm-4"> |
80 | <label-select ng-label="LABEL.FINALIDADE_EMPENHO" ng-id="contratoEmpenho.dominioFinalidadeEmpenho" | 80 | <label-select ng-label="LABEL.FINALIDADE_EMPENHO" ng-id="contratoEmpenho.dominioFinalidadeEmpenho" |
81 | ng-model="contratoEmpenho.dominioFinalidadeEmpenho" ng-list="dominioFinalidadeEmpenhoList" | 81 | ng-model="contratoEmpenho.dominioFinalidadeEmpenho" ng-list="dominioFinalidadeEmpenhoList" |
82 | - form="cnt_ev_registrar_empenhoForm" ng-obrigatorio="edit" ng-disabled="!edit" track-by="track by dominioFinalidadeEmpenho.id" | 82 | + form="cnt_ev_registrar_empenhoForm" ng-obrigatorio="edit && !evento.id" ng-disabled="!edit || evento.id" track-by="track by dominioFinalidadeEmpenho.id" |
83 | ng-custom-options="dominioFinalidadeEmpenho.originalElement as dominioFinalidadeEmpenho.descricao for dominioFinalidadeEmpenho"/> | 83 | ng-custom-options="dominioFinalidadeEmpenho.originalElement as dominioFinalidadeEmpenho.descricao for dominioFinalidadeEmpenho"/> |
84 | </div><!-- .col --> | 84 | </div><!-- .col --> |
85 | </div> | 85 | </div> |
@@ -99,7 +99,7 @@ | @@ -99,7 +99,7 @@ | ||
99 | </div><!-- .col --> | 99 | </div><!-- .col --> |
100 | <div class="col-sm-4"> | 100 | <div class="col-sm-4"> |
101 | <label-input-money ng-id="contratoEmpenho.valorEmpenhado" ng-label="LABEL.VALOR_EMPENHADO" | 101 | <label-input-money ng-id="contratoEmpenho.valorEmpenhado" ng-label="LABEL.VALOR_EMPENHADO" |
102 | - ng-model="contratoEmpenho.valorEmpenhado" form="cnt_ev_registrar_empenhoForm" ng-obrigatorio="edit" ng-disabled="!edit"/> | 102 | + ng-model="contratoEmpenho.valorEmpenhado" form="cnt_ev_registrar_empenhoForm" ng-obrigatorio="edit && !evento.id" ng-disabled="!edit || evento.id"/> |
103 | </div><!-- .col --> | 103 | </div><!-- .col --> |
104 | </div><!-- .row --> | 104 | </div><!-- .row --> |
105 | <div class="row"> | 105 | <div class="row"> |