Commit 506a3c81e4b563c50285eaa4fa94a2ae344ca775
Exists in
master
Merge branch 'tarefa-4583' into desenvolvimento
Showing
24 changed files
with
818 additions
and
70 deletions
Show diff stats
cit-ecm-api/src/main/java/br/com/centralit/api/dao/AssinaturaDao.java
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +package br.com.centralit.api.dao; | |
2 | + | |
3 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <p><b>Title: </b></p> | |
8 | + * <p><b>Description: </b></p> | |
9 | + * | |
10 | + * @since 22/04/2016 - 11:52:08 | |
11 | + * @author rogerio.cassimiro | |
12 | + * | |
13 | + */ | |
14 | +public interface AssinaturaDao extends CitGenericDAO{ | |
15 | + | |
16 | + /** | |
17 | + * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado | |
18 | + * @author rogerio.cassimiro | |
19 | + * @param idDocumento | |
20 | + * @param idUsuario | |
21 | + * @return {@link Boolean} | |
22 | + */ | |
23 | + Boolean validarAssinaturaPorUsuario(Long idDocumento, Long idUsuario); | |
24 | + | |
25 | +} | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/dao/impl/AssinaturaDaoHibernate.java
0 → 100644
... | ... | @@ -0,0 +1,41 @@ |
1 | +package br.com.centralit.api.dao.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Repository; | |
4 | + | |
5 | +import br.com.centralit.api.dao.AssinaturaDao; | |
6 | +import br.com.centralit.api.model.Assinatura; | |
7 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | |
8 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
9 | + | |
10 | + | |
11 | +/** | |
12 | + * <p><b>Title: </b></p> | |
13 | + * <p><b>Description: </b></p> | |
14 | + * | |
15 | + * @since 22/04/2016 - 11:54:06 | |
16 | + * @author rogerio.cassimiro | |
17 | + * | |
18 | + */ | |
19 | +@Repository("assinaturaDao") | |
20 | +public class AssinaturaDaoHibernate extends CitGenericDAOImpl implements AssinaturaDao{ | |
21 | + | |
22 | + public AssinaturaDaoHibernate() { | |
23 | + super(Assinatura.class); | |
24 | + } | |
25 | + | |
26 | + /** | |
27 | + * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado | |
28 | + * @author rogerio.cassimiro | |
29 | + * @param idDocumento | |
30 | + * @param idUsuario | |
31 | + * @return {@link Boolean} | |
32 | + */ | |
33 | + @Override | |
34 | + public Boolean validarAssinaturaPorUsuario(Long idDocumento, Long idUsuario) { | |
35 | + SearchSeven searchSeven = new SearchSeven(); | |
36 | + searchSeven.addFilterEqual("documentoGed.id", idDocumento); | |
37 | + searchSeven.addFilterEqual("usuario.id", idUsuario); | |
38 | + return this.count(searchSeven) > 0; | |
39 | + } | |
40 | + | |
41 | +} | |
0 | 42 | \ No newline at end of file | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/AcaoHistoricoAlteracaoProcesso.java
... | ... | @@ -59,6 +59,10 @@ public class AcaoHistoricoAlteracaoProcesso extends PersistentObject { |
59 | 59 | private String acao; |
60 | 60 | |
61 | 61 | private String descricao; |
62 | + | |
63 | + public static String ASSINAR_DOCUMENTO_CHAVE = "ASSINAR_DOCUMENTO"; | |
64 | + public static String ASSINAR_DOCUMENTO_ACAO = "Assinatura de documento"; | |
65 | + public static String ASSINAR_DOCUMENTO_DESCRICAO = "O documento <<tipo_documento>> <<numero_documento>> foi assinado por <<usuario>>."; | |
62 | 66 | |
63 | 67 | public AcaoHistoricoAlteracaoProcesso() { |
64 | 68 | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/Assinatura.java
... | ... | @@ -6,8 +6,11 @@ import javax.persistence.GeneratedValue; |
6 | 6 | import javax.persistence.GenerationType; |
7 | 7 | import javax.persistence.Id; |
8 | 8 | import javax.persistence.ManyToOne; |
9 | +import javax.persistence.Transient; | |
9 | 10 | |
11 | +import br.com.centralit.api.framework.json.ViewsEcm; | |
10 | 12 | import br.com.centralit.framework.json.Views; |
13 | +import br.com.centralit.framework.model.Dominio; | |
11 | 14 | import br.com.centralit.framework.model.Usuario; |
12 | 15 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; |
13 | 16 | |
... | ... | @@ -58,12 +61,26 @@ public class Assinatura extends PersistentObjectAudit { |
58 | 61 | private Long id; |
59 | 62 | |
60 | 63 | /** Atributo usuario. */ |
64 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | |
61 | 65 | @ManyToOne(fetch = FetchType.LAZY) |
62 | 66 | private Usuario usuario; |
63 | 67 | |
64 | - /** Atributo documento. */ | |
68 | + /** Atributo documentoGed. */ | |
65 | 69 | @ManyToOne(fetch = FetchType.LAZY) |
66 | - private Documento documento; | |
70 | + private DocumentoGed documentoGed; | |
71 | + | |
72 | + /** Atributo tipoAssinatura. */ | |
73 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | |
74 | + @ManyToOne(fetch = FetchType.LAZY) | |
75 | + private Dominio tipoAssinatura; | |
76 | + | |
77 | + /** Atributo funcao. */ | |
78 | + @ManyToOne(fetch = FetchType.LAZY) | |
79 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | |
80 | + private Funcao funcao; | |
81 | + | |
82 | + @Transient | |
83 | + private Long idTask; | |
67 | 84 | |
68 | 85 | /** |
69 | 86 | * Retorna o valor do atributo <code>id</code> |
... | ... | @@ -106,23 +123,83 @@ public class Assinatura extends PersistentObjectAudit { |
106 | 123 | } |
107 | 124 | |
108 | 125 | /** |
109 | - * Retorna o valor do atributo <code>documento</code> | |
126 | + * Retorna o valor do atributo <code>documentoGed</code> | |
127 | + * | |
128 | + * @return <code>DocumentoGed</code> | |
129 | + */ | |
130 | + public DocumentoGed getDocumentoGed() { | |
131 | + | |
132 | + return documentoGed; | |
133 | + } | |
134 | + | |
135 | + /** | |
136 | + * Define o valor do atributo <code>documentoGed</code>. | |
137 | + * | |
138 | + * @param documentoGed | |
139 | + */ | |
140 | + public void setDocumentoGed(DocumentoGed documentoGed) { | |
141 | + | |
142 | + this.documentoGed = documentoGed; | |
143 | + } | |
144 | + | |
145 | + /** | |
146 | + * Retorna o valor do atributo <code>tipoAssinatura</code> | |
147 | + * | |
148 | + * @return <code>Dominio</code> | |
149 | + */ | |
150 | + public Dominio getTipoAssinatura() { | |
151 | + | |
152 | + return tipoAssinatura; | |
153 | + } | |
154 | + | |
155 | + /** | |
156 | + * Define o valor do atributo <code>tipoAssinatura</code>. | |
110 | 157 | * |
111 | - * @return <code>Documento</code> | |
158 | + * @param tipoAssinatura | |
159 | + */ | |
160 | + public void setTipoAssinatura(Dominio tipoAssinatura) { | |
161 | + | |
162 | + this.tipoAssinatura = tipoAssinatura; | |
163 | + } | |
164 | + | |
165 | + /** | |
166 | + * Retorna o valor do atributo <code>funcao</code> | |
167 | + * | |
168 | + * @return <code>Funcao</code> | |
169 | + */ | |
170 | + public Funcao getFuncao() { | |
171 | + | |
172 | + return funcao; | |
173 | + } | |
174 | + | |
175 | + /** | |
176 | + * Define o valor do atributo <code>funcao</code>. | |
177 | + * | |
178 | + * @param funcao | |
179 | + */ | |
180 | + public void setFuncao(Funcao funcao) { | |
181 | + | |
182 | + this.funcao = funcao; | |
183 | + } | |
184 | + | |
185 | + /** | |
186 | + * Retorna o valor do atributo <code>idTask</code> | |
187 | + * | |
188 | + * @return <code>Long</code> | |
112 | 189 | */ |
113 | - public Documento getDocumento() { | |
190 | + public Long getIdTask() { | |
114 | 191 | |
115 | - return documento; | |
192 | + return idTask; | |
116 | 193 | } |
117 | 194 | |
118 | 195 | /** |
119 | - * Define o valor do atributo <code>documento</code>. | |
196 | + * Define o valor do atributo <code>idTask</code>. | |
120 | 197 | * |
121 | - * @param documento | |
198 | + * @param idTask | |
122 | 199 | */ |
123 | - public void setDocumento(Documento documento) { | |
200 | + public void setIdTask(Long idTask) { | |
124 | 201 | |
125 | - this.documento = documento; | |
202 | + this.idTask = idTask; | |
126 | 203 | } |
127 | 204 | |
128 | 205 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/Assunto.java
cit-ecm-api/src/main/java/br/com/centralit/api/model/DocumentoGed.java
... | ... | @@ -95,7 +95,7 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
95 | 95 | private Boolean novaVersao; |
96 | 96 | |
97 | 97 | /** Atributo versaoDocumento. */ |
98 | - @JsonView({ Views.DocumentoGedEdit.class }) | |
98 | + @JsonView({ Views.DocumentoGedEdit.class, Views.ProcessoEdit.class }) | |
99 | 99 | private Double versaoDocumento; |
100 | 100 | |
101 | 101 | /** Atributo cancelado. */ |
... | ... | @@ -240,6 +240,10 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
240 | 240 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) |
241 | 241 | private Collection<InteressadoDocumento> interessados; |
242 | 242 | |
243 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "documentoGed") | |
244 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) | |
245 | + private Collection<Assinatura> assinaturas; | |
246 | + | |
243 | 247 | /** |
244 | 248 | * @return the novaVersao |
245 | 249 | */ |
... | ... | @@ -986,6 +990,14 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
986 | 990 | public Dominio getEstado() { |
987 | 991 | |
988 | 992 | return estado; |
993 | + /** | |
994 | + * Retorna o valor do atributo <code>assinaturas</code> | |
995 | + * | |
996 | + * @return <code>Collection<Assinatura></code> | |
997 | + */ | |
998 | + public Collection<Assinatura> getAssinaturas() { | |
999 | + | |
1000 | + return assinaturas; | |
989 | 1001 | } |
990 | 1002 | |
991 | 1003 | /** |
... | ... | @@ -999,3 +1011,15 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { |
999 | 1011 | } |
1000 | 1012 | |
1001 | 1013 | } |
1014 | + | |
1015 | + /** | |
1016 | + * Define o valor do atributo <code>assinaturas</code>. | |
1017 | + * | |
1018 | + * @param assinaturas | |
1019 | + */ | |
1020 | + public void setAssinaturas(Collection<Assinatura> assinaturas) { | |
1021 | + | |
1022 | + this.assinaturas = assinaturas; | |
1023 | + } | |
1024 | + | |
1025 | +} | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/model/HistoricoAlteracaoProcesso.java
... | ... | @@ -101,6 +101,24 @@ public class HistoricoAlteracaoProcesso extends PersistentObjectAudit { |
101 | 101 | |
102 | 102 | @Transient |
103 | 103 | private Map<String, String> mapaAtributos; |
104 | + | |
105 | + public HistoricoAlteracaoProcesso(){ | |
106 | + super(); | |
107 | + } | |
108 | + | |
109 | + public HistoricoAlteracaoProcesso( Processo processo, Calendar dataRegistro, String nomeUnidadeVigente, String nomeUsuario, Long idTask, String descricaoAcao, String acaoAlteracao, DocumentoGed documentoGed, Map<String, String> mapaAtributos) { | |
110 | + | |
111 | + super(); | |
112 | + this.processo = processo; | |
113 | + this.dataRegistro = dataRegistro; | |
114 | + this.nomeUnidadeVigente = nomeUnidadeVigente; | |
115 | + this.nomeUsuario = nomeUsuario; | |
116 | + this.idTask = idTask; | |
117 | + this.descricaoAcao = descricaoAcao; | |
118 | + this.acaoAlteracao = acaoAlteracao; | |
119 | + this.documentoGed = documentoGed; | |
120 | + this.mapaAtributos = mapaAtributos; | |
121 | + } | |
104 | 122 | |
105 | 123 | public Calendar getDataRegistro() { |
106 | 124 | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/AssinaturaService.java
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +package br.com.centralit.api.service; | |
2 | + | |
3 | +import br.com.centralit.api.model.Assinatura; | |
4 | +import br.com.centralit.framework.service.arquitetura.GenericService; | |
5 | + | |
6 | + | |
7 | +/** | |
8 | + * <p><b>Title: </b></p> | |
9 | + * <p><b>Description: </b></p> | |
10 | + * | |
11 | + * @since 22/04/2016 - 11:48:53 | |
12 | + * @author rogerio.cassimiro | |
13 | + * | |
14 | + */ | |
15 | +public interface AssinaturaService extends GenericService<Assinatura, Long>{ | |
16 | + | |
17 | + Assinatura saveAssinaturaInterna(Assinatura entity); | |
18 | + | |
19 | + /** | |
20 | + * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado | |
21 | + * @author rogerio.cassimiro | |
22 | + * @return {@link Boolean} | |
23 | + */ | |
24 | + Boolean validarAssinaturaPorUsuario(Long idDocumento); | |
25 | +} | |
0 | 26 | \ No newline at end of file | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/HistoricoAlteracaoProcessoService.java
... | ... | @@ -2,6 +2,7 @@ package br.com.centralit.api.service; |
2 | 2 | |
3 | 3 | import java.util.Collection; |
4 | 4 | |
5 | +import br.com.centralit.api.model.Assinatura; | |
5 | 6 | import br.com.centralit.api.model.HistoricoAlteracaoProcesso; |
6 | 7 | import br.com.centralit.framework.service.arquitetura.GenericService; |
7 | 8 | |
... | ... | @@ -95,4 +96,10 @@ public interface HistoricoAlteracaoProcessoService extends GenericService<Histor |
95 | 96 | */ |
96 | 97 | boolean saveWithParams(HistoricoAlteracaoProcesso historicoView); |
97 | 98 | |
99 | + /** | |
100 | + * Método responsável por gerar histórico de alteração do processo por assinatura de documento | |
101 | + * @author rogerio.cassimiro | |
102 | + * @param assinatura | |
103 | + */ | |
104 | + void gerarHistoricoAssinatura(Assinatura assinatura); | |
98 | 105 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AssinaturaServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,76 @@ |
1 | +package br.com.centralit.api.service.impl; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.security.core.context.SecurityContextHolder; | |
5 | +import org.springframework.stereotype.Service; | |
6 | + | |
7 | +import br.com.centralit.api.dao.AssinaturaDao; | |
8 | +import br.com.centralit.api.model.Assinatura; | |
9 | +import br.com.centralit.api.service.AssinaturaService; | |
10 | +import br.com.centralit.api.service.DocumentoGedService; | |
11 | +import br.com.centralit.api.service.DominioService; | |
12 | +import br.com.centralit.api.service.FuncaoService; | |
13 | +import br.com.centralit.api.service.HistoricoAlteracaoProcessoService; | |
14 | +import br.com.centralit.api.service.UsuarioService; | |
15 | +import br.com.centralit.framework.model.Dominio; | |
16 | +import br.com.centralit.framework.model.Usuario; | |
17 | +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
18 | + | |
19 | + | |
20 | +/** | |
21 | + * <p><b>Title: </b></p> | |
22 | + * <p><b>Description: </b></p> | |
23 | + * | |
24 | + * @since 22/04/2016 - 11:50:56 | |
25 | + * @author rogerio.cassimiro | |
26 | + * | |
27 | + */ | |
28 | +@Service("assinaturaService") | |
29 | +public class AssinaturaServiceImpl extends GenericServiceImpl<Assinatura, Long> implements AssinaturaService { | |
30 | + | |
31 | + @Autowired | |
32 | + private AssinaturaDao assinaturaDao; | |
33 | + | |
34 | + @Autowired | |
35 | + private DocumentoGedService documentoGedService; | |
36 | + | |
37 | + @Autowired | |
38 | + private UsuarioService usuarioService; | |
39 | + | |
40 | + @Autowired | |
41 | + private DominioService dominioService; | |
42 | + | |
43 | + @Autowired | |
44 | + private FuncaoService funcaoService; | |
45 | + | |
46 | + @Autowired | |
47 | + private HistoricoAlteracaoProcessoService historicoAlteracaoProcessoService; | |
48 | + | |
49 | + @Autowired | |
50 | + public AssinaturaServiceImpl( AssinaturaDao assinaturaDao) { | |
51 | + this.dao = assinaturaDao; | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * Salva assinatura do documento e gera histórico | |
56 | + */ | |
57 | + @Override | |
58 | + public Assinatura saveAssinaturaInterna(Assinatura assinatura) { | |
59 | + assinatura.setDocumentoGed(this.documentoGedService.getReference(assinatura.getDocumentoGed().getId())); | |
60 | + assinatura.setUsuario((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal()); | |
61 | + assinatura.setTipoAssinatura(dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA)); | |
62 | + assinatura.setFuncao(funcaoService.getReference(assinatura.getFuncao().getId())); | |
63 | + historicoAlteracaoProcessoService.gerarHistoricoAssinatura(assinatura); | |
64 | + return super.save(assinatura); | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado | |
69 | + * @author rogerio.cassimiro | |
70 | + * @return {@link Boolean} | |
71 | + */ | |
72 | + @Override | |
73 | + public Boolean validarAssinaturaPorUsuario(Long idDocumento) { | |
74 | + return this.assinaturaDao.validarAssinaturaPorUsuario(idDocumento, ((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId()); | |
75 | + } | |
76 | +} | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/HistoricoAlteracaoProcessoServiceImpl.java
... | ... | @@ -8,14 +8,17 @@ import java.util.Map.Entry; |
8 | 8 | |
9 | 9 | import org.apache.commons.lang.StringUtils; |
10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | +import org.springframework.security.core.context.SecurityContextHolder; | |
11 | 12 | import org.springframework.stereotype.Service; |
12 | 13 | |
13 | 14 | import br.com.centralit.api.dao.HistoricoAlteracaoProcessoDao; |
14 | 15 | import br.com.centralit.api.model.AcaoHistoricoAlteracaoProcesso; |
16 | +import br.com.centralit.api.model.Assinatura; | |
15 | 17 | import br.com.centralit.api.model.HistoricoAlteracaoProcesso; |
16 | 18 | import br.com.centralit.api.service.AcaoHistoricoAlteracaoProcessoService; |
17 | 19 | import br.com.centralit.api.service.HistoricoAlteracaoProcessoService; |
18 | 20 | import br.com.centralit.api.service.ProcessoService; |
21 | +import br.com.centralit.framework.model.Usuario; | |
19 | 22 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
20 | 23 | import br.com.centralit.framework.util.UtilObjeto; |
21 | 24 | |
... | ... | @@ -105,6 +108,7 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi |
105 | 108 | toSave.setIdTask(historicoView.getIdTask()); |
106 | 109 | toSave.setAcaoAlteracao(acao.getAcao()); |
107 | 110 | toSave.setDataRegistro(Calendar.getInstance()); |
111 | + toSave.setDocumentoGed(historicoView.getDocumentoGed()); | |
108 | 112 | |
109 | 113 | toSave = (HistoricoAlteracaoProcesso) historicoAlteracaoProcessoDao.save(toSave); |
110 | 114 | |
... | ... | @@ -118,7 +122,7 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi |
118 | 122 | |
119 | 123 | return ( (HistoricoAlteracaoProcesso) historicoAlteracaoProcessoDao.save(toSave) ) != null ? true : false; |
120 | 124 | } |
121 | - | |
125 | + | |
122 | 126 | private void produceViewParams(HistoricoAlteracaoProcesso historico, HistoricoAlteracaoProcesso toSave) { |
123 | 127 | |
124 | 128 | Map<String, String> mapaAtributos; |
... | ... | @@ -195,5 +199,23 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi |
195 | 199 | } |
196 | 200 | historico.setDescricaoAcao(descricaoAcao); |
197 | 201 | } |
198 | - | |
202 | + | |
203 | + /** | |
204 | + * Método responsável por gerar histórico de alteração do processo por assinatura de documento | |
205 | + * @author rogerio.cassimiro | |
206 | + * @param assinatura | |
207 | + */ | |
208 | + @Override | |
209 | + public void gerarHistoricoAssinatura(Assinatura assinatura) { | |
210 | + | |
211 | + Usuario usuario = (Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | |
212 | + Map<String, String> mapaAtributos = new HashMap<String, String>(); | |
213 | + mapaAtributos.put("tipo_documento", null); | |
214 | + mapaAtributos.put("numero_documento", null); | |
215 | + HistoricoAlteracaoProcesso hap = new HistoricoAlteracaoProcesso(assinatura.getDocumentoGed().getProcesso(), Calendar.getInstance(), | |
216 | + usuario.getUnidade().getNome(), usuario.getUsername(), assinatura.getIdTask(), AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_DESCRICAO, | |
217 | + AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_CHAVE, assinatura.getDocumentoGed(), mapaAtributos); | |
218 | + hap.setAutor(usuario); | |
219 | + this.saveWithParams(hap); | |
220 | + } | |
199 | 221 | } | ... | ... |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/InicializarEcmServiceImpl.java
... | ... | @@ -140,7 +140,9 @@ public class InicializarEcmServiceImpl extends UtilStartup { |
140 | 140 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/ConfiguracaoUsuarioUnidadeRepository.js", this.dominioJS, menuCadastroProcesso)); |
141 | 141 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/EstruturaOrganizacionalECMRepository.js", this.dominioJS, menuCadastroProcesso)); |
142 | 142 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/ConfiguracaoUsuarioUnidadeRepository.min.js", this.dominioJS, menuCadastroProcesso)); |
143 | - | |
143 | + | |
144 | + filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/controller/AssinarDocumentoController.js", this.dominioJS, menuCadastroProcesso)); | |
145 | + filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/AssinaturaRepository.js", this.dominioJS, menuCadastroProcesso)); | |
144 | 146 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/DocumentoGedRepository.js", this.dominioJS, menuCadastroProcesso)); |
145 | 147 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/repository/DocumentoGedRepository.min.js", this.dominioJS, menuCadastroProcesso)); |
146 | 148 | filesProcesso.add(new MenuFile("/cit-ecm-web/assets/js/angular/custom/controller/GerenciarProcessoController.js", this.dominioJS, menuCadastroProcesso)); | ... | ... |
cit-ecm-web/src/main/java/br/com/centralit/controller/AssinaturaController.java
0 → 100644
... | ... | @@ -0,0 +1,72 @@ |
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.RequestBody; | |
6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
8 | +import org.springframework.web.bind.annotation.RequestParam; | |
9 | +import org.springframework.web.bind.annotation.ResponseBody; | |
10 | + | |
11 | +import br.com.centralit.api.framework.json.ViewsEcm; | |
12 | +import br.com.centralit.api.model.Assinatura; | |
13 | +import br.com.centralit.api.service.AssinaturaService; | |
14 | +import br.com.centralit.framework.controller.GenericController; | |
15 | +import br.com.centralit.framework.json.ResponseBodyWrapper; | |
16 | +import br.com.centralit.framework.json.Views.GenericView; | |
17 | +import br.com.centralit.framework.view.ResultResponseVH; | |
18 | + | |
19 | +/** | |
20 | + * <p><b>Title: </b>AssinaturaController</p> | |
21 | + * <p><b>Description: </b></p> | |
22 | + * | |
23 | + * @since 22/04/2016 - 11:47:45 | |
24 | + * @author rogerio.cassimiro | |
25 | + * | |
26 | + */ | |
27 | +@Controller | |
28 | +@RequestMapping("/rest/assinatura") | |
29 | +public class AssinaturaController extends GenericController<Assinatura>{ | |
30 | + | |
31 | + private AssinaturaService assinaturaService; | |
32 | + | |
33 | + @Autowired | |
34 | + public AssinaturaController(AssinaturaService assinaturaService){ | |
35 | + super(assinaturaService); | |
36 | + this.assinaturaService = assinaturaService; | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * Método responsável por salvar assinatura interna | |
41 | + * @author rogerio.cassimiro | |
42 | + * @param assinatura | |
43 | + * @return {@link ResponseBody} | |
44 | + * @throws Exception | |
45 | + */ | |
46 | + @RequestMapping(method = RequestMethod.POST, value = "/saveAssinaturaInterna") | |
47 | + @ResponseBody | |
48 | + public ResponseBodyWrapper saveAssinaturaInterna(@RequestBody Assinatura assinatura) throws Exception { | |
49 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(this.assinaturaService.saveAssinaturaInterna(assinatura), getEditView()); | |
50 | + return responseBody; | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * Método responsável por validar se o usuário já teve uma assinatura para o documento selecionado | |
55 | + * @author rogerio.cassimiro | |
56 | + * @param idDocumento | |
57 | + * @return {@link Boolean} | |
58 | + */ | |
59 | + @RequestMapping(value = "/validarAssinaturaPorUsuario", method = RequestMethod.GET) | |
60 | + @ResponseBody | |
61 | + public ResponseBodyWrapper validarAssinaturaPorUsuario(@RequestParam(value = "idDocumento") Long idDocumento) { | |
62 | + ResultResponseVH<Boolean> resultResponseVH = new ResultResponseVH<Boolean>(this.assinaturaService.validarAssinaturaPorUsuario(idDocumento)); | |
63 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, this.getEditView()); | |
64 | + return responseBody; | |
65 | + } | |
66 | + | |
67 | + @Override | |
68 | + public Class<? extends GenericView> getEditView() { | |
69 | + return ViewsEcm.DocumentoGedEdit.class; | |
70 | + } | |
71 | + | |
72 | +} | ... | ... |
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
... | ... | @@ -76,15 +76,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
76 | 76 | * <p> |
77 | 77 | * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> |
78 | 78 | * </p> |
79 | - * | |
79 | + * | |
80 | 80 | * <p> |
81 | 81 | * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> |
82 | 82 | * </p> |
83 | - * | |
83 | + * | |
84 | 84 | * Método responsável por criar as regras de acesso |
85 | - * | |
85 | + * | |
86 | 86 | * @author rogerio.costa |
87 | - * | |
87 | + * | |
88 | 88 | */ |
89 | 89 | private void criarRegraDeAcesso() { |
90 | 90 | |
... | ... | @@ -107,9 +107,9 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Método responsável por criar domínios específicos ECM |
110 | - * | |
110 | + * | |
111 | 111 | * @author halan.lima |
112 | - * | |
112 | + * | |
113 | 113 | */ |
114 | 114 | protected void popularAcoesAlteracaoProcesso() { |
115 | 115 | |
... | ... | @@ -141,6 +141,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
141 | 141 | list.add(new AcaoHistoricoAlteracaoProcesso("ACAO_PROCESSO", "Ação", "<<acao>> , protocolo <<protocolo>>.")); |
142 | 142 | list.add(new AcaoHistoricoAlteracaoProcesso("VALIDAR_PROCESSO", "Validar Processo", "O processo <<protocolo>> foi validado e seus documentos.")); |
143 | 143 | list.add(new AcaoHistoricoAlteracaoProcesso("ATRIBUICAO_PROCESSO", "Atribuição de processo", "O processo <<protocolo>> foi atribuido para <<usuario>>.")); |
144 | + list.add(new AcaoHistoricoAlteracaoProcesso("ASSINAR_DOCUMENTO", "Assinatura de documento", "O documento <<tipo_documento>> <<numero_documento>> foi assinado por <<usuario>>.")); | |
144 | 145 | |
145 | 146 | try { |
146 | 147 | this.acaoHistoricoAlteracaoProcessoService.saveListIfNotExist(list); |
... | ... | @@ -153,15 +154,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
153 | 154 | * <p> |
154 | 155 | * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> |
155 | 156 | * </p> |
156 | - * | |
157 | + * | |
157 | 158 | * <p> |
158 | 159 | * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> |
159 | 160 | * </p> |
160 | - * | |
161 | + * | |
161 | 162 | * Método responsável por incluir dominios |
162 | - * | |
163 | + * | |
163 | 164 | * @author rogerio.costa |
164 | - * | |
165 | + * | |
165 | 166 | */ |
166 | 167 | private void criarDominios() { |
167 | 168 | |
... | ... | @@ -197,7 +198,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
197 | 198 | |
198 | 199 | list.add(new Dominio("tipoProtocoloNup", "Automático", "EXTERNO", 1L, Boolean.FALSE)); |
199 | 200 | list.add(new Dominio("tipoProtocoloNup", "Informado", "NUP_NOVO", 2L, Boolean.FALSE)); |
200 | - | |
201 | + | |
201 | 202 | list.add(new Dominio("formaNumeracao", "Sequencial por ano", "SEQUENCIAL_ANO", 1L)); |
202 | 203 | list.add(new Dominio("formaNumeracao", "Sequencial único", "SEQUENCIAL_UNICO", 2L)); |
203 | 204 | |
... | ... | @@ -205,7 +206,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
205 | 206 | list.add(new Dominio("statusProcesso", "Em andamento", "EM_ANDAMENTO", 2L)); |
206 | 207 | list.add(new Dominio("statusProcesso", "Aguardando Validação", "AGUARDANDO_VALIDACAO", 3L)); |
207 | 208 | list.add(new Dominio("statusProcesso", "Validado", "VALIDADO", 4L)); |
208 | - | |
209 | + | |
209 | 210 | list.add(new Dominio("statusDocumentoGed", "Aguardando Validação", "AGUARDANDO_VALIDACAO", 0L)); |
210 | 211 | list.add(new Dominio("statusDocumentoGed", "Validado", "VALIDADO", 1L)); |
211 | 212 | |
... | ... | @@ -229,11 +230,11 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
229 | 230 | } |
230 | 231 | |
231 | 232 | /** |
232 | - * | |
233 | + * | |
233 | 234 | * Método responsável por gerar internacionalização do módulo ECM |
234 | - * | |
235 | + * | |
235 | 236 | * @author rogerio.cassimiro |
236 | - * | |
237 | + * | |
237 | 238 | */ |
238 | 239 | private void gerarInternacionalizacao() { |
239 | 240 | |
... | ... | @@ -253,15 +254,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
253 | 254 | * <p> |
254 | 255 | * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> |
255 | 256 | * </p> |
256 | - * | |
257 | + * | |
257 | 258 | * <p> |
258 | 259 | * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> |
259 | 260 | * </p> |
260 | - * | |
261 | + * | |
261 | 262 | * Método responsável por criar labels |
262 | - * | |
263 | + * | |
263 | 264 | * @author Rogério Gomes |
264 | - * | |
265 | + * | |
265 | 266 | * @param dominio |
266 | 267 | * @param modulo |
267 | 268 | * @param internacionalizacaoList |
... | ... | @@ -449,6 +450,10 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
449 | 450 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.ESTADO", "Estado", dominio, modulo)); |
450 | 451 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.VALIDAR", "Validar", dominio, modulo)); |
451 | 452 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.NAO_CONTEM_DOCUMENTOS", "Não contém documentos", dominio, modulo)); |
453 | + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DATA_DA_ASSINATURA", "Data da assinatura", dominio, modulo)); | |
454 | + internacionalizacaoList.add(new Internacionalizacao("ECM.ASSINADO_SUCESSO", "Documento assinado com sucesso!", dominio, modulo)); | |
455 | + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.ASSINATURA_DO_DOCUMENTO", "Assinatura do Documento", dominio, modulo)); | |
456 | + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DOCUMENTO_SEM_ASSINATURA", "Documento sem assinaturas!", dominio, modulo)); | |
452 | 457 | |
453 | 458 | } |
454 | 459 | |
... | ... | @@ -456,15 +461,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
456 | 461 | * <p> |
457 | 462 | * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> |
458 | 463 | * </p> |
459 | - * | |
464 | + * | |
460 | 465 | * <p> |
461 | 466 | * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> |
462 | 467 | * </p> |
463 | - * | |
468 | + * | |
464 | 469 | * Método responsável por |
465 | - * | |
470 | + * | |
466 | 471 | * @author Rogério Gomes |
467 | - * | |
472 | + * | |
468 | 473 | * @param dominio |
469 | 474 | * @param modulo |
470 | 475 | * @param internacionalizacaoList |
... | ... | @@ -485,21 +490,22 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
485 | 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)); |
486 | 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)); |
487 | 492 | |
493 | + internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA", "Informe sua senha para assinar!", dominio, modulo)); | |
488 | 494 | } |
489 | 495 | |
490 | 496 | /** |
491 | 497 | * <p> |
492 | 498 | * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> |
493 | 499 | * </p> |
494 | - * | |
500 | + * | |
495 | 501 | * <p> |
496 | 502 | * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> |
497 | 503 | * </p> |
498 | - * | |
504 | + * | |
499 | 505 | * Método responsável por |
500 | - * | |
506 | + * | |
501 | 507 | * @author Rogério Gomes |
502 | - * | |
508 | + * | |
503 | 509 | * @param dominio |
504 | 510 | * @param modulo |
505 | 511 | * @param internacionalizacaoList |
... | ... | @@ -563,5 +569,9 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen |
563 | 569 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.TAREFA_REATIVADA", "Tarefa reativada com sucesso", dominio, modulo)); |
564 | 570 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.VALIDADO", "Validado com sucesso!", dominio, modulo)); |
565 | 571 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.SELECIONE_UM_ITEM_PARA_VALIDACAO", "Selecione um item para validar.", dominio, modulo)); |
572 | + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.ERRO_PERMISSAO_ASSINAR", "Erro! Para assinar documentos é necessário possuir o papel “Servidor” ou “Terceirizado” com “Função” preenchida no Cadastro de Pessoas!", dominio, modulo)); | |
573 | + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.USUARIO_SEM_PESSOA", "Usuário não está presente no Cadastro de Pessoa!", dominio, modulo)); | |
574 | + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_SEM_ASSINATURAS", "Esta versão do Documento não possui assinaturas!", dominio, modulo)); | |
575 | + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_JA_ASSINADO", "Documento já foi assinado por este usuário!", dominio, modulo)); | |
566 | 576 | } |
567 | 577 | } | ... | ... |
cit-ecm-web/src/main/webapp/assets/css/gerenciarProcesso.css
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | * Os códigos abaixo devem ser colocados nos devidos lugares e/ou utilizados dos css corretos do template, utilizem assim por não conhecer onde estão os css da arquitetura. |
5 | 5 | */ |
6 | 6 | .itemdiv { |
7 | - min-height: 66px; | |
7 | + min-height: 80px; | |
8 | 8 | border: 1px solid #ccc; |
9 | 9 | padding: 10px; |
10 | 10 | position: relative; |
... | ... | @@ -212,4 +212,9 @@ background-color: #f2f2f2; |
212 | 212 | background-color: rgba(245, 245, 245, 0.61); |
213 | 213 | } |
214 | 214 | |
215 | - | |
216 | 215 | \ No newline at end of file |
216 | + .versoes { | |
217 | + font-size : x-small; | |
218 | + font-weight : bold; | |
219 | + text-align : right !important; | |
220 | +} | |
221 | + | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/AssinarDocumentoController.js
0 → 100644
... | ... | @@ -0,0 +1,127 @@ |
1 | +'use strict'; | |
2 | + | |
3 | + | |
4 | +citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'GerenciarProcessoRepository', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository', 'PessoaRepository', '$q', 'AssinaturaRepository', | |
5 | + function AssinarDocumentoController($scope, $translate, GerenciarProcessoRepository, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository, PessoaRepository, $q, AssinaturaRepository) { | |
6 | + | |
7 | + /* | |
8 | + * Abre panel assinar documento | |
9 | + */ | |
10 | + $scope.abrirAssinarDocumento = function(documento) { | |
11 | + $scope.documentoSelecionado = null; | |
12 | + $scope.exibirDocJaAssinado = false; | |
13 | + DocumentoGedRepository.get(documento.id).then(function(result) { | |
14 | + $scope.documentoSelecionado = result.originalElement; | |
15 | + if(documento.formaCriacao.codigo === 1){ | |
16 | + __abrirAssinarDocOnline(documento); | |
17 | + } else if(documento.formaCriacao.codigo === 2){ | |
18 | + __abrirAssinarDocAnexo(documento); | |
19 | + } | |
20 | + }); | |
21 | + }; | |
22 | + | |
23 | + function __abrirAssinarDocOnline(documento){ | |
24 | + _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ | |
25 | + $scope.documentosSelecionados = documentosSelecionados; | |
26 | + _exibirNenhumaAssinatura(); | |
27 | + _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ | |
28 | + $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); | |
29 | + //_obterPermissaoAssinaturaDocumentoExterno(); | |
30 | + }); | |
31 | + }); | |
32 | + } | |
33 | + | |
34 | + function __abrirAssinarDocAnexo(documento){ | |
35 | + _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ | |
36 | + $scope.documentosSelecionados = documentosSelecionados; | |
37 | + _exibirNenhumaAssinatura(); | |
38 | + _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ | |
39 | + $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); | |
40 | + $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; | |
41 | + //_obterPermissaoAssinaturaDocumentoExterno(); | |
42 | + }); | |
43 | + }); | |
44 | + }; | |
45 | + | |
46 | + function _validarAssinaturaPorUsuario(idDocumento){ | |
47 | + var deferred = $q.defer(); | |
48 | + AssinaturaRepository.validarAssinaturaPorUsuario(idDocumento).then(function(result){ | |
49 | + deferred.resolve(result); | |
50 | + }); | |
51 | + return deferred.promise; | |
52 | + } | |
53 | + | |
54 | + function _obterAssinaturasDocumento(documento) { | |
55 | + var deferred = $q.defer(); | |
56 | + var idRaiz = documento.idRaiz; | |
57 | + if ( !idRaiz ) | |
58 | + idRaiz = documento.id; | |
59 | + DocumentoGedRepository.findByIdDocumentoTodasVersoes(idRaiz).then(function(result) { | |
60 | + var results = []; | |
61 | + if(result.length>0){ | |
62 | + result.forEach(function(item){ | |
63 | + results.push(item.originalElement); | |
64 | + }); | |
65 | + } | |
66 | + deferred.resolve(results); | |
67 | + }); | |
68 | + return deferred.promise; | |
69 | + } | |
70 | + | |
71 | + $scope.assinar = function() { | |
72 | + if(!$scope.autenticacao){ | |
73 | + $scope.showAlert("error", $translate.instant('ECM.VALIDACAO.SENHA_ASSINATURA')); | |
74 | + return; | |
75 | + } | |
76 | + | |
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 | + }); | |
87 | + $scope.showAlert("success", $translate.instant('ECM.ASSINADO_SUCESSO')); | |
88 | + }); | |
89 | + }; | |
90 | + | |
91 | + function _getAssinatura(){ | |
92 | + return {documentoGed : { id : $scope.documentoSelecionado.id }, funcao : {id : _getFuncaoChecked()}, idTask : $scope.$parent.task.id }; | |
93 | + }; | |
94 | + | |
95 | + function _getFuncaoChecked(){ | |
96 | + for(var pos = 0; pos < $scope.funcoes.length; pos++){ | |
97 | + if($scope.funcoes[pos].isServidor) | |
98 | + return $scope.funcoes[pos].id; | |
99 | + } | |
100 | + }; | |
101 | + | |
102 | + /* | |
103 | + * Abre panel visualizar assinaturas | |
104 | + */ | |
105 | + $scope.visualizarAssinaturasDocumento = function(documento){ | |
106 | + $scope.documentoSelecionado = documento; | |
107 | + $scope.exibirIncluirAssinatura = false; | |
108 | + $scope.exibirDocJaAssinado = false; | |
109 | + _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ | |
110 | + $scope.documentosSelecionados = documentosSelecionados; | |
111 | + $scope.documentosSelecionados.forEach(function(doc){ | |
112 | + if(doc.id == $scope.documentoSelecionado.id) | |
113 | + $scope.documentoSelecionado = doc; | |
114 | + }); | |
115 | + _exibirNenhumaAssinatura(); | |
116 | + if($scope.documentoSelecionado.assinaturas && $scope.documentoSelecionado.assinaturas.length == 0) | |
117 | + $scope.showAlert("warning", $translate.instant('ECM.MSG.DOCUMENTO_SEM_ASSINATURAS')); | |
118 | + }); | |
119 | + }; | |
120 | + | |
121 | + function _exibirNenhumaAssinatura(){ | |
122 | + $scope.nenhumaAssinatura = $scope.documentosSelecionados.some(function(doc){ | |
123 | + return doc.assinaturas.length > 0; | |
124 | + }); | |
125 | + }; | |
126 | + | |
127 | +}] ); | |
0 | 128 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/GerenciarProcessoController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | 3 | |
4 | -citApp.controller('GerenciarProcessoController', [ '$scope', '$translate', '$timeout','GerenciarProcessoRepository', 'ProcessoRepository', 'RuntimeManagerRepository','$rootScope', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository','UnidadeRepository','UnidadeProcessoRepository','CredencialProcessoRepository', | |
5 | - function GerenciarProcessoController($scope, $translate, $timeout, GerenciarProcessoRepository, ProcessoRepository, RuntimeManagerRepository,$rootScope, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository,UnidadeRepository, UnidadeProcessoRepository,CredencialProcessoRepository ) { | |
4 | +citApp.controller('GerenciarProcessoController', [ '$scope', '$translate', '$timeout','GerenciarProcessoRepository', 'ProcessoRepository', 'RuntimeManagerRepository','$rootScope', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository','UnidadeRepository','UnidadeProcessoRepository','CredencialProcessoRepository', 'PessoaRepository', | |
5 | + function GerenciarProcessoController($scope, $translate, $timeout, GerenciarProcessoRepository, ProcessoRepository, RuntimeManagerRepository,$rootScope, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository,UnidadeRepository, UnidadeProcessoRepository,CredencialProcessoRepository, PessoaRepository) { | |
6 | 6 | |
7 | 7 | $scope.processo = {}; |
8 | 8 | $scope.iconAnexo = {}; |
... | ... | @@ -29,6 +29,7 @@ citApp.controller('GerenciarProcessoController', [ '$scope', '$translate', '$tim |
29 | 29 | $scope.isGerenciarCredencialProcesso = false; |
30 | 30 | $scope.isClassificarProcessoDocumento = false; |
31 | 31 | $scope.isAtribuirProcesso = false; |
32 | + $scope.exibirAssinarDocAnexo = false; | |
32 | 33 | }; |
33 | 34 | |
34 | 35 | // CRIAR RELACIONAMENTO DE PROCESSO |
... | ... | @@ -618,23 +619,25 @@ citApp.controller('GerenciarProcessoController', [ '$scope', '$translate', '$tim |
618 | 619 | |
619 | 620 | ProcessoRepository.getProcessoGerenciamento($scope.idProcesso).then( function ( result ) { |
620 | 621 | $scope.processo = result.originalElement; |
621 | - $scope.apresentarCabecalho = true; | |
622 | - $scope.processo.idTask = $scope.task.id; | |
623 | - | |
624 | - $scope.atualizarAtribuicaoProcesso($scope.idProcesso); | |
625 | - | |
626 | - if ( $scope.$parent != undefined ) { | |
627 | - $scope.$parent.idProcesso = $scope.idProcesso; | |
628 | - } | |
629 | - | |
630 | - if ( angular.element( '#viewGerenciarProcesso' ).scope() != undefined ) { | |
631 | - var workspace = angular.element( '#viewGerenciarProcesso' ).scope().workspace; | |
632 | - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id ); | |
633 | - } | |
634 | - | |
635 | - $scope.tratimitado(); | |
636 | - | |
637 | - $scope.setLoading( false ); | |
622 | + | |
623 | + $scope.apresentarCabecalho = true; | |
624 | + $scope.processo.idTask = $scope.task.id; | |
625 | + | |
626 | + $scope.atualizarAtribuicaoProcesso($scope.idProcesso); | |
627 | + | |
628 | + if ( $scope.$parent != undefined ) { | |
629 | + $scope.$parent.idProcesso = $scope.idProcesso; | |
630 | + } | |
631 | + | |
632 | + if ( angular.element( '#viewGerenciarProcesso' ).scope() != undefined ) { | |
633 | + var workspace = angular.element( '#viewGerenciarProcesso' ).scope().workspace; | |
634 | + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id ); | |
635 | + } | |
636 | + | |
637 | + $scope.tratimitado(); | |
638 | + | |
639 | + $scope.setLoading( false ); | |
640 | + | |
638 | 641 | } ); |
639 | 642 | |
640 | 643 | }, 400 ); |
... | ... | @@ -709,6 +712,59 @@ citApp.controller('GerenciarProcessoController', [ '$scope', '$translate', '$tim |
709 | 712 | } |
710 | 713 | |
711 | 714 | }); |
715 | + }; | |
716 | + | |
717 | + $scope.abrirAssinarDocumento = function(documento) { | |
718 | + $scope.fecharPagina(); | |
719 | + $scope.pessoa = {}; | |
720 | + PessoaRepository.getPermissaoAssinaturaDocumento().then(function(result){ | |
721 | + $scope.exibirAssinarDocAnexo = result.originalElement.exibirAssinarDocAnexo; | |
722 | + $scope.pessoa = result.originalElement; | |
723 | + if(!$scope.exibirAssinarDocAnexo) { | |
724 | + $scope.showAlert("error", $translate.instant('ECM.MSG.ERRO_PERMISSAO_ASSINAR')); | |
725 | + return; | |
726 | + } | |
727 | + _montarParceiros(); | |
728 | + $timeout( function () { | |
729 | + angular.element( "#documentoAssinatura" ).scope().abrirAssinarDocumento(documento); | |
730 | + } ); | |
731 | + }); | |
732 | + }; | |
733 | + | |
734 | + function _montarParceiros() { | |
735 | + delete $scope.isFuncaoServidor; | |
736 | + $scope.funcoes =[]; | |
737 | + $scope.pessoa.parceiros.forEach(function(parceiro){ | |
738 | + if(parceiro.dataInativo === null && parceiro.classeParceiro.dominioTipoParceiro.codigo == 1){ | |
739 | + $scope.funcoes.push(_getFuncao(parceiro, true)); | |
740 | + } else if(parceiro.dataInativo === null && parceiro.classeParceiro.dominioTipoParceiro.codigo == 6){ | |
741 | + $scope.funcoes.push(_getFuncao(parceiro, false)); | |
742 | + } | |
743 | + }); | |
744 | + | |
745 | + if($scope.funcoes.length === 1) { | |
746 | + $scope.funcoes.forEach(function(funcao){ | |
747 | + funcao.isServidor = true; | |
748 | + }); | |
749 | + } | |
712 | 750 | } |
713 | - | |
751 | + | |
752 | + function _getFuncao(parceiro, isServidor) { | |
753 | + var funcao = {id : parceiro.funcao.id, nome : '', isServidor : isServidor}; | |
754 | + if(parceiro.cargo) | |
755 | + funcao.nome = funcao.nome.concat(parceiro.cargo).concat(' / ').concat(parceiro.funcao.nome); | |
756 | + else | |
757 | + funcao.nome = funcao.nome.concat(parceiro.funcao.nome); | |
758 | + return funcao; | |
759 | + }; | |
760 | + | |
761 | + $scope.visualizarAssinaturasDocumento = function(documento){ | |
762 | + $scope.fecharPagina(); | |
763 | + $scope.exibirAssinarDocAnexo = true; | |
764 | + $timeout( function () { | |
765 | + angular.element( "#documentoAssinatura" ).scope().visualizarAssinaturasDocumento(documento); | |
766 | + } ); | |
767 | + }; | |
768 | + | |
769 | + | |
714 | 770 | }] ); | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/GerenciarProcessoListUnidadeController.js
... | ... | @@ -29,8 +29,8 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow |
29 | 29 | $scope.filterCriteria = { |
30 | 30 | nome : 'GRID_PROCESSO_NA_UNIDADE', |
31 | 31 | start : 1, |
32 | - dir : 'asc', | |
33 | - sort : 'processo.nup', | |
32 | + dir : 'desc', | |
33 | + sort : 'processo.dataCriacao', | |
34 | 34 | limit : 10, |
35 | 35 | fields: ['id', 'processo.nup', 'processo.tipoProcesso.descricao', 'processo.assuntoComplementar','usuarioResponsavel.username', 'processo.status.descricao', 'processo.nivelAcesso.nivelAcesso.descricao', 'processo.dataCriacao', 'processo.idProcessInstance', 'processo.dataReferencia', 'processo.assunto'], |
36 | 36 | filters : [ |
... | ... | @@ -134,7 +134,9 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow |
134 | 134 | assignment.workItem = $scope.workItem; |
135 | 135 | assignment.checked = false; |
136 | 136 | }); |
137 | - $scope.assignments[0].checked = true; | |
137 | + if($scope.assignments.length > 0){ | |
138 | + $scope.assignments[0].checked = true; | |
139 | + } | |
138 | 140 | }; |
139 | 141 | |
140 | 142 | $scope.selectAssignment = function(assignmentSelect) { | ... | ... |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/repository/AssinaturaRepository.js
0 → 100644
... | ... | @@ -0,0 +1,20 @@ |
1 | +'use strict'; | |
2 | + | |
3 | +citApp.factory('AssinaturaRepository', ['RestangularEcm', 'AbstractRepository', function (restangularEcm, AbstractRepository) { | |
4 | + | |
5 | + function AssinaturaRepository() { | |
6 | + AbstractRepository.call(this, restangularEcm, 'rest/assinatura'); | |
7 | + | |
8 | + this.saveAssinaturaInterna = function(assinatura) { | |
9 | + return this.restangular.all(this.route + '/saveAssinaturaInterna').post(assinatura); | |
10 | + }; | |
11 | + | |
12 | + this.validarAssinaturaPorUsuario = function(idDocumento) { | |
13 | + return this.restangular.one(this.route + '/validarAssinaturaPorUsuario').get({idDocumento:idDocumento}); | |
14 | + }; | |
15 | + } | |
16 | + | |
17 | + AbstractRepository.extend(AssinaturaRepository); | |
18 | + | |
19 | + return new AssinaturaRepository(); | |
20 | +}]); | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaEdit.html
0 → 100644
... | ... | @@ -0,0 +1,40 @@ |
1 | +<div class="row"> | |
2 | + <div class="col-sm-12"> | |
3 | + <label-input ng-type="text" ng-id="assinante" ng-label="ECM.LABEL.ASSINANTE" ng-disabled="true" ng-model="pessoa.nome" /> | |
4 | + </div> | |
5 | +</div> | |
6 | +<div class="row"> | |
7 | + <div class="col-sm-12"> | |
8 | + <strong><label><translate>ECM.LABEL.CARGO_FUNCAO</translate></label></strong> | |
9 | + </div> | |
10 | +</div> | |
11 | +<div class="row"> | |
12 | + <div class="col-sm-12"> | |
13 | + <div class="form-group" style="padding: 4px;"> | |
14 | + <label data-ng-repeat="funcao in funcoes"> | |
15 | + <input type="radio" name="response" data-ng-model="funcao.isServidor" data-ng-value="true" class="radio-group-inline" style="margin-left: 20px;"/> | |
16 | + {{funcao.nome}} | |
17 | + </label> | |
18 | + </div> | |
19 | + </div> | |
20 | +</div> | |
21 | + | |
22 | +<div class="row"> | |
23 | + <div class="col-sm-1" style="margin-top: 5px; !important"> | |
24 | + <label> | |
25 | + <translate>PORTAL.LABEL.SENHA</translate> | |
26 | + </label> | |
27 | + </div> | |
28 | + <div class="col-sm-4" > | |
29 | + <label-input ng-type="password" ng-id="autenticacao" ng-disabled="false" ng-model="$parent.autenticacao" /> | |
30 | + </div> | |
31 | +<!-- <div class="col-sm-4" style="margin-top: 5px; !important"> --> | |
32 | +<!-- <label> --> | |
33 | +<!-- <translate>ECM.LABEL.OU</translate> --> | |
34 | +<!-- </label> --> | |
35 | +<!-- <label style="margin-left: 5px; font-weight: bold"> --> | |
36 | +<!-- <translate>ECM.LABEL.CERTIFICADO_DIGITAL</translate> --> | |
37 | +<!-- <i class="glyphicon glyphicon-info-sign blue" tooltip="{{$translate.instant('ECM.LABEL.CERTIFICADO_DIGITAL')}}" style="margin-left: 5px;"></i> --> | |
38 | +<!-- </label> --> | |
39 | +<!-- </div> --> | |
40 | +</div> | |
0 | 41 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaView.html
0 → 100644
... | ... | @@ -0,0 +1,43 @@ |
1 | +<div id="documentoAssinatura" class="widget-box margin-bottom" ng-controller="AssinarDocumentoController as assinarDocumentoController"> | |
2 | + <div class="widget-header"> | |
3 | + <h2 class="widget-title"> | |
4 | + <div ng-if="exibirIncluirAssinatura"> | |
5 | + <translate>ECM.LABEL.ASSINATURA_DO_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | |
6 | + <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} | |
7 | + </div> | |
8 | + <div ng-if="!exibirIncluirAssinatura"> | |
9 | + <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | |
10 | + <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} | |
11 | + </div> | |
12 | + </h2> | |
13 | + <div class="widget-toolbar"> | |
14 | + <a href="#void" ng-click="widgetAssinarDocIsCollapsed = !widgetAssinarDocIsCollapsed"> | |
15 | + <i class="fa" ng-class="{'fa-chevron-up': !widgetAssinarDocIsCollapsed, 'fa-chevron-down': widgetAssinarDocIsCollapsed}"></i> | |
16 | + </a> | |
17 | + <a href="#void" ng-click="$parent.closeWidget('documentoAssinatura');"> <i class="fa fa-close"></i></a> | |
18 | + </div> | |
19 | + </div> | |
20 | + | |
21 | + <div class="widget-body" collapse="widgetAssinarDocIsCollapsed"> | |
22 | + <div class="widget-main clearfix"> | |
23 | + <div class="page-content clearfix"> | |
24 | + <div ng-if="exibirDocJaAssinado" class="alert alert-success" role="alert"> | |
25 | + <span class="small"><translate>ECM.MSG.DOCUMENTO_JA_ASSINADO</translate></span> | |
26 | + </div> | |
27 | + | |
28 | + <div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturaEdit.html'" ng-show="exibirIncluirAssinatura"/> | |
29 | + | |
30 | + <div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturas.html'" /> | |
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 | + </div> | |
41 | + </div> | |
42 | + </div> | |
43 | +</div> | |
0 | 44 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturas.html
0 → 100644
... | ... | @@ -0,0 +1,45 @@ |
1 | +<div class="row" ng-if="documentosSelecionados.length > 0"> | |
2 | + <div class="col-sm-12"> | |
3 | + <table class="table table-striped table-bordered table-hover"> | |
4 | + <thead> | |
5 | + <tr> | |
6 | + <th><small><translate>LABEL.VERSAO</translate></small></th> | |
7 | + <th><small><translate>LABEL.USUARIO</translate></small></th> | |
8 | + <th><small><translate>CORPORATIVO.LABEL.FUNCAO</translate></small></th> | |
9 | + <th><small><translate>LABEL.UNIDADE</translate></small></th> | |
10 | + <th><small><translate>ECM.LABEL.TIPO_ASSINATURA</translate></small></th> | |
11 | + <th><small><translate>ECM.LABEL.DATA_DA_ASSINATURA</translate></small></th> | |
12 | + </tr> | |
13 | + </thead> | |
14 | + <tbody ng-repeat="docSelecionado in documentosSelecionados"> | |
15 | + <tr ng-repeat="assinatura in docSelecionado.assinaturas"> | |
16 | + <td> | |
17 | + <small>{{docSelecionado.versaoDocumento}}</small> | |
18 | + </td> | |
19 | + <td> | |
20 | + <small>{{assinatura.usuario.username}}</small> | |
21 | + </td> | |
22 | + <td> | |
23 | + <small>{{assinatura.funcao.nome}}</small> | |
24 | + </td> | |
25 | + <td> | |
26 | + <small>{{docSelecionado.unidadeNome}}</small> | |
27 | + </td> | |
28 | + <td> | |
29 | + <small>{{assinatura.tipoAssinatura.descricao}}</small> | |
30 | + </td> | |
31 | + <td> | |
32 | + <small>{{assinatura.dataCriacao | date : 'dd/MM/yyyy HH:mm:ss'}}</small> | |
33 | + </td> | |
34 | + </tr> | |
35 | + </tbody> | |
36 | + <tfoot> | |
37 | + <tr ng-hide="nenhumaAssinatura"> | |
38 | + <td colspan="6"> | |
39 | + <strong><translate>ECM.LABEL.DOCUMENTO_SEM_ASSINATURA</translate></strong> | |
40 | + </td> | |
41 | + </tr> | |
42 | + </tfoot> | |
43 | + </table> | |
44 | + </div> | |
45 | +</div> | |
0 | 46 | \ No newline at end of file | ... | ... |
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeAcaoProcesso.html
... | ... | @@ -23,7 +23,8 @@ |
23 | 23 | |
24 | 24 | <div ng-include src="'/cit-ecm-web/html/atribuirProcesso/atribuir.html'" ng-show="isAtribuirProcesso" /> |
25 | 25 | |
26 | - | |
26 | +<!-- Assinatura documento --> | |
27 | +<div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturaView.html'" ng-show="exibirAssinarDocAnexo" /> | |
27 | 28 | |
28 | 29 | <div id="widget-processo" ng-show="isProcessoEdit" class="widget-box margin-bottom"> |
29 | 30 | <div class="widget-header"> | ... | ... |
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeDocumentosProcesso.html
... | ... | @@ -21,12 +21,13 @@ |
21 | 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 | 22 | <span class="label label-warning" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 1">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-success" |
23 | 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="false">Assinado</span> <span class="label label-success" ng-show="false">Habilitado</span> <span class="label label-warning" ng-show="false">Ciência</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 | 25 | class="label label-danger" ng-show="documento.cancelado">Cancelado</span> |
26 | + | |
26 | 27 | </div> |
28 | + | |
27 | 29 | </div> |
28 | 30 | |
29 | - | |
30 | 31 | <div ng-if="!isProcessoView" class="tools btn-group dropdown" role="group" dropdown> |
31 | 32 | <button type="button" class="btn btn-success btn-xs" dropdown-toggle> |
32 | 33 | <translate>LABEL.ACOES</translate> |
... | ... | @@ -39,7 +40,13 @@ |
39 | 40 | <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> |
40 | 41 | <li ng-if='!documento.cancelado'><a href="#void" ng-click="visualizarVersoes(documento);"> <translate>ECM.LABEL.VERSOESDODOCUMENTO</translate></a></li> |
41 | 42 | <li ><a ng-if='documento.cancelado'href="#void" ng-click="getCancelamentoDocumento(documento);"> <translate>ECM.LABEL.JUSTIFICATIVA_CANCELAMENTO</translate></a></li> |
43 | + <li ><a href="#void" ng-click="abrirAssinarDocumento(documento)"> <translate>ECM.LABEL.ASSINARDOCUMENTO</translate></a></li> | |
44 | + <li ><a href="#void" ng-click="visualizarAssinaturasDocumento(documento)"> <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate></a></li> | |
42 | 45 | </ul> |
43 | 46 | |
44 | 47 | </div> |
48 | + | |
49 | + <div class="versoes"> | |
50 | + <span><translate>ECM.LABEL.VERSAO_ATUAL</translate>: {{documento.versaoDocumento | limitTo:3}}</span> | |
51 | + </div> | |
45 | 52 | </div> |
46 | 53 | \ No newline at end of file | ... | ... |