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
cit-contratos-api/src/main/java/br/com/centralit/api/dao/EventoLiberacaoPagamentoEmpenhoDao.java
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 | 57 | search.addFilterNotIn("dominioFinalidadeEmpenho.codigo", DominioContrato.CODIGO_TIPO_FINALIDADE_EMPENHO_CONTRATO_ANULACAO); |
58 | 58 | |
59 | 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 | 8 | import br.com.centralit.api.dao.EventoLiberacaoPagamentoEmpenhoDao; |
9 | 9 | import br.com.centralit.api.model.EventoLiberacaoPagamentoEmpenho; |
10 | 10 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
11 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
11 | 12 | |
12 | 13 | import com.googlecode.genericdao.search.Search; |
13 | 14 | |
... | ... | @@ -50,4 +51,15 @@ public class EventoLiberacaoPagamentoEmpenhoDaoHibernate extends CitGenericDAOIm |
50 | 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
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 | 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 | 138 | private void montarDocsObs(ContratoEmpenho entity) { |
130 | 139 | |
131 | 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 | 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 | 434 | filesMenuAcompanhamento.add(new MenuFile(CIT_CONTRATOS_WEB_ANGULAR_CUSTOM + "repository/EventoRecebimentoObjetoRepository.js", this.dominioJS, menuAcompanhamento)); |
435 | 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 | 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 | 1 | -- ERICK SATO INÍCIO 04/04/2016 |
2 | 2 | ALTER TABLE cnt_contrato ADD COLUMN termoReferencia_id bigint; |
3 | 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 @@ |
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 | 14 | 'EventoRecebimentoObjetoRepository', |
15 | 15 | 'EventoRescisaoContratoRepository', |
16 | 16 | 'EventoRepactuacaoRepository', |
17 | + 'EventoLiberacaoPagamentoEmpenhoRepository', | |
17 | 18 | function VisaoContratoController($scope, |
18 | 19 | $filter, |
19 | 20 | $timeout, |
... | ... | @@ -27,7 +28,8 @@ citApp.controller('VisaoContratoController', ['$scope', |
27 | 28 | EventoRegistroNaoConformidadeRepository, |
28 | 29 | EventoRecebimentoObjetoRepository, |
29 | 30 | EventoRescisaoContratoRepository, |
30 | - EventoRepactuacaoRepository) { | |
31 | + EventoRepactuacaoRepository, | |
32 | + EventoLiberacaoPagamentoEmpenhoRepository) { | |
31 | 33 | |
32 | 34 | $scope._START_ITEMS = 0; |
33 | 35 | $scope._LIMIT_ITEMS = 15; |
... | ... | @@ -454,8 +456,11 @@ citApp.controller('VisaoContratoController', ['$scope', |
454 | 456 | break; |
455 | 457 | case 'EMPENHO': |
456 | 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 | 464 | break; |
460 | 465 | case 'NAO_CONFORMIDADE': |
461 | 466 | $scope.visualizarEvento = true; | ... | ... |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.js
0 → 100644
... | ... | @@ -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 | 63 | <div class="col-sm-4"> |
64 | 64 | <div class="control-group" ng-class="{'has-error': numeroEmpenhoObrigatorio}"> |
65 | 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 | 68 | </label> |
69 | 69 | <input type='text' class='form-control' |
70 | 70 | id='contratoEmpenho.numeroEmpenho' maxlength='30' name='contratoEmpenho.numeroEmpenho' |
71 | 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 | 73 | </div> |
74 | 74 | </div> |
75 | 75 | <div class="col-sm-4"> |
... | ... | @@ -79,7 +79,7 @@ |
79 | 79 | <div class="col-sm-4"> |
80 | 80 | <label-select ng-label="LABEL.FINALIDADE_EMPENHO" ng-id="contratoEmpenho.dominioFinalidadeEmpenho" |
81 | 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 | 83 | ng-custom-options="dominioFinalidadeEmpenho.originalElement as dominioFinalidadeEmpenho.descricao for dominioFinalidadeEmpenho"/> |
84 | 84 | </div><!-- .col --> |
85 | 85 | </div> |
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | </div><!-- .col --> |
100 | 100 | <div class="col-sm-4"> |
101 | 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 | 103 | </div><!-- .col --> |
104 | 104 | </div><!-- .row --> |
105 | 105 | <div class="row"> | ... | ... |