Commit fbaf4344272255e258b40a8b6630fb83a0b95450
1 parent
040d1e71
Exists in
master
redmine #4583 panel para visualizar assinaturas; validacao senha ao assinar; bus…
…ca de tarja assinatura interna;
Showing
26 changed files
with
580 additions
and
48 deletions
Show diff stats
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDao.java
1 | 1 | package br.com.centralit.api.dao; |
2 | 2 | |
3 | +import br.com.centralit.api.model.TarjaAssinatura; | |
3 | 4 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
5 | +import br.com.centralit.framework.model.Dominio; | |
4 | 6 | |
5 | 7 | |
6 | 8 | /** |
... | ... | @@ -16,4 +18,13 @@ import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
16 | 18 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
17 | 19 | * |
18 | 20 | */ |
19 | -public interface TarjaAssinaturaDao extends CitGenericDAO {} | |
21 | +public interface TarjaAssinaturaDao extends CitGenericDAO { | |
22 | + | |
23 | + /** | |
24 | + * Método responsável por obter tarja assinatura interna | |
25 | + * @author rogerio.cassimiro | |
26 | + * @param dominio | |
27 | + * @return {@link TarjaAssinatura} | |
28 | + */ | |
29 | + TarjaAssinatura getTarjaAssinaturaInterna(Dominio dominio); | |
30 | +} | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDaoHibernate.java
... | ... | @@ -4,6 +4,8 @@ import org.springframework.stereotype.Repository; |
4 | 4 | |
5 | 5 | import br.com.centralit.api.model.TarjaAssinatura; |
6 | 6 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
7 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
8 | +import br.com.centralit.framework.model.Dominio; | |
7 | 9 | |
8 | 10 | /** |
9 | 11 | * <p><img src="http://centralit.com.br/images/logo_central.png"></p> |
... | ... | @@ -25,4 +27,16 @@ public class TarjaAssinaturaDaoHibernate extends CitGenericDAOImpl implements Ta |
25 | 27 | super(TarjaAssinatura.class); |
26 | 28 | } |
27 | 29 | |
30 | + /** | |
31 | + * Método responsável por obter tarja assinatura interna | |
32 | + * @author rogerio.cassimiro | |
33 | + * @param dominio | |
34 | + * @return {@link TarjaAssinatura} | |
35 | + */ | |
36 | + @Override | |
37 | + public TarjaAssinatura getTarjaAssinaturaInterna(Dominio dominio){ | |
38 | + SearchSeven searchSeven = new SearchSeven(Boolean.TRUE); | |
39 | + searchSeven.addFilterEqual("tipoAssinatura.id", dominio.getId()); | |
40 | + return searchUnique(searchSeven); | |
41 | + } | |
28 | 42 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/Assinatura.java
1 | 1 | package br.com.centralit.api.model; |
2 | 2 | |
3 | +import javax.persistence.CascadeType; | |
3 | 4 | import javax.persistence.Entity; |
4 | 5 | import javax.persistence.FetchType; |
5 | 6 | import javax.persistence.GeneratedValue; |
6 | 7 | import javax.persistence.GenerationType; |
7 | 8 | import javax.persistence.Id; |
8 | 9 | import javax.persistence.ManyToOne; |
10 | +import javax.persistence.OneToOne; | |
9 | 11 | import javax.persistence.Transient; |
10 | 12 | |
11 | 13 | import br.com.centralit.api.framework.json.ViewsEcm; |
... | ... | @@ -79,9 +81,24 @@ public class Assinatura extends PersistentObjectAudit { |
79 | 81 | @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) |
80 | 82 | private Funcao funcao; |
81 | 83 | |
84 | + /** Atributo idTask. */ | |
82 | 85 | @Transient |
83 | 86 | private Long idTask; |
84 | 87 | |
88 | + /** Atributo password. */ | |
89 | + @Transient | |
90 | + private String password; | |
91 | + | |
92 | + /** Atributo conteudoTarja. */ | |
93 | + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | |
94 | + @JsonView({ Views.DocumentoGedEdit.class }) | |
95 | + private ConteudoTarja conteudoTarja; | |
96 | + | |
97 | + /** Atributo pessoa. */ | |
98 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | |
99 | + @ManyToOne(fetch = FetchType.LAZY) | |
100 | + private Pessoa pessoa; | |
101 | + | |
85 | 102 | /** |
86 | 103 | * Retorna o valor do atributo <code>id</code> |
87 | 104 | * |
... | ... | @@ -202,4 +219,64 @@ public class Assinatura extends PersistentObjectAudit { |
202 | 219 | this.idTask = idTask; |
203 | 220 | } |
204 | 221 | |
222 | + /** | |
223 | + * Retorna o valor do atributo <code>conteudoTarja</code> | |
224 | + * | |
225 | + * @return <code>ConteudoTarja</code> | |
226 | + */ | |
227 | + public ConteudoTarja getConteudoTarja() { | |
228 | + | |
229 | + return conteudoTarja; | |
230 | + } | |
231 | + | |
232 | + /** | |
233 | + * Define o valor do atributo <code>conteudoTarja</code>. | |
234 | + * | |
235 | + * @param conteudoTarja | |
236 | + */ | |
237 | + public void setConteudoTarja(ConteudoTarja conteudoTarja) { | |
238 | + | |
239 | + this.conteudoTarja = conteudoTarja; | |
240 | + } | |
241 | + | |
242 | + /** | |
243 | + * Retorna o valor do atributo <code>password</code> | |
244 | + * | |
245 | + * @return <code>String</code> | |
246 | + */ | |
247 | + public String getPassword() { | |
248 | + | |
249 | + return password; | |
250 | + } | |
251 | + | |
252 | + /** | |
253 | + * Define o valor do atributo <code>password</code>. | |
254 | + * | |
255 | + * @param password | |
256 | + */ | |
257 | + public void setPassword(String password) { | |
258 | + | |
259 | + this.password = password; | |
260 | + } | |
261 | + | |
262 | + /** | |
263 | + * Retorna o valor do atributo <code>pessoa</code> | |
264 | + * | |
265 | + * @return <code>Pessoa</code> | |
266 | + */ | |
267 | + public Pessoa getPessoa() { | |
268 | + | |
269 | + return pessoa; | |
270 | + } | |
271 | + | |
272 | + /** | |
273 | + * Define o valor do atributo <code>pessoa</code>. | |
274 | + * | |
275 | + * @param pessoa | |
276 | + */ | |
277 | + public void setPessoa(Pessoa pessoa) { | |
278 | + | |
279 | + this.pessoa = pessoa; | |
280 | + } | |
281 | + | |
205 | 282 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/ConteudoTarja.java
0 → 100644
... | ... | @@ -0,0 +1,108 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import javax.persistence.Basic; | |
4 | +import javax.persistence.Entity; | |
5 | +import javax.persistence.FetchType; | |
6 | +import javax.persistence.GeneratedValue; | |
7 | +import javax.persistence.GenerationType; | |
8 | +import javax.persistence.Id; | |
9 | +import javax.persistence.Lob; | |
10 | +import javax.persistence.Transient; | |
11 | + | |
12 | +import org.hibernate.annotations.Type; | |
13 | + | |
14 | +import br.com.centralit.framework.json.Views; | |
15 | + | |
16 | +import com.fasterxml.jackson.annotation.JsonView; | |
17 | + | |
18 | +/** | |
19 | + * <p> | |
20 | + * <b>Title: </b> | |
21 | + * </p> | |
22 | + * <p> | |
23 | + * <b>Description: </b> | |
24 | + * </p> | |
25 | + * | |
26 | + * @since 27/04/2016 - 08:22:01 | |
27 | + * @author rogerio.cassimiro | |
28 | + * | |
29 | + */ | |
30 | +@Entity | |
31 | +public class ConteudoTarja { | |
32 | + | |
33 | + /** Atributo id. */ | |
34 | + @Id | |
35 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
36 | + @JsonView({ Views.GenericView.class }) | |
37 | + private Long id; | |
38 | + | |
39 | + @JsonView({ Views.DocumentoGedEdit.class }) | |
40 | + @Transient | |
41 | + private String conteudo; | |
42 | + | |
43 | + @Lob | |
44 | + @Basic(fetch = FetchType.LAZY) | |
45 | + @Type(type = "org.hibernate.type.BinaryType") | |
46 | + private byte[] conteudoCriptografado; | |
47 | + | |
48 | + /** | |
49 | + * Retorna o valor do atributo <code>id</code> | |
50 | + * | |
51 | + * @return <code>Long</code> | |
52 | + */ | |
53 | + public Long getId() { | |
54 | + | |
55 | + return id; | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * Define o valor do atributo <code>id</code>. | |
60 | + * | |
61 | + * @param id | |
62 | + */ | |
63 | + public void setId(Long id) { | |
64 | + | |
65 | + this.id = id; | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * Retorna o valor do atributo <code>conteudo</code> | |
70 | + * | |
71 | + * @return <code>String</code> | |
72 | + */ | |
73 | + public String getConteudo() { | |
74 | + | |
75 | + return conteudo; | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * Define o valor do atributo <code>conteudo</code>. | |
80 | + * | |
81 | + * @param conteudo | |
82 | + */ | |
83 | + public void setConteudo(String conteudo) { | |
84 | + | |
85 | + this.conteudo = conteudo; | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * Retorna o valor do atributo <code>conteudoCriptografado</code> | |
90 | + * | |
91 | + * @return <code>byte[]</code> | |
92 | + */ | |
93 | + public byte[] getConteudoCriptografado() { | |
94 | + | |
95 | + return conteudoCriptografado; | |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * Define o valor do atributo <code>conteudoCriptografado</code>. | |
100 | + * | |
101 | + * @param conteudoCriptografado | |
102 | + */ | |
103 | + public void setConteudoCriptografado(byte[] conteudoCriptografado) { | |
104 | + | |
105 | + this.conteudoCriptografado = conteudoCriptografado; | |
106 | + } | |
107 | + | |
108 | +} | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/DocumentoGed.java
... | ... | @@ -244,6 +244,14 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
244 | 244 | @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) |
245 | 245 | private Collection<Assinatura> assinaturas; |
246 | 246 | |
247 | + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | |
248 | + @JsonView({ Views.DocumentoGedEdit.class }) | |
249 | + private ConteudoTarja conteudoTarja; | |
250 | + | |
251 | + @Transient | |
252 | + @JsonView({ Views.ProcessoEdit.class, Views.DocumentoGedEdit.class }) | |
253 | + private String tresAssinaturas; | |
254 | + | |
247 | 255 | /** |
248 | 256 | * @return the novaVersao |
249 | 257 | */ |
... | ... | @@ -1022,4 +1030,44 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
1022 | 1030 | this.assinaturas = assinaturas; |
1023 | 1031 | } |
1024 | 1032 | |
1033 | + /** | |
1034 | + * Retorna o valor do atributo <code>conteudoTarja</code> | |
1035 | + * | |
1036 | + * @return <code>ConteudoTarja</code> | |
1037 | + */ | |
1038 | + public ConteudoTarja getConteudoTarja() { | |
1039 | + | |
1040 | + return conteudoTarja; | |
1041 | + } | |
1042 | + | |
1043 | + /** | |
1044 | + * Define o valor do atributo <code>conteudoTarja</code>. | |
1045 | + * | |
1046 | + * @param conteudoTarja | |
1047 | + */ | |
1048 | + public void setConteudoTarja(ConteudoTarja conteudoTarja) { | |
1049 | + | |
1050 | + this.conteudoTarja = conteudoTarja; | |
1051 | + } | |
1052 | + | |
1053 | + /** | |
1054 | + * Retorna o valor do atributo <code>tresAssinaturas</code> | |
1055 | + * | |
1056 | + * @return <code>String</code> | |
1057 | + */ | |
1058 | + public String getTresAssinaturas() { | |
1059 | + | |
1060 | + return tresAssinaturas; | |
1061 | + } | |
1062 | + | |
1063 | + /** | |
1064 | + * Define o valor do atributo <code>tresAssinaturas</code>. | |
1065 | + * | |
1066 | + * @param tresAssinaturas | |
1067 | + */ | |
1068 | + public void setTresAssinaturas(String tresAssinaturas) { | |
1069 | + | |
1070 | + this.tresAssinaturas = tresAssinaturas; | |
1071 | + } | |
1072 | + | |
1025 | 1073 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/TarjaAssinatura.java
... | ... | @@ -43,6 +43,13 @@ public class TarjaAssinatura extends PersistentObjectAudit{ |
43 | 43 | @OneToOne |
44 | 44 | @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class }) |
45 | 45 | private AnexoImagem anexoImagem; |
46 | + | |
47 | + public static String LOGO = "@logo@"; | |
48 | + public static String NOME_ASSINANTE = "@nome_assinante@"; | |
49 | + public static String FUNCAO_ASSINANTE = " @funcao_assinante@"; | |
50 | + public static String DATA_ASSINATURA = " @data_assinatura@"; | |
51 | + public static String HORA_ASSINATURA = "@hora_assinatura@"; | |
52 | + public static String CODIGO_ASSINATURA = "@codigo_assinatura@"; | |
46 | 53 | |
47 | 54 | public Long getId() { |
48 | 55 | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/DocumentoGedService.java
... | ... | @@ -78,4 +78,10 @@ public interface DocumentoGedService extends GenericService<DocumentoGed, Long> |
78 | 78 | */ |
79 | 79 | Collection<DocumentoGed> atualizarSigiloDocumentos(Collection<DocumentoGed> listaDocumentos); |
80 | 80 | |
81 | + /** | |
82 | + * Método responsável por montar as três primeiras assinaturas por documento para apresentação no tooltip da tela de execução de tarefa | |
83 | + * @author rogerio.cassimiro | |
84 | + * @param documentos | |
85 | + */ | |
86 | + void montarTresAssinantesPorDocumento(Collection<DocumentoGed> documentos); | |
81 | 87 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/TarjaAssinaturaService.java
... | ... | @@ -2,6 +2,7 @@ package br.com.centralit.api.service; |
2 | 2 | |
3 | 3 | import org.springframework.web.multipart.MultipartFile; |
4 | 4 | |
5 | +import br.com.centralit.api.model.Assinatura; | |
5 | 6 | import br.com.centralit.api.model.TarjaAssinatura; |
6 | 7 | import br.com.centralit.framework.service.arquitetura.GenericService; |
7 | 8 | |
... | ... | @@ -54,4 +55,18 @@ public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, |
54 | 55 | * @return |
55 | 56 | */ |
56 | 57 | TarjaAssinatura removeImagem (TarjaAssinatura tarjaAssinatura); |
58 | + | |
59 | + /** | |
60 | + * Método responsável por obter tarja assinatura interna | |
61 | + * @author rogerio.cassimiro | |
62 | + * @return {@link TarjaAssinatura} | |
63 | + */ | |
64 | + TarjaAssinatura getTarjaAssinaturaInterna(); | |
65 | + | |
66 | + /** | |
67 | + * Método responsável por gerar assinatura interna por usuário e por documento | |
68 | + * @author rogerio.cassimiro | |
69 | + * @param assinatura | |
70 | + */ | |
71 | + void gerarAssinaturaInternaUsuario(Assinatura assinatura); | |
57 | 72 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AnexoGedServiceImpl.java
... | ... | @@ -107,7 +107,7 @@ public class AnexoGedServiceImpl extends GenericServiceImpl<AnexoGed, Long> impl |
107 | 107 | |
108 | 108 | documentoGed.setConteudo(this.gedFileService.doOcr(anexo)); |
109 | 109 | |
110 | - this.solrService.addDocumento(documentoGed); | |
110 | +// this.solrService.addDocumento(documentoGed); | |
111 | 111 | |
112 | 112 | anexo.setDocumentoGed(documentoGed); |
113 | 113 | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AssinaturaServiceImpl.java
1 | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | |
3 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | +import org.springframework.beans.factory.annotation.Value; | |
4 | 5 | import org.springframework.security.core.context.SecurityContextHolder; |
5 | 6 | import org.springframework.stereotype.Service; |
6 | 7 | |
... | ... | @@ -11,10 +12,16 @@ import br.com.centralit.api.service.DocumentoGedService; |
11 | 12 | import br.com.centralit.api.service.DominioService; |
12 | 13 | import br.com.centralit.api.service.FuncaoService; |
13 | 14 | import br.com.centralit.api.service.HistoricoAlteracaoProcessoService; |
15 | +import br.com.centralit.api.service.PessoaService; | |
16 | +import br.com.centralit.api.service.TarjaAssinaturaService; | |
14 | 17 | import br.com.centralit.api.service.UsuarioService; |
18 | +import br.com.centralit.framework.exception.BusinessException; | |
19 | +import br.com.centralit.framework.exception.CodigoErro; | |
15 | 20 | import br.com.centralit.framework.model.Dominio; |
16 | 21 | import br.com.centralit.framework.model.Usuario; |
17 | 22 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
23 | +import br.com.centralit.framework.util.UtilObjeto; | |
24 | +import br.com.centralit.framework.util.UtilString; | |
18 | 25 | |
19 | 26 | |
20 | 27 | /** |
... | ... | @@ -44,9 +51,18 @@ public class AssinaturaServiceImpl extends GenericServiceImpl<Assinatura, Long> |
44 | 51 | private FuncaoService funcaoService; |
45 | 52 | |
46 | 53 | @Autowired |
54 | + private PessoaService pessoaService; | |
55 | + | |
56 | + @Autowired | |
47 | 57 | private HistoricoAlteracaoProcessoService historicoAlteracaoProcessoService; |
48 | 58 | |
49 | 59 | @Autowired |
60 | + private TarjaAssinaturaService tarjaAssinaturaService; | |
61 | + | |
62 | + @Value("${metodo.autenticacao.ldap}") | |
63 | + private String ldap; | |
64 | + | |
65 | + @Autowired | |
50 | 66 | public AssinaturaServiceImpl( AssinaturaDao assinaturaDao) { |
51 | 67 | this.dao = assinaturaDao; |
52 | 68 | } |
... | ... | @@ -56,14 +72,48 @@ public class AssinaturaServiceImpl extends GenericServiceImpl<Assinatura, Long> |
56 | 72 | */ |
57 | 73 | @Override |
58 | 74 | public Assinatura saveAssinaturaInterna(Assinatura assinatura) { |
75 | + Usuario usuario = (Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | |
76 | + this.validarSenha(assinatura.getPassword(), usuario); | |
59 | 77 | assinatura.setDocumentoGed(this.documentoGedService.getReference(assinatura.getDocumentoGed().getId())); |
60 | - assinatura.setUsuario((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal()); | |
78 | + assinatura.setUsuario(usuario); | |
79 | + assinatura.setPessoa(this.pessoaService.getReference(assinatura.getPessoa().getId())); | |
61 | 80 | assinatura.setTipoAssinatura(dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA)); |
62 | 81 | assinatura.setFuncao(funcaoService.getReference(assinatura.getFuncao().getId())); |
63 | 82 | historicoAlteracaoProcessoService.gerarHistoricoAssinatura(assinatura); |
83 | + salvarTarjaAssinaturaPorTipoDocumento(assinatura); | |
64 | 84 | return super.save(assinatura); |
65 | 85 | } |
86 | + | |
87 | + private void salvarTarjaAssinaturaPorTipoDocumento(Assinatura assinatura) { | |
88 | + //OnLine | |
89 | + if(assinatura.getDocumentoGed().getFormaCriacao().getCodigo() == 1){ | |
90 | + //TODO ON LINE | |
91 | + }else { | |
92 | + this.tarjaAssinaturaService.gerarAssinaturaInternaUsuario(assinatura); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * Método responsável por validar senha para assinar o documento | |
98 | + * @author rogerio.cassimiro | |
99 | + * @param password | |
100 | + * @param usuario | |
101 | + */ | |
102 | + private void validarSenha(String password, Usuario usuario) { | |
103 | + | |
104 | + if(!UtilString.isNullOrEmpty(ldap) && ldap.equals("false")) { | |
66 | 105 | |
106 | + if(UtilString.isNullOrEmpty(password)) | |
107 | + throw new BusinessException("ECM.VALIDACAO.SENHA_ASSINATURA", CodigoErro.REGRA_NEGOCIO.getValue(), ""); | |
108 | + | |
109 | + if(!UtilObjeto.isReferencia(this.usuarioService.loadUserByUsernamePasswordMobile(usuario.getUsername(), password))) | |
110 | + throw new BusinessException("ECM.VALIDACAO.SENHA_ASSINATURA_INVALIDA", CodigoErro.REGRA_NEGOCIO.getValue(), ""); | |
111 | + | |
112 | + } else { | |
113 | + //TODO LDAP validação | |
114 | + } | |
115 | + } | |
116 | + | |
67 | 117 | /** |
68 | 118 | * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado |
69 | 119 | * @author rogerio.cassimiro | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/DocumentoGedServiceImpl.java
... | ... | @@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile; |
22 | 22 | |
23 | 23 | import br.com.centralit.api.dao.DocumentoGedDao; |
24 | 24 | import br.com.centralit.api.model.AnexoGed; |
25 | +import br.com.centralit.api.model.Assinatura; | |
25 | 26 | import br.com.centralit.api.model.DocumentoGed; |
26 | 27 | import br.com.centralit.api.model.InteressadoDocumento; |
27 | 28 | import br.com.centralit.api.model.Processo; |
... | ... | @@ -230,7 +231,7 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo |
230 | 231 | // Verifica se o documento é sigiloso |
231 | 232 | if (!UtilObjeto.isReferencia(entity.getSigilo())) { |
232 | 233 | |
233 | - this.solrService.addDocumento(entity); | |
234 | + //this.solrService.addDocumento(entity); | |
234 | 235 | } |
235 | 236 | |
236 | 237 | } catch (Exception e) { |
... | ... | @@ -316,9 +317,9 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo |
316 | 317 | |
317 | 318 | if (UtilObjeto.isReferencia(entity.getProcesso().getSigilo())) { |
318 | 319 | if (entity.getProcesso().getSigilo().getTipoSigilo().getCodigo() == 1L) { |
319 | - if (entity.getSigilo().getTipoSigilo().getCodigo() == 0L) { | |
320 | - throw new BusinessException(DocumentoGedServiceImpl.VALIDAR_NIVEL_ACESSO, CodigoErro.REGRA_NEGOCIO.getValue()); | |
321 | - } | |
320 | +// if (entity.getSigilo().getTipoSigilo().getCodigo() == 0L) { | |
321 | +// throw new BusinessException(DocumentoGedServiceImpl.VALIDAR_NIVEL_ACESSO, CodigoErro.REGRA_NEGOCIO.getValue()); | |
322 | +// } | |
322 | 323 | } else if (entity.getProcesso().getSigilo().getTipoSigilo().getCodigo() == 2L) { |
323 | 324 | if (!UtilObjeto.isReferencia(entity.getSigilo()) || entity.getSigilo().getTipoSigilo().getCodigo() != 2L) { |
324 | 325 | throw new BusinessException(DocumentoGedServiceImpl.VALIDAR_NIVEL_ACESSO, CodigoErro.REGRA_NEGOCIO.getValue()); |
... | ... | @@ -1020,5 +1021,32 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo |
1020 | 1021 | |
1021 | 1022 | return this.documentoGedDao.findPorPlanoClassificacao(idPlanoClassificacao); |
1022 | 1023 | } |
1024 | + | |
1025 | + /** | |
1026 | + * Método responsável por montar as três primeiras assinaturas por documento para apresentação no tooltip da tela de execução de tarefa | |
1027 | + * @author rogerio.cassimiro | |
1028 | + * @param documentos | |
1029 | + */ | |
1030 | + @Override | |
1031 | + public void montarTresAssinantesPorDocumento(Collection<DocumentoGed> documentos) { | |
1032 | + | |
1033 | + if(!UtilColecao.isVazio(documentos)){ | |
1034 | + for (DocumentoGed documentoGed : documentos) { | |
1035 | + if(!UtilColecao.isVazio(documentoGed.getAssinaturas())){ | |
1036 | + int maxAssinatura = 0; | |
1037 | + StringBuilder tresAssinaturas = new StringBuilder(); | |
1038 | + for (Assinatura assinatura : documentoGed.getAssinaturas()) { | |
1039 | + if(++maxAssinatura < 4) | |
1040 | + tresAssinaturas.append(UtilObjeto.isReferencia(assinatura.getPessoa()) ? assinatura.getPessoa().getNome() : "").append(" - ").append(assinatura.getFuncao().getNome()).append(". "); | |
1041 | + else { | |
1042 | + tresAssinaturas.append("..."); | |
1043 | + break; | |
1044 | + } | |
1045 | + } | |
1046 | + documentoGed.setTresAssinaturas(tresAssinaturas.toString()); | |
1047 | + } | |
1048 | + } | |
1049 | + } | |
1050 | + } | |
1023 | 1051 | |
1024 | 1052 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/HistoricoAlteracaoProcessoServiceImpl.java
... | ... | @@ -213,7 +213,7 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi |
213 | 213 | mapaAtributos.put("tipo_documento", null); |
214 | 214 | mapaAtributos.put("numero_documento", null); |
215 | 215 | HistoricoAlteracaoProcesso hap = new HistoricoAlteracaoProcesso(assinatura.getDocumentoGed().getProcesso(), Calendar.getInstance(), |
216 | - usuario.getUnidade().getNome(), usuario.getUsername(), assinatura.getIdTask(), AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_DESCRICAO, | |
216 | + UtilObjeto.isReferencia(usuario.getUnidade()) ? usuario.getUnidade().getNome() : null, usuario.getUsername(), assinatura.getIdTask(), AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_DESCRICAO, | |
217 | 217 | AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_CHAVE, assinatura.getDocumentoGed(), mapaAtributos); |
218 | 218 | hap.setAutor(usuario); |
219 | 219 | this.saveWithParams(hap); | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/ProcessoServiceImpl.java
... | ... | @@ -53,7 +53,6 @@ import br.com.centralit.framework.model.Notificacao; |
53 | 53 | import br.com.centralit.framework.model.NotificacaoGrupo; |
54 | 54 | import br.com.centralit.framework.model.Unidade; |
55 | 55 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
56 | -import br.com.centralit.framework.util.Util; | |
57 | 56 | import br.com.centralit.framework.util.UtilColecao; |
58 | 57 | import br.com.centralit.framework.util.UtilDate; |
59 | 58 | import br.com.centralit.framework.util.UtilObjeto; |
... | ... | @@ -278,7 +277,7 @@ public class ProcessoServiceImpl extends GenericServiceImpl<Processo, Long> impl |
278 | 277 | |
279 | 278 | if (!UtilObjeto.isReferencia(processo.getSigilo())) { |
280 | 279 | |
281 | - this.solrService.addProcesso(processo); | |
280 | +// this.solrService.addProcesso(processo); | |
282 | 281 | } |
283 | 282 | |
284 | 283 | } catch (final Exception e) { |
... | ... | @@ -709,6 +708,8 @@ public class ProcessoServiceImpl extends GenericServiceImpl<Processo, Long> impl |
709 | 708 | Processo processo = super.getReference(id); |
710 | 709 | |
711 | 710 | processo.setDocumentos(this.documentoGedService.findByIdProcessoUltimaVersao(id)); |
711 | + | |
712 | + this.documentoGedService.montarTresAssinantesPorDocumento(processo.getDocumentos()); | |
712 | 713 | |
713 | 714 | return processo; |
714 | 715 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/TarjaAssinaturaServiceImpl.java
... | ... | @@ -9,12 +9,17 @@ import org.springframework.stereotype.Service; |
9 | 9 | import org.springframework.validation.Validator; |
10 | 10 | import org.springframework.web.multipart.MultipartFile; |
11 | 11 | |
12 | +import com.ibm.icu.util.Calendar; | |
13 | + | |
12 | 14 | import br.com.centralit.api.dao.TarjaAssinaturaDao; |
15 | +import br.com.centralit.api.model.Assinatura; | |
13 | 16 | import br.com.centralit.api.model.TarjaAssinatura; |
14 | 17 | import br.com.centralit.api.service.AnexoImagemService; |
18 | +import br.com.centralit.api.service.DominioService; | |
15 | 19 | import br.com.centralit.api.service.OrganizacaoService; |
16 | 20 | import br.com.centralit.api.service.TarjaAssinaturaService; |
17 | 21 | import br.com.centralit.framework.model.AnexoImagem; |
22 | +import br.com.centralit.framework.model.Dominio; | |
18 | 23 | import br.com.centralit.framework.model.Organizacao; |
19 | 24 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
20 | 25 | |
... | ... | @@ -43,6 +48,9 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
43 | 48 | private AnexoImagemService anexoImagemService; |
44 | 49 | |
45 | 50 | private TarjaAssinaturaDao tarjaAssinaturaDao; |
51 | + | |
52 | + @Autowired | |
53 | + private DominioService dominioService; | |
46 | 54 | |
47 | 55 | @Autowired |
48 | 56 | public TarjaAssinaturaServiceImpl (TarjaAssinaturaDao tarjaAssinaturaDao, @Qualifier("tarjaAssinaturaValidator") Validator validator) { |
... | ... | @@ -90,4 +98,31 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu |
90 | 98 | + "identificar a causa: ", ioe.getCause()); |
91 | 99 | } |
92 | 100 | } |
101 | + | |
102 | + /** | |
103 | + * Método responsável por obter tarja assinatura interna | |
104 | + * @author rogerio.cassimiro | |
105 | + * @return {@link TarjaAssinatura} | |
106 | + */ | |
107 | + @Override | |
108 | + public TarjaAssinatura getTarjaAssinaturaInterna() { | |
109 | + Dominio dominio = dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA); | |
110 | + return this.tarjaAssinaturaDao.getTarjaAssinaturaInterna(dominio); | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * Método responsável por gerar assinatura interna por usuário e por documento | |
115 | + * @author rogerio.cassimiro | |
116 | + * @param assinatura | |
117 | + */ | |
118 | + @Override | |
119 | + public void gerarAssinaturaInternaUsuario(Assinatura assinatura) { | |
120 | + String conteudo = assinatura.getConteudoTarja().getConteudo(); | |
121 | + conteudo = conteudo.replaceAll(TarjaAssinatura.DATA_ASSINATURA, Calendar.getInstance().toString()) | |
122 | + .replaceAll(TarjaAssinatura.FUNCAO_ASSINANTE, assinatura.getPessoa().getNome()) | |
123 | + .replaceAll(TarjaAssinatura.FUNCAO_ASSINANTE, assinatura.getPessoa().getNome()) | |
124 | + .replaceAll(TarjaAssinatura.FUNCAO_ASSINANTE, assinatura.getPessoa().getNome()) | |
125 | + .replaceAll(TarjaAssinatura.FUNCAO_ASSINANTE, assinatura.getPessoa().getNome()); | |
126 | + | |
127 | + } | |
93 | 128 | } | ... | ... |
cit-ecm-api/src/main/resources/scripts/release-2.0.0-spring-2/01-cit-ecm-2.0.0-sprint-2-postgres.sql
0 → 100644
... | ... | @@ -0,0 +1,22 @@ |
1 | +-- 27/04/2016 ROGERIO CASSIMIRO TARJA PARA DOC E ASSINATURA | |
2 | +CREATE TABLE public.conteudotarja | |
3 | +( | |
4 | + id bigint NOT NULL, | |
5 | + conteudocriptografado bytea, | |
6 | + CONSTRAINT conteudotarja_pkey PRIMARY KEY (id) | |
7 | +) | |
8 | +WITH ( | |
9 | + OIDS=FALSE | |
10 | +); | |
11 | +ALTER TABLE public.conteudotarja | |
12 | + OWNER TO postgres; | |
13 | + | |
14 | +ALTER TABLE assinatura ADD COLUMN conteudotarja_id bigint, | |
15 | + ADD CONSTRAINT fk_conteudo_tarja FOREIGN KEY (conteudotarja_id) | |
16 | + REFERENCES conteudotarja (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; | |
17 | + | |
18 | +ALTER TABLE documentoged | |
19 | + ADD COLUMN conteudotarja_id bigint, | |
20 | + ADD CONSTRAINT fk_conteudo_tarja FOREIGN KEY (conteudotarja_id) | |
21 | + REFERENCES conteudotarja (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; | |
22 | + -- 27/04/2016 ROGERIO CASSIMIRO | |
0 | 23 | \ No newline at end of file | ... | ... |
cit-ecm-api/src/main/resources/scripts/v1.0.0-alpha9/01-cit-ecm-1.0.0-ALFA-3-postgres.sql
... | ... | @@ -33,7 +33,7 @@ CREATE TABLE anexoimagem |
33 | 33 | ); |
34 | 34 | |
35 | 35 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) |
36 | -VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 1)); | |
36 | +VALUES (NEXTVAL('hibernate_sequence'), NULL, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 1)); | |
37 | 37 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) |
38 | -VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 2)); | |
38 | +VALUES (NEXTVAL('hibernate_sequence'), NULL, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 2)); | |
39 | 39 | -- CIRO - 18/04/2016 - FIM |
40 | 40 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/java/br/com/centralit/controller/DocumentoGedController.java
1 | 1 | package br.com.centralit.controller; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
3 | 4 | import java.util.Collection; |
5 | +import java.util.List; | |
4 | 6 | |
5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
6 | 8 | import org.springframework.stereotype.Controller; |
9 | +import org.springframework.web.bind.annotation.PathVariable; | |
7 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | 11 | import org.springframework.web.bind.annotation.RequestMethod; |
9 | 12 | import org.springframework.web.bind.annotation.RequestParam; |
... | ... | @@ -192,4 +195,15 @@ public class DocumentoGedController extends GenericController<DocumentoGed> { |
192 | 195 | |
193 | 196 | return ViewsEcm.DocumentoGedList.class; |
194 | 197 | } |
198 | + | |
199 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | |
200 | + @ResponseBody | |
201 | + public ResponseBodyWrapper getObject(@PathVariable("id") Long id) { | |
202 | + ResultResponseVH<DocumentoGed> resultResponseVH = new ResultResponseVH<DocumentoGed>(genericService.getReference(id)); | |
203 | + List<DocumentoGed> list = new ArrayList<DocumentoGed>(); | |
204 | + list.add(resultResponseVH.getPayload()); | |
205 | + this.documentoGedService.montarTresAssinantesPorDocumento(list); | |
206 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, this.getEditView()); | |
207 | + return responseBody; | |
208 | + } | |
195 | 209 | } | ... | ... |
cit-ecm-web/src/main/java/br/com/centralit/controller/TarjaAssinaturaController.java
... | ... | @@ -16,6 +16,7 @@ import br.com.centralit.api.model.TarjaAssinatura; |
16 | 16 | import br.com.centralit.api.service.TarjaAssinaturaService; |
17 | 17 | import br.com.centralit.framework.controller.GenericController; |
18 | 18 | import br.com.centralit.framework.json.ResponseBodyWrapper; |
19 | +import br.com.centralit.framework.view.ResultResponseVH; | |
19 | 20 | |
20 | 21 | @Controller |
21 | 22 | @RequestMapping("/rest/tarjaAssinatura") |
... | ... | @@ -61,5 +62,13 @@ public class TarjaAssinaturaController extends GenericController<TarjaAssinatura |
61 | 62 | |
62 | 63 | return responseBody; |
63 | 64 | } |
65 | + | |
66 | + @RequestMapping(value = "/getTarjaAssinaturaInterna", method = RequestMethod.GET) | |
67 | + @ResponseBody | |
68 | + public ResponseBodyWrapper getTarjaAssinaturaInterna() { | |
69 | + ResultResponseVH<TarjaAssinatura> resultResponseVH = new ResultResponseVH<TarjaAssinatura>(tarjaAssinaturaService.getTarjaAssinaturaInterna()); | |
70 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, this.getEditView()); | |
71 | + return responseBody; | |
72 | + } | |
64 | 73 | |
65 | 74 | } | ... | ... |
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
... | ... | @@ -489,8 +489,8 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
489 | 489 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.GRUPO_PADRAO_EM_OUTRA_UNIDADE", "O grupo selecionado como padrão está sendo usado como grupo padrão da unidade ", dominio, modulo)); |
490 | 490 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_ALTERACAO_NIVEL_ACESSO_OUTRAS_UNIDADES", "Não é possível alterar o nível de acesso para sigiloso, pois o processo foi enviado para outra unidade.", dominio, modulo)); |
491 | 491 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_NIVEL_ACESSO", "Não é possível incluir documento com o nível de acesso menor que o do processo.", dominio, modulo)); |
492 | - | |
493 | 492 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA", "Informe sua senha para assinar!", dominio, modulo)); |
493 | + internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA_INVALIDA", "Senha do usuário inválida!", dominio, modulo)); | |
494 | 494 | } |
495 | 495 | |
496 | 496 | /** | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/AssinarDocumentoController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | 3 | |
4 | -citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'GerenciarProcessoRepository', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository', 'PessoaRepository', '$q', 'AssinaturaRepository', | |
5 | - function AssinarDocumentoController($scope, $translate, GerenciarProcessoRepository, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository, PessoaRepository, $q, AssinaturaRepository) { | |
4 | +citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'GerenciarProcessoRepository', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository', '$q', 'AssinaturaRepository', 'TarjaAssinaturaRepository', '$timeout', | |
5 | + function AssinarDocumentoController($scope, $translate, GerenciarProcessoRepository, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository, $q, AssinaturaRepository, TarjaAssinaturaRepository, $timeout) { | |
6 | 6 | |
7 | 7 | /* |
8 | 8 | * Abre panel assinar documento |
... | ... | @@ -26,7 +26,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
26 | 26 | _exibirNenhumaAssinatura(); |
27 | 27 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ |
28 | 28 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); |
29 | - //_obterPermissaoAssinaturaDocumentoExterno(); | |
29 | + $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; | |
30 | 30 | }); |
31 | 31 | }); |
32 | 32 | } |
... | ... | @@ -38,7 +38,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
38 | 38 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ |
39 | 39 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); |
40 | 40 | $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; |
41 | - //_obterPermissaoAssinaturaDocumentoExterno(); | |
41 | + _getTarjaAssinaturaInterna(); | |
42 | 42 | }); |
43 | 43 | }); |
44 | 44 | }; |
... | ... | @@ -75,21 +75,47 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
75 | 75 | } |
76 | 76 | |
77 | 77 | AssinaturaRepository.saveAssinaturaInterna(_getAssinatura()).then(function(result){ |
78 | - if($scope.documentoSelecionado.assinaturas) | |
79 | - $scope.documentoSelecionado.assinaturas.push(result.originalElement); | |
80 | - $scope.autenticacao = null; | |
81 | - $scope.exibirIncluirAssinatura = false; | |
82 | - $scope.nenhumaAssinatura = false; | |
83 | - $scope.documentosSelecionados.forEach(function(doc){ | |
84 | - if(doc.id == $scope.documentoSelecionado.id) | |
85 | - doc.assinaturas = $scope.documentoSelecionado.assinaturas; | |
86 | - }); | |
78 | + _atualizarDocumentoSelecionadoAposAssinar(result.originalElement); | |
79 | + _resetAssinar(); | |
80 | + _atualizarDocDoProcessoAposAssinar(); | |
87 | 81 | $scope.showAlert("success", $translate.instant('ECM.ASSINADO_SUCESSO')); |
88 | 82 | }); |
89 | 83 | }; |
90 | 84 | |
91 | 85 | function _getAssinatura(){ |
92 | - return {documentoGed : { id : $scope.documentoSelecionado.id }, funcao : {id : _getFuncaoChecked()}, idTask : $scope.$parent.task.id }; | |
86 | + return { | |
87 | + documentoGed : { id : $scope.documentoSelecionado.id }, | |
88 | + funcao : {id : _getFuncaoChecked()}, | |
89 | + idTask : $scope.$parent.task.id, | |
90 | + password : $scope.autenticacao, | |
91 | + pessoa : { id : $scope.pessoa.id}, | |
92 | + conteudoTarja : { id : $scope.tarjaAssinatura.id}}; | |
93 | + }; | |
94 | + | |
95 | + function _atualizarDocumentoSelecionadoAposAssinar(assinatura){ | |
96 | + if($scope.documentoSelecionado.assinaturas) | |
97 | + $scope.documentoSelecionado.assinaturas.push(assinatura); | |
98 | + $scope.documentosSelecionados.forEach(function(doc){ | |
99 | + if(doc.id == $scope.documentoSelecionado.id) | |
100 | + doc.assinaturas = $scope.documentoSelecionado.assinaturas; | |
101 | + }); | |
102 | + }; | |
103 | + | |
104 | + function _resetAssinar() { | |
105 | + $scope.autenticacao = null; | |
106 | + $scope.exibirIncluirAssinatura = false; | |
107 | + $scope.nenhumaAssinatura = false; | |
108 | + }; | |
109 | + | |
110 | + function _atualizarDocDoProcessoAposAssinar() { | |
111 | + DocumentoGedRepository.get($scope.documentoSelecionado.id).then(function(result){ | |
112 | + $scope.processo.documentos.forEach(function(doc){ | |
113 | + if(doc.id == result.originalElement.id) { | |
114 | + doc.assinaturas = result.originalElement.assinaturas; | |
115 | + doc.tresAssinaturas = result.originalElement.tresAssinaturas; | |
116 | + } | |
117 | + }); | |
118 | + }); | |
93 | 119 | }; |
94 | 120 | |
95 | 121 | function _getFuncaoChecked(){ |
... | ... | @@ -124,4 +150,36 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren |
124 | 150 | }); |
125 | 151 | }; |
126 | 152 | |
153 | + $scope.visualizarAssinatura = function(docSelecionado, assinatura){ | |
154 | + var valorOriginal = assinatura.isVisualizarAssinatura; | |
155 | + if(valorOriginal) | |
156 | + assinatura.isVisualizarAssinatura = false; | |
157 | + else | |
158 | + DocumentoGedRepository.get(docSelecionado.id).then(function(result){ | |
159 | + $scope.doc = result.originalElement; | |
160 | + $scope.documentosSelecionados.forEach(function(doc){ | |
161 | + doc.assinaturas.forEach(function(ass){ | |
162 | + ass.isVisualizarAssinatura = false; | |
163 | + }); | |
164 | + if(doc.id == docSelecionado.id) | |
165 | + doc.assinaturas.forEach(function(ass){ | |
166 | + if(ass.id != assinatura.id) | |
167 | + ass.isVisualizarAssinatura = false; | |
168 | + else | |
169 | + ass.isVisualizarAssinatura = valorOriginal != true; | |
170 | + }); | |
171 | + }); | |
172 | + | |
173 | + $scope.visualizarAssinaturaOnLine = $scope.doc.formaCriacao.codigo == 1; | |
174 | + }); | |
175 | + }; | |
176 | + | |
177 | + function _getTarjaAssinaturaInterna(){ | |
178 | + $scope.tarjaAssinatura = null; | |
179 | + TarjaAssinaturaRepository.getTarjaAssinaturaInterna().then(function(result){ | |
180 | + $timeout(function(){ | |
181 | + $scope.tarjaAssinatura = result.originalElement; | |
182 | + }); | |
183 | + }); | |
184 | + }; | |
127 | 185 | }] ); |
128 | 186 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/GerenciarProcessoListUnidadeController.js
... | ... | @@ -69,10 +69,13 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow |
69 | 69 | }; |
70 | 70 | |
71 | 71 | $scope.obterTransclude = function() { |
72 | + $scope.setLoadingGet(true); | |
72 | 73 | _getProcesso(); |
73 | 74 | if($scope.modelSelecionado){ |
74 | 75 | _getFilterCriteriaTarefa(); |
75 | 76 | _fetchBusinessProcess(); |
77 | + } else { | |
78 | + $scope.setLoading(true); | |
76 | 79 | } |
77 | 80 | }; |
78 | 81 | |
... | ... | @@ -114,8 +117,10 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow |
114 | 117 | $scope.assignments = result.originalElement.objects; |
115 | 118 | if($scope.assignments.length > 0) |
116 | 119 | _recuperarPermissoes($scope.assignments[0].id); |
117 | - else | |
120 | + else { | |
118 | 121 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; |
122 | + $scope.setLoading(false); | |
123 | + } | |
119 | 124 | }); |
120 | 125 | }; |
121 | 126 | |
... | ... | @@ -126,6 +131,7 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow |
126 | 131 | $scope.btnAction = !(!$scope.workItem.execute && !$scope.workItem.suspend && !$scope.workItem.delegate && !$scope.workItem.restart && !$scope.workItem.visualize); |
127 | 132 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; |
128 | 133 | $scope.modelSelecionado.workItem = $scope.workItem; |
134 | + $scope.setLoading(false); | |
129 | 135 | }); |
130 | 136 | }; |
131 | 137 | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/repository/TarjaAssinaturaRepository.js
... | ... | @@ -11,6 +11,11 @@ citApp.factory('TarjaAssinaturaRepository', ['RestangularEcm', 'AbstractReposito |
11 | 11 | this.removeImagem = function(tarjaAssinatura) { |
12 | 12 | return restangularEcm.all(this.route + "/removeImagem").post(tarjaAssinatura).then(); |
13 | 13 | }; |
14 | + | |
15 | + this.getTarjaAssinaturaInterna = function() { | |
16 | + return this.restangular.one(this.route + "/getTarjaAssinaturaInterna").get(); | |
17 | + }; | |
18 | + | |
14 | 19 | } |
15 | 20 | |
16 | 21 | AbstractRepository.extend(TarjaAssinaturaRepository); | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaEdit.html
... | ... | @@ -28,6 +28,9 @@ |
28 | 28 | <div class="col-sm-4" > |
29 | 29 | <label-input ng-type="password" ng-id="autenticacao" ng-disabled="false" ng-model="$parent.autenticacao" /> |
30 | 30 | </div> |
31 | + <div class="col-sm-7"> | |
32 | + <div ng-include src="'/cit-ecm-web/html/assinatura/documentoBtnAssinar.html'" ng-show="exibirIncluirAssinatura"/> | |
33 | + </div> | |
31 | 34 | <!-- <div class="col-sm-4" style="margin-top: 5px; !important"> --> |
32 | 35 | <!-- <label> --> |
33 | 36 | <!-- <translate>ECM.LABEL.OU</translate> --> |
... | ... | @@ -37,4 +40,10 @@ |
37 | 40 | <!-- <i class="glyphicon glyphicon-info-sign blue" tooltip="{{$translate.instant('ECM.LABEL.CERTIFICADO_DIGITAL')}}" style="margin-left: 5px;"></i> --> |
38 | 41 | <!-- </label> --> |
39 | 42 | <!-- </div> --> |
43 | +</div> | |
44 | + | |
45 | +<div class="row"> | |
46 | + <div class="col-sm-12"> | |
47 | + <div ng-include src="'/cit-ecm-web/html/assinatura/documentoTarjaAssinaturaInterna.html'" ng-show="exibirIncluirAssinatura"/> | |
48 | + </div> | |
40 | 49 | </div> |
41 | 50 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaView.html
... | ... | @@ -2,11 +2,11 @@ |
2 | 2 | <div class="widget-header"> |
3 | 3 | <h2 class="widget-title"> |
4 | 4 | <div ng-if="exibirIncluirAssinatura"> |
5 | - <translate>ECM.LABEL.ASSINATURA_DO_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | |
5 | + <translate>ECM.LABEL.ASSINATURA_DO_DOCUMENTO</translate> : {{documentoSelecionado.tipoDocumento.nome}} - {{documentoSelecionado.numero}} | |
6 | 6 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} |
7 | 7 | </div> |
8 | 8 | <div ng-if="!exibirIncluirAssinatura"> |
9 | - <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | |
9 | + <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate> : {{documentoSelecionado.tipoDocumento.nome}} - {{documentoSelecionado.numero}} | |
10 | 10 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} |
11 | 11 | </div> |
12 | 12 | </h2> |
... | ... | @@ -29,14 +29,6 @@ |
29 | 29 | |
30 | 30 | <div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturas.html'" /> |
31 | 31 | |
32 | - <div class="row" ng-if="exibirIncluirAssinatura"> | |
33 | - <div class="col-md-12"> | |
34 | - <button ng-click="assinar()" title="{{$translate.instant('ECM.LABEL.ASSINAR')}}" alt="{{$translate.instant('ECM.LABEL.ASSINAR')}}" type="button" class="btn btn-sm btn-primary"> | |
35 | - <translate>ECM.LABEL.ASSINAR</translate> | |
36 | - </button> | |
37 | - </div> | |
38 | - </div> | |
39 | - | |
40 | 32 | </div> |
41 | 33 | </div> |
42 | 34 | </div> | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturas.html
... | ... | @@ -9,10 +9,11 @@ |
9 | 9 | <th><small><translate>LABEL.UNIDADE</translate></small></th> |
10 | 10 | <th><small><translate>ECM.LABEL.TIPO_ASSINATURA</translate></small></th> |
11 | 11 | <th><small><translate>ECM.LABEL.DATA_DA_ASSINATURA</translate></small></th> |
12 | + <th></th> | |
12 | 13 | </tr> |
13 | 14 | </thead> |
14 | 15 | <tbody ng-repeat="docSelecionado in documentosSelecionados"> |
15 | - <tr ng-repeat="assinatura in docSelecionado.assinaturas"> | |
16 | + <tr ng-repeat-start="assinatura in docSelecionado.assinaturas"> | |
16 | 17 | <td> |
17 | 18 | <small>{{docSelecionado.versaoDocumento}}</small> |
18 | 19 | </td> |
... | ... | @@ -31,11 +32,25 @@ |
31 | 32 | <td> |
32 | 33 | <small>{{assinatura.dataCriacao | date : 'dd/MM/yyyy HH:mm:ss'}}</small> |
33 | 34 | </td> |
35 | + <td class="text-center"> | |
36 | + <button type="button" class="btn btn-success btn-sm" ng-click="visualizarAssinatura(docSelecionado, assinatura);" style="padding-top: 0px; padding-bottom: 0px; !important"> | |
37 | + <translate ng-if="assinatura.isVisualizarAssinatura">LABEL.FECHAR</translate> | |
38 | + <translate ng-hide="assinatura.isVisualizarAssinatura">LABEL.VISUALIZAR</translate> | |
39 | + </button> | |
40 | + </td> | |
41 | + </tr> | |
42 | + <tr ng-repeat-end ng-show="assinatura.isVisualizarAssinatura"> | |
43 | + <td colspan="7"> | |
44 | + <iframe id="visualizacaoConteudoDoc" srcdoc="{{doc.conteudo}}" allowfullscreen class="iframe-assinatura" ng-if="visualizarAssinaturaOnLine"></iframe> | |
45 | + <div ng-hide="visualizarAssinaturaOnLine"> | |
46 | + doc anexo | |
47 | + </div> | |
48 | + </td> | |
34 | 49 | </tr> |
35 | 50 | </tbody> |
36 | 51 | <tfoot> |
37 | 52 | <tr ng-hide="nenhumaAssinatura"> |
38 | - <td colspan="6"> | |
53 | + <td colspan="7"> | |
39 | 54 | <strong><translate>ECM.LABEL.DOCUMENTO_SEM_ASSINATURA</translate></strong> |
40 | 55 | </td> |
41 | 56 | </tr> | ... | ... |
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeDocumentosProcesso.html
... | ... | @@ -17,13 +17,15 @@ |
17 | 17 | <div class="text ellipsis" tooltip="{{documento.assuntoComplementar}}">{{documento.assuntoComplementar}}</div> |
18 | 18 | |
19 | 19 | <div class="itemdiv-informacoes"> |
20 | - <span class="label label-gray" ng-show="documento.sigilo.tipoSigilo.codigo == 0 ">{{documento.sigilo.tipoSigilo.descricao}}</span> <span class="label label-danger" | |
21 | - ng-show="documento.sigilo.tipoSigilo.codigo == 1 ">{{documento.sigilo.tipoSigilo.descricao}}</span> <span class="label label-black" ng-show="documento.sigilo.tipoSigilo.codigo == 2 ">{{documento.sigilo.tipoSigilo.descricao}}</span> | |
22 | - <span class="label label-warning" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 1">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-success" | |
23 | - ng-show="documento.nivelAcesso.nivelAcesso.codigo == 2">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-info" ng-show="documento.origem">Anexado</span> <span | |
24 | - class="label label-info" ng-show="documento.assinaturas && documento.assinaturas.length > 0">Assinado</span> <span class="label label-success" ng-show="false">Habilitado</span> <span class="label label-warning" ng-show="false">Ciência</span> <span | |
25 | - class="label label-danger" ng-show="documento.cancelado">Cancelado</span> | |
26 | - | |
20 | + <span class="label label-gray" ng-show="documento.sigilo.tipoSigilo.codigo == 0 ">{{documento.sigilo.tipoSigilo.descricao}}</span> | |
21 | + <span class="label label-danger" ng-show="documento.sigilo.tipoSigilo.codigo == 1 ">{{documento.sigilo.tipoSigilo.descricao}}</span> | |
22 | + <span class="label label-black" ng-show="documento.sigilo.tipoSigilo.codigo == 2 ">{{documento.sigilo.tipoSigilo.descricao}}</span> | |
23 | + <span class="label label-warning" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 1">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> | |
24 | + <span class="label label-success" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 2">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-info" ng-show="documento.origem">Anexado</span> | |
25 | + <span class="label" style="background : #0000FF" tooltip="{{documento.tresAssinaturas}}" | |
26 | + ng-show="documento.assinaturas && documento.assinaturas.length > 0">Assinado</span> | |
27 | + <span class="label label-success" ng-show="false">Habilitado</span> <span class="label label-warning" ng-show="false">Ciência</span> | |
28 | + <span class="label label-danger" ng-show="documento.cancelado">Cancelado</span> | |
27 | 29 | </div> |
28 | 30 | |
29 | 31 | </div> |
... | ... | @@ -35,7 +37,7 @@ |
35 | 37 | </button> |
36 | 38 | |
37 | 39 | <ul class="dropdown-menu-center dropdown-menu dropdown-caret" role="menu"> |
38 | - <li ng-if='!documento.cancelado && documento.status.codigo != 0'><a href="#void" ng-click="editDocument(documento, true);"><translate>LABEL.EDITAR</translate></a></li> | |
40 | + <li ng-if='!documento.cancelado && documento.status.codigo != 0 && documento.assinaturas && documento.assinaturas.length == 0'><a href="#void" ng-click="editDocument(documento, true);"><translate>LABEL.EDITAR</translate></a></li> | |
39 | 41 | <li ng-if='!processo.isTramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click="removeDocumento(documento, $index);"><translate>LABEL.REMOVER</translate></a></li> |
40 | 42 | <li ng-if='processo.isTramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click='cancelarDocumento(documento)'> <translate>ECM.LABEL.CANCELARDOCUMENTO</translate></a></li> |
41 | 43 | <li ng-if='!documento.cancelado'><a href="#void" ng-click="visualizarVersoes(documento);"> <translate>ECM.LABEL.VERSOESDODOCUMENTO</translate></a></li> | ... | ... |