Commit 0707e5b8130fe6be3f1f1a27dbaa353cb1525ec9
1 parent
ae4b8bfe
Exists in
master
redmine #4583 inclusao assinatura digital e apresentacao codigo validacao nos docs anexo e online
Showing
4 changed files
with
27 additions
and
12 deletions
Show diff stats
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/TarjaAssinaturaServiceImpl.java
... | ... | @@ -203,10 +203,19 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
203 | 203 | |
204 | 204 | private void gerarAssinaturaDocAnexo(Assinatura assinatura, AnexoImagem anexoImagem, String conteudoAssinatura, Long formaCriacao) { |
205 | 205 | |
206 | - assinatura.getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoAssinatura)); | |
207 | - assinatura.getConteudoTarja().setAnexoImagem(anexoImagem); | |
206 | + if(formaCriacao == 1){ | |
207 | + assinatura.getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoAssinatura)); | |
208 | + assinatura.getConteudoTarja().setAnexoImagem(anexoImagem); | |
209 | + | |
210 | + } else if(formaCriacao == 2) { | |
211 | + try { | |
212 | + conteudoAssinatura = conteudoAssinatura.replaceAll(TarjaAssinatura.CODIGO_ASSINATURA, "<br /><b>".concat(this.assinaturaUtilService.gerarHash(conteudoAssinatura)).concat("</b>")); | |
213 | + assinatura.getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoAssinatura)); | |
214 | + assinatura.getConteudoTarja().setAnexoImagem(anexoImagem); | |
215 | + } catch (Exception e) { | |
216 | + e.printStackTrace(); | |
217 | + } | |
208 | 218 | |
209 | - if (formaCriacao == 2) { | |
210 | 219 | StringBuilder conteudoOriginalDocAnexo = new StringBuilder(); |
211 | 220 | if (UtilObjeto.isReferencia(assinatura.getDocumentoGed().getConteudoTarja())) { |
212 | 221 | conteudoOriginalDocAnexo.append(decrypted(assinatura.getDocumentoGed().getConteudoTarja().getConteudoCriptografado())); |
... | ... | @@ -214,6 +223,7 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
214 | 223 | assinatura.getDocumentoGed().setConteudoTarja(new ConteudoTarja()); |
215 | 224 | } |
216 | 225 | conteudoOriginalDocAnexo.append(conteudoAssinatura); |
226 | + | |
217 | 227 | assinatura.getDocumentoGed().getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoOriginalDocAnexo.toString())); |
218 | 228 | } |
219 | 229 | } |
... | ... | @@ -229,7 +239,7 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
229 | 239 | private void gerarAssinaturaDocOnline(Assinatura assinatura, AnexoImagem anexoImagem, String conteudoAssinatura) { |
230 | 240 | |
231 | 241 | StringBuilder conteudoOriginalDocOnLine = new StringBuilder(); |
232 | - | |
242 | + | |
233 | 243 | if (UtilObjeto.isReferencia(assinatura.getDocumentoGed().getConteudoTarja())) { |
234 | 244 | conteudoOriginalDocOnLine.append(decrypted(assinatura.getDocumentoGed().getConteudoTarja().getConteudoCriptografado())); |
235 | 245 | } else { |
... | ... | @@ -241,9 +251,9 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
241 | 251 | // Assinar documento |
242 | 252 | assinatura.getDocumentoGed().setConteudoAssinado(this.assinaturaUtilService.geraAssinatura(conteudoOriginalDocOnLine.toString().getBytes())); |
243 | 253 | |
244 | - conteudoOriginalDocOnLine.append("<br />").append(this.assinaturaUtilService.gerarHash(conteudoOriginalDocOnLine.toString())); | |
254 | + String conteudo = conteudoOriginalDocOnLine.toString().replaceAll(TarjaAssinatura.CODIGO_ASSINATURA, "<br /><b>".concat(this.assinaturaUtilService.gerarHash(conteudoOriginalDocOnLine.toString()).concat("</b>"))); | |
245 | 255 | |
246 | - assinatura.getDocumentoGed().getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoOriginalDocOnLine.toString())); | |
256 | + assinatura.getDocumentoGed().getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudo)); | |
247 | 257 | |
248 | 258 | } catch (Exception e) { |
249 | 259 | e.printStackTrace(); | ... | ... |
cit-ecm-api/src/main/resources/scripts/v1.0.0-alpha9/01-cit-ecm-1.0.0-ALFA-3-postgres.sql
1 | 1 | -- CIRO - 18/04/2016 - INICIO |
2 | 2 | |
3 | 3 | ALTER TABLE anexoimagem DROP CONSTRAINT fk_jrmn20bykidk1pkxu492d4bmx; |
4 | +ALTER TABLE tarjaassinatura DROP CONSTRAINT fk_9ybqh1qpbp9udjoi9y2jh6sf9; | |
5 | +ALTER TABLE configuracao DROP CONSTRAINT fk_jfyy1uygxmqqng72p83k88q4e; | |
6 | + | |
4 | 7 | DROP TABLE anexoimagem; |
5 | 8 | |
6 | 9 | CREATE TABLE anexoimagem | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/AssinarDocumentoController.js
... | ... | @@ -79,7 +79,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
79 | 79 | $scope.$openModalConfirm({ |
80 | 80 | message: $translate.instant("ECM.MSG.CONFIRMAR_ASSINATURA"), |
81 | 81 | callback: function () { |
82 | - $scope.setLoadingRemove(true); | |
82 | + $scope.setLoadingGet(true); | |
83 | 83 | AssinaturaRepository.saveAssinaturaInterna(_getAssinatura()).then(function(result){ |
84 | 84 | _atualizarDocumentoSelecionadoAposAssinar(result.originalElement); |
85 | 85 | _resetAssinar(); |
... | ... | @@ -144,6 +144,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
144 | 144 | $scope.documentoSelecionado = documento; |
145 | 145 | $scope.exibirIncluirAssinatura = false; |
146 | 146 | $scope.exibirDocJaAssinado = false; |
147 | + $scope.setLoadingGet(true); | |
147 | 148 | _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ |
148 | 149 | $scope.documentosSelecionados = documentosSelecionados; |
149 | 150 | $scope.documentosSelecionados.forEach(function(doc){ |
... | ... | @@ -151,6 +152,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
151 | 152 | $scope.documentoSelecionado = doc; |
152 | 153 | }); |
153 | 154 | _exibirNenhumaAssinatura(); |
155 | + $scope.setLoading(false); | |
154 | 156 | if($scope.documentoSelecionado.assinaturas && $scope.documentoSelecionado.assinaturas.length == 0) |
155 | 157 | $scope.showAlert("warning", $translate.instant('ECM.MSG.DOCUMENTO_SEM_ASSINATURAS')); |
156 | 158 | }); |
... | ... | @@ -168,6 +170,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
168 | 170 | if(valorOriginal) |
169 | 171 | assinatura.isVisualizarAssinatura = false; |
170 | 172 | else |
173 | + $scope.setLoadingGet(true); | |
171 | 174 | DocumentoGedRepository.get(docSelecionado.id).then(function(result){ |
172 | 175 | $scope.doc = result.originalElement; |
173 | 176 | $scope.documentosSelecionados.forEach(function(doc){ |
... | ... | @@ -183,6 +186,8 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
183 | 186 | idAssinaturaSelecionada = angular.copy(ass.id); |
184 | 187 | } |
185 | 188 | }); |
189 | + | |
190 | + $scope.setLoading(false); | |
186 | 191 | }); |
187 | 192 | |
188 | 193 | $scope.visualizarAssinaturaOnLine = $scope.doc.formaCriacao.codigo == 1; |
... | ... | @@ -195,7 +200,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
195 | 200 | TarjaAssinaturaRepository.getTarjaAssinaturaInterna().then(function(result){ |
196 | 201 | $timeout(function(){ |
197 | 202 | $scope.tarjaAssinatura = result.originalElement; |
198 | - }); | |
203 | + },200); | |
199 | 204 | }); |
200 | 205 | }; |
201 | 206 | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturas.html
... | ... | @@ -43,10 +43,7 @@ |
43 | 43 | <td colspan="7"> |
44 | 44 | <iframe id="conteudoPrototipo" srcdoc="{{assinaturaSelecionada.documentoGed.conteudoTarja.conteudo}}" allowfullscreen class="iframe-assinatura" ng-if="visualizarAssinaturaOnLine"></iframe> |
45 | 45 | <div class="row" style="margin-top: 10px; margin-bottom: 10px;" ng-hide="visualizarAssinaturaOnLine"> |
46 | - <div class="col-sm-2" ng-show="assinaturaSelecionada.conteudoTarja.anexoImagem.anexo"> | |
47 | - <img ng-src="data:image/JPEG;base64,{{assinaturaSelecionada.conteudoTarja.anexoImagem.anexo}}" class="img-thumbnail" style="max-width: 80px; height: 80px;"> | |
48 | - </div> | |
49 | - <div class="col-md-10"> | |
46 | + <div class="col-md-12"> | |
50 | 47 | <iframe id="conteudoAssinado" srcdoc="{{assinaturaSelecionada.conteudoTarja.conteudo}}" allowfullscreen class="iframe-assinatura" |
51 | 48 | style="min-height: 80px !important; max-height: 120px !important;"> |
52 | 49 | </iframe> | ... | ... |