Commit 259f370291740fe2d9865634c72603ec123de6e8
1 parent
d11706e4
Exists in
master
Atendimento #4999
Showing
3 changed files
with
12 additions
and
10 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/AtendimentoRequisicaoConsumoItem.java
@@ -184,7 +184,7 @@ public class AtendimentoRequisicaoConsumoItem extends PersistentObjectAuditOrgan | @@ -184,7 +184,7 @@ public class AtendimentoRequisicaoConsumoItem extends PersistentObjectAuditOrgan | ||
184 | 184 | ||
185 | if(atendimentoRequisicaoConsumoItemEnderecos != null){ | 185 | if(atendimentoRequisicaoConsumoItemEnderecos != null){ |
186 | for(AtendimentoRequisicaoConsumoItemEndereco itemEndereco : atendimentoRequisicaoConsumoItemEnderecos){ | 186 | for(AtendimentoRequisicaoConsumoItemEndereco itemEndereco : atendimentoRequisicaoConsumoItemEnderecos){ |
187 | - quantidade = quantidade.add(itemEndereco.getQuantidade()); | 187 | + quantidade = quantidade.add(itemEndereco.getQuantidade() != null ? itemEndereco.getQuantidade() : BigDecimal.ZERO); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MovimentoEstoqueServiceImpl.java
@@ -2,6 +2,7 @@ package br.com.centralit.api.service.impl; | @@ -2,6 +2,7 @@ package br.com.centralit.api.service.impl; | ||
2 | 2 | ||
3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
4 | import java.math.RoundingMode; | 4 | import java.math.RoundingMode; |
5 | +import java.sql.Timestamp; | ||
5 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
6 | import java.util.Calendar; | 7 | import java.util.Calendar; |
7 | import java.util.Collection; | 8 | import java.util.Collection; |
@@ -55,6 +56,7 @@ import br.com.centralit.framework.model.Usuario; | @@ -55,6 +56,7 @@ import br.com.centralit.framework.model.Usuario; | ||
55 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; | 56 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; |
56 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | 57 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
57 | import br.com.centralit.framework.util.UtilColecao; | 58 | import br.com.centralit.framework.util.UtilColecao; |
59 | +import br.com.centralit.framework.util.UtilDate; | ||
58 | import br.com.centralit.framework.util.UtilObjeto; | 60 | import br.com.centralit.framework.util.UtilObjeto; |
59 | 61 | ||
60 | /** | 62 | /** |
@@ -513,15 +515,15 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | @@ -513,15 +515,15 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | ||
513 | 515 | ||
514 | Map<String, List<BigDecimal>> mapaDeMesesPorQuantidade = new HashMap<String, List<BigDecimal>>(); | 516 | Map<String, List<BigDecimal>> mapaDeMesesPorQuantidade = new HashMap<String, List<BigDecimal>>(); |
515 | 517 | ||
516 | - for (ArrayList<Object> listaPropriedades : valoresAtendidos) { | ||
517 | - | 518 | + for (Object list : valoresAtendidos) { |
519 | + Object[] listaPropriedades = (Object[]) list; | ||
518 | if (mensal) { | 520 | if (mensal) { |
519 | 521 | ||
520 | this.divideValoresPorMesEAno(listaPropriedades, mapaDeMesesPorQuantidade); | 522 | this.divideValoresPorMesEAno(listaPropriedades, mapaDeMesesPorQuantidade); |
521 | 523 | ||
522 | } else { | 524 | } else { |
523 | 525 | ||
524 | - result = result.add((BigDecimal) listaPropriedades.get(ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_QUANTIDADE)); | 526 | + result = result.add(listaPropriedades[ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_QUANTIDADE] != null ? (BigDecimal) listaPropriedades[ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_QUANTIDADE] : BigDecimal.ZERO); |
525 | 527 | ||
526 | } | 528 | } |
527 | } | 529 | } |
@@ -556,7 +558,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | @@ -556,7 +558,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | ||
556 | 558 | ||
557 | for(BigDecimal valor : mapaDeMesesPorQuantidade.get(chave)){ | 559 | for(BigDecimal valor : mapaDeMesesPorQuantidade.get(chave)){ |
558 | 560 | ||
559 | - valorSomadoMensal = valorSomadoMensal.add(valor); | 561 | + valorSomadoMensal = valorSomadoMensal.add(valor != null ? valor : BigDecimal.ZERO); |
560 | 562 | ||
561 | } | 563 | } |
562 | 564 | ||
@@ -578,9 +580,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | @@ -578,9 +580,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | ||
578 | * @param mapaDeMesesPorQuantidade2 | 580 | * @param mapaDeMesesPorQuantidade2 |
579 | * @return | 581 | * @return |
580 | */ | 582 | */ |
581 | - private void divideValoresPorMesEAno(ArrayList<Object> listaPropriedades, Map<String, List<BigDecimal>> mapaDeMesesPorQuantidade) { | ||
582 | - | ||
583 | - Calendar data = (Calendar) listaPropriedades.get(ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_ATENDIMENTO_REQUISICAO_CONSUMO_DATA_ATENDIMENTO); | 583 | + private void divideValoresPorMesEAno(Object[] listaPropriedades, Map<String, List<BigDecimal>> mapaDeMesesPorQuantidade) { |
584 | + | ||
585 | + Calendar data = UtilDate.getCalendarDoTimestamp((Timestamp) listaPropriedades[ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_ATENDIMENTO_REQUISICAO_CONSUMO_DATA_ATENDIMENTO]); | ||
584 | 586 | ||
585 | Integer mes = data.get(Calendar.MONTH); | 587 | Integer mes = data.get(Calendar.MONTH); |
586 | 588 | ||
@@ -593,7 +595,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | @@ -593,7 +595,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst | ||
593 | mapaDeMesesPorQuantidade.put(chave, new ArrayList<BigDecimal>()); | 595 | mapaDeMesesPorQuantidade.put(chave, new ArrayList<BigDecimal>()); |
594 | } | 596 | } |
595 | 597 | ||
596 | - BigDecimal valor = (BigDecimal) listaPropriedades.get(ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_QUANTIDADE); | 598 | + BigDecimal valor = (BigDecimal) listaPropriedades[ATENDIMENTO_REQUISICAO_CONSUMO_ITEM_QUANTIDADE]; |
597 | 599 | ||
598 | mapaDeMesesPorQuantidade.get(chave).add(valor); | 600 | mapaDeMesesPorQuantidade.get(chave).add(valor); |
599 | 601 |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/validation/RequisicaoConsumoItemValidator.java
@@ -22,7 +22,7 @@ public class RequisicaoConsumoItemValidator implements Validator { | @@ -22,7 +22,7 @@ public class RequisicaoConsumoItemValidator implements Validator { | ||
22 | 22 | ||
23 | ValidationUtils.rejectIfEmpty(errors, "requisicaoConsumo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.REQUISICAOCONSUMO"); | 23 | ValidationUtils.rejectIfEmpty(errors, "requisicaoConsumo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.REQUISICAOCONSUMO"); |
24 | 24 | ||
25 | - ValidationUtils.rejectIfEmpty(errors, "material", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.MATERIAL"); | 25 | + ValidationUtils.rejectIfEmpty(errors, "materialConsumo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.MATERIAL"); |
26 | 26 | ||
27 | ValidationUtils.rejectIfEmpty(errors, "quantidade", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.QUANTIDADE"); | 27 | ValidationUtils.rejectIfEmpty(errors, "quantidade", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.QUANTIDADE"); |
28 | 28 |