Commit 7763bc22b6efd6d80a32f498cfe09de263786c95
1 parent
e6bddec7
Exists in
master
[Redmine Atendimento #4166]Mensagem período
Showing
2 changed files
with
17 additions
and
7 deletions
Show diff stats
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/ContratoEventoServiceImpl.java
... | ... | @@ -188,16 +188,10 @@ public class ContratoEventoServiceImpl extends GenericServiceImpl<ContratoEvento |
188 | 188 | ByteArrayOutputStream baos = null; |
189 | 189 | InputStream inputSub = null; |
190 | 190 | InputStream input = null; |
191 | - String periodo = ""; | |
192 | 191 | List<Long> idsContratos = getListaIdsContrato(tiposTermo, idContrato, dataInicial, dateFinal); |
193 | 192 | if(idsContratos.isEmpty()){ |
194 | 193 | lancarBusinessException("CONTRATOS.LABEL.SEM_TERMOS_A_SER_GERADO", CodigoErro.REGRA_NEGOCIO.getValue(), true); |
195 | 194 | } |
196 | - if(dataInicial != null && dateFinal != null){ | |
197 | - periodo = UtilDate.formatarData(dataInicial) + " - " + UtilDate.formatarData(dateFinal); | |
198 | - }else{ | |
199 | - periodo = this.internacionalizacaoService.getTranslate("CONTRATOS.LABEL.PERIODO_NAO_INFORMADO", getIdioma()); | |
200 | - } | |
201 | 195 | |
202 | 196 | if(dateFinal != null){ |
203 | 197 | dateFinal.setHours(23); |
... | ... | @@ -222,7 +216,7 @@ public class ContratoEventoServiceImpl extends GenericServiceImpl<ContratoEvento |
222 | 216 | Contrato contrato = contratoService.find(id); |
223 | 217 | |
224 | 218 | Map<String, Object> subReportParameters = new HashMap<String, Object>(); |
225 | - subReportParameters.put("periodo", periodo); | |
219 | + subReportParameters.put("periodo", getPeriodoInformado(dataInicial, dateFinal)); | |
226 | 220 | subReportParameters.put("TIPO_TERMO", Arrays.asList(tiposTermo)); |
227 | 221 | subReportParameters.put("ID_CONTRATO", id); |
228 | 222 | subReportParameters.put("dataInicial", dataInicial); |
... | ... | @@ -266,6 +260,20 @@ public class ContratoEventoServiceImpl extends GenericServiceImpl<ContratoEvento |
266 | 260 | |
267 | 261 | } |
268 | 262 | |
263 | + private String getPeriodoInformado(Date dataInicial, Date dateFinal) { | |
264 | + String periodo; | |
265 | + if(dataInicial != null && dateFinal == null){ | |
266 | + periodo = UtilDate.formatarData(dataInicial) + " - " + this.internacionalizacaoService.getTranslate("CONTRATOS.LABEL.DATA_FINAL_NAO_INFORMADA", getIdioma()); | |
267 | + }else if(dataInicial == null && dateFinal != null){ | |
268 | + periodo = this.internacionalizacaoService.getTranslate("CONTRATOS.LABEL.DATA_INICIAL_NAO_INFORMADA", getIdioma()) + " - " + UtilDate.formatarData(dateFinal) ; | |
269 | + }else if(dataInicial != null && dateFinal != null){ | |
270 | + periodo = UtilDate.formatarData(dataInicial) + " - " + UtilDate.formatarData(dateFinal); | |
271 | + }else{ | |
272 | + periodo = this.internacionalizacaoService.getTranslate("CONTRATOS.LABEL.PERIODO_NAO_INFORMADO", getIdioma()); | |
273 | + } | |
274 | + return periodo; | |
275 | + } | |
276 | + | |
269 | 277 | private List<Long> getListaIdsContrato(Long[] tiposTermo, Long idContrato, Date dataInicial, Date dateFinal) { |
270 | 278 | List<Long> idsContratos = new ArrayList<Long>(); |
271 | 279 | if(idContrato != null){ | ... | ... |
cit-contratos-web/src/main/java/br/com/centralit/listener/StartupListenerContratos.java
... | ... | @@ -968,6 +968,8 @@ public class StartupListenerContratos extends UtilStartup implements Application |
968 | 968 | internacionalizacaoList.add(new Internacionalizacao("CONTRATOS.LABEL.TITULO_CONSULTA_TERMOS", "Consulta de termos", dominio, modulo)); |
969 | 969 | internacionalizacaoList.add(new Internacionalizacao("CONTRATOS.LABEL.PERIODO_NAO_INFORMADO", "Período não informado", dominio, modulo)); |
970 | 970 | internacionalizacaoList.add(new Internacionalizacao("CONTRATOS.LABEL.SEM_TERMOS_A_SER_GERADO", "Não há termos para ser gerado nos filtros selecionados.", dominio, modulo)); |
971 | + internacionalizacaoList.add(new Internacionalizacao("CONTRATOS.LABEL.DATA_INICIAL_NAO_INFORMADA", "Data inicial não informada", dominio, modulo)); | |
972 | + internacionalizacaoList.add(new Internacionalizacao("CONTRATOS.LABEL.DATA_FINAL_NAO_INFORMADA", "Data final não informada", dominio, modulo)); | |
971 | 973 | |
972 | 974 | } |
973 | 975 | ... | ... |