Rev 586 | Rev 588 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 586 | Rev 587 | ||
|---|---|---|---|
| Line 18... | Line 18... | ||
| 18 | import br.com.ec.domain.dto.consulta.ParametrosConsultaModelosMaisVendidosDTO; |
18 | import br.com.ec.domain.dto.consulta.ParametrosConsultaModelosMaisVendidosDTO; |
| 19 | import br.com.ec.domain.dto.consulta.ParametrosConsultaProdutosVendidosDTO; |
19 | import br.com.ec.domain.dto.consulta.ParametrosConsultaProdutosVendidosDTO; |
| 20 | import br.com.ec.domain.model.SubtipoProduto; |
20 | import br.com.ec.domain.model.SubtipoProduto; |
| 21 | import br.com.ec.domain.model.tipos.TipoOrdenacaoMaisVendidos; |
21 | import br.com.ec.domain.model.tipos.TipoOrdenacaoMaisVendidos; |
| 22 | import br.com.ec.domain.model.tipos.TipoProduto; |
22 | import br.com.ec.domain.model.tipos.TipoProduto; |
| - | 23 | import br.com.ec.domain.model.tipos.TipoStatusPedidoCompra; |
|
| 23 | import br.com.ec.domain.service.AlertasService; |
24 | import br.com.ec.domain.service.AlertasService; |
| 24 | import br.com.ec.domain.service.LojaService; |
25 | import br.com.ec.domain.service.LojaService; |
| 25 | import br.com.ec.domain.service.ModeloService; |
26 | import br.com.ec.domain.service.ModeloService; |
| 26 | import br.com.ec.domain.service.SubtipoProdutoService; |
27 | import br.com.ec.domain.service.SubtipoProdutoService; |
| 27 | import br.com.ec.domain.service.VendaService; |
28 | import br.com.ec.domain.service.VendaService; |
| Line 49... | Line 50... | ||
| 49 | return null; |
50 | return null; |
| 50 | }
|
51 | }
|
| 51 | 52 | ||
| 52 | @Override |
53 | @Override |
| 53 | public AlertasGeralDTO consultarAlertasComprasGeral(AlertasGeralDTO alertasGeralDTO) { |
54 | public AlertasGeralDTO consultarAlertasComprasGeral(AlertasGeralDTO alertasGeralDTO) { |
| - | 55 | // ADICIONAR PRODUTOS ESSENCIAIS DOS 30 MODELOS MAIS VENDIDOS
|
|
| - | 56 | // TIPO: CAPA, ESTILO: TPU, COR: TRANSPARENTE
|
|
| - | 57 | // TIPO: PELÍCULA, SUBTIPO: VIDRO
|
|
| - | 58 | // TIPO: PELÍCULA, SUBTIPO: SOFT NORMAL
|
|
| - | 59 | ||
| 54 | // CONSULTAR TODOS OS PRODUTOS VENDIDOS NOS ULTIMOS 90 DIAS
|
60 | // CONSULTAR TODOS OS PRODUTOS VENDIDOS NOS ULTIMOS 90 DIAS
|
| - | 61 | List<RankingProdutoDTO> rankingProdutosDTOGeral = new ArrayList<RankingProdutoDTO>(); |
|
| 55 | List<RankingProdutoDTO> rankingProdutosDTO = new ArrayList<RankingProdutoDTO>(); |
62 | List<RankingProdutoDTO> rankingProdutosDTO = new ArrayList<RankingProdutoDTO>(); |
| 56 | 63 | ||
| 57 | ParametrosConsultaProdutosVendidosDTO parametrosConsulta = new ParametrosConsultaProdutosVendidosDTO(); |
64 | ParametrosConsultaProdutosVendidosDTO parametrosConsulta = new ParametrosConsultaProdutosVendidosDTO(); |
| 58 | parametrosConsulta.setDataFinal(DataUtils.getDataAtual()); |
65 | parametrosConsulta.setDataFinal(DataUtils.getDataAtual()); |
| 59 | parametrosConsulta.setDataInicial(DataUtils.acrescentarDias(DataUtils.getDataAtual(), alertasGeralDTO.getQuantidadeDiasVendas()*-1)); |
66 | parametrosConsulta.setDataInicial(DataUtils.acrescentarDias(DataUtils.getDataAtual(), alertasGeralDTO.getQuantidadeDiasVendas()*-1)); |
| 60 | parametrosConsulta.setTipoOrdenacao(TipoOrdenacaoMaisVendidos.QUANTIDADE.getValor()); |
67 | parametrosConsulta.setTipoOrdenacao(TipoOrdenacaoMaisVendidos.QUANTIDADE.getValor()); |
| 61 | 68 | ||
| 62 | for (TipoProduto tipoProdutoSelecionado : alertasGeralDTO.getTiposProdutoSelecionados()) { |
69 | for (TipoProduto tipoProdutoSelecionado : alertasGeralDTO.getTiposProdutoSelecionados()) { |
| 63 | parametrosConsulta.setTipoProduto(tipoProdutoSelecionado.getValor()); |
70 | parametrosConsulta.setTipoProduto(tipoProdutoSelecionado.getValor()); |
| 64 | rankingProdutosDTO.addAll(vendaService.consultarProdutosVendidos(parametrosConsulta)); |
- | |
| - | 71 | rankingProdutosDTOGeral.addAll(vendaService.consultarProdutosVendidos(parametrosConsulta)); |
|
| 65 | }
|
72 | }
|
| 66 | 73 | ||
| 67 | // RETIRAR SUBTIPOS DAS PELÍCULAS (PARA ANÁLISE INDIVIDUAL)
|
- | |
| 68 | /*
|
- | |
| 69 | for (RankingProdutoDTO rankingProdutoDTO : rankingProdutosDTO) {
|
- | |
| 70 | if (rankingProdutoDTO.getProduto().getTipo().equals(TipoProduto.PELICULA.getValor())) {
|
- | |
| 71 | rankingProdutoDTO.getProduto().setSubtipoProduto(null);
|
- | |
| - | 74 | // RETIRAR PRODUTOS PARA NÃO COMPRAR
|
|
| - | 75 | for (RankingProdutoDTO rankingProdutoDTO : rankingProdutosDTOGeral) { |
|
| - | 76 | if (VerificadorUtil.naoEstaNulo(rankingProdutoDTO.getStatusPedidoCompra())) { |
|
| - | 77 | if (!rankingProdutoDTO.getStatusPedidoCompra().equals(TipoStatusPedidoCompra.NAO_COMPRAR.getValor())) { |
|
| - | 78 | rankingProdutosDTO.add(rankingProdutoDTO); |
|
| - | 79 | }
|
|
| 72 | }
|
80 | }
|
| 73 | }*/
|
- | |
| - | 81 | }
|
|
| 74 | 82 | ||
| 75 | // CONSULTAR SUBTIPOS
|
83 | // CONSULTAR SUBTIPOS
|
| 76 | // VERIFICAR ITENS POR TIPO, SEM SUBTIPO
|
84 | // VERIFICAR ITENS POR TIPO, SEM SUBTIPO
|
| 77 | for (TipoProduto tipoProdutoSelecionado : alertasGeralDTO.getTiposProdutoSelecionados()) { |
85 | for (TipoProduto tipoProdutoSelecionado : alertasGeralDTO.getTiposProdutoSelecionados()) { |
| 78 | Integer quantidadeAlertasPossiveisSemSubtipo = 0; |
86 | Integer quantidadeAlertasPossiveisSemSubtipo = 0; |
| Line 87... | Line 95... | ||
| 87 | if (VerificadorUtil.estaNulo(rankingProdutoDTO.getProduto().getSubtipoProduto())) { |
95 | if (VerificadorUtil.estaNulo(rankingProdutoDTO.getProduto().getSubtipoProduto())) { |
| 88 | quantidadeAlertasPossiveisSemSubtipo++;
|
96 | quantidadeAlertasPossiveisSemSubtipo++;
|
| 89 | // ALERTA PARA CADA PRODUTO COM MENOS DE DIAS PRE-DEFINIDO
|
97 | // ALERTA PARA CADA PRODUTO COM MENOS DE DIAS PRE-DEFINIDO
|
| 90 | if (rankingProdutoDTO.getTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta()) { |
98 | if (rankingProdutoDTO.getTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta()) { |
| 91 | alertasComprasGeralDTO.getAlertasProdutosSemSubtipo().add(rankingProdutoDTO); |
99 | alertasComprasGeralDTO.getAlertasProdutosSemSubtipo().add(rankingProdutoDTO); |
| - | 100 | }
|
|
| - | 101 | if (rankingProdutoDTO.getTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta()/2) { |
|
| - | 102 | alertasComprasGeralDTO.adicionarQuantidadeAlertasCriticos(); |
|
| 92 | }
|
103 | }
|
| 93 | } else { |
104 | } else { |
| 94 | if (tipoProdutoSelecionado.getValor().equals(TipoProduto.PELICULA.getValor())) { |
105 | if (tipoProdutoSelecionado.getValor().equals(TipoProduto.PELICULA.getValor())) { |
| 95 | quantidadeAlertasPossiveisSemSubtipo++;
|
106 | quantidadeAlertasPossiveisSemSubtipo++;
|
| 96 | }
|
107 | }
|
| Line 116... | Line 127... | ||
| 116 | }
|
127 | }
|
| 117 | if (!alertasComprasGeralSubTipoDTO.getRankingProdutosDTO().isEmpty() && |
128 | if (!alertasComprasGeralSubTipoDTO.getRankingProdutosDTO().isEmpty() && |
| 118 | (tipoProdutoSelecionado.getValor().equals(TipoProduto.PELICULA.getValor()) || |
129 | (tipoProdutoSelecionado.getValor().equals(TipoProduto.PELICULA.getValor()) || |
| 119 | alertasComprasGeralSubTipoDTO.getQuantidadeTotalTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta())) { |
130 | alertasComprasGeralSubTipoDTO.getQuantidadeTotalTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta())) { |
| 120 | alertasComprasGeralDTO.getAlertasComprasGeralSubTipoDTO().add(alertasComprasGeralSubTipoDTO); |
131 | alertasComprasGeralDTO.getAlertasComprasGeralSubTipoDTO().add(alertasComprasGeralSubTipoDTO); |
| - | 132 | if (alertasComprasGeralSubTipoDTO.getQuantidadeTotalTempoEstoque() <= alertasGeralDTO.getTempoDeEstoqueParaAlerta()/2) { |
|
| - | 133 | alertasComprasGeralDTO.adicionarQuantidadeAlertasCriticos(); |
|
| - | 134 | }
|
|
| 121 | }
|
135 | }
|
| 122 | }
|
136 | }
|
| 123 | alertasComprasGeralDTO.setQuantidadeAlertasPossiveis(quantidadeAlertasPossiveisSemSubtipo); |
137 | alertasComprasGeralDTO.setQuantidadeAlertasPossiveis(quantidadeAlertasPossiveisSemSubtipo); |
| 124 | alertasComprasGeralDTO.setQuantidadeAlertasPossiveisComSubtipo(quantidadeAlertasPossiveisComSubtipo); |
138 | alertasComprasGeralDTO.setQuantidadeAlertasPossiveisComSubtipo(quantidadeAlertasPossiveisComSubtipo); |
| 125 | alertasGeralDTO.getAlertasComprasGeralDTO().add(alertasComprasGeralDTO); |
139 | alertasGeralDTO.getAlertasComprasGeralDTO().add(alertasComprasGeralDTO); |