Rev 568 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 568 | Rev 588 | ||
|---|---|---|---|
| Line 10... | Line 10... | ||
| 10 | 10 | ||
| 11 | import org.springframework.context.annotation.Scope; |
11 | import org.springframework.context.annotation.Scope; |
| 12 | 12 | ||
| 13 | import br.com.ec.core.generic.GenericService; |
13 | import br.com.ec.core.generic.GenericService; |
| 14 | import br.com.ec.core.util.DataUtils; |
14 | import br.com.ec.core.util.DataUtils; |
| - | 15 | import br.com.ec.domain.dto.AlertasGeralDTO; |
|
| 15 | import br.com.ec.domain.dto.AlertasLogisticaComprasDTO; |
16 | import br.com.ec.domain.dto.AlertasLogisticaComprasDTO; |
| 16 | import br.com.ec.domain.dto.RankingComprasTransferenciasDTO; |
17 | import br.com.ec.domain.dto.RankingComprasTransferenciasDTO; |
| 17 | import br.com.ec.domain.dto.RankingModeloDTO; |
18 | import br.com.ec.domain.dto.RankingModeloDTO; |
| 18 | import br.com.ec.domain.dto.consulta.ParametrosConsultaModelosMaisVendidosDTO; |
19 | import br.com.ec.domain.dto.consulta.ParametrosConsultaModelosMaisVendidosDTO; |
| - | 20 | import br.com.ec.domain.service.AlertasService; |
|
| 19 | import br.com.ec.domain.service.VendaService; |
21 | import br.com.ec.domain.service.VendaService; |
| 20 | import br.com.ec.web.generic.AbstractBean; |
22 | import br.com.ec.web.generic.AbstractBean; |
| 21 | 23 | ||
| 22 | @Named |
24 | @Named |
| 23 | @Scope("view") |
25 | @Scope("view") |
| 24 | public class AlertasLogisticaBean extends AbstractBean<AlertasLogisticaComprasDTO> implements Serializable { |
- | |
| - | 26 | public class AlertasLogisticaBean extends AbstractBean<AlertasGeralDTO> implements Serializable { |
|
| 25 | 27 | ||
| 26 | private static final long serialVersionUID = 1L; |
28 | private static final long serialVersionUID = 1L; |
| 27 | 29 | ||
| 28 | private Boolean adicionarModelosFavoritosSemVendas; |
30 | private Boolean adicionarModelosFavoritosSemVendas; |
| 29 | private Integer quantidadeDiasVendas = 0; |
31 | private Integer quantidadeDiasVendas = 0; |
| 30 | private Integer quantidadeDiasParaAlerta = 0; |
32 | private Integer quantidadeDiasParaAlerta = 0; |
| 31 | private VendaService vendaService; |
- | |
| - | 33 | ||
| - | 34 | private AlertasService alertasService; |
|
| 32 | 35 | ||
| 33 | @Inject |
36 | @Inject |
| 34 | public AlertasLogisticaBean(VendaService vendaService) { |
- | |
| 35 | this.vendaService = vendaService; |
- | |
| - | 37 | public AlertasLogisticaBean(AlertasService alertasService) { |
|
| - | 38 | this.alertasService = alertasService; |
|
| 36 | }
|
39 | }
|
| 37 | 40 | ||
| 38 | @Override |
41 | @Override |
| 39 | public GenericService<AlertasLogisticaComprasDTO> getService() { |
- | |
| - | 42 | public GenericService<AlertasGeralDTO> getService() { |
|
| 40 | return null; |
43 | return null; |
| 41 | }
|
44 | }
|
| 42 | 45 | ||
| 43 | @Override |
46 | @Override |
| 44 | public AlertasLogisticaComprasDTO getId() { |
- | |
| - | 47 | public AlertasGeralDTO getId() { |
|
| 45 | return null; |
48 | return null; |
| 46 | }
|
49 | }
|
| 47 | 50 | ||
| 48 | @Override |
51 | @Override |
| 49 | public void limparEntidade() { |
52 | public void limparEntidade() { |
| 50 | setEntidade(new AlertasLogisticaComprasDTO()); |
- | |
| - | 53 | setEntidade(new AlertasGeralDTO()); |
|
| 51 | setQuantidadeDiasVendas(30); |
54 | setQuantidadeDiasVendas(30); |
| 52 | setQuantidadeDiasParaAlerta(10); |
55 | setQuantidadeDiasParaAlerta(10); |
| 53 | setAdicionarModelosFavoritosSemVendas(false); |
56 | setAdicionarModelosFavoritosSemVendas(false); |
| 54 | }
|
57 | }
|
| 55 | 58 | ||
| Line 79... | Line 82... | ||
| 79 | this.quantidadeDiasParaAlerta = quantidadeDiasParaAlerta; |
82 | this.quantidadeDiasParaAlerta = quantidadeDiasParaAlerta; |
| 80 | }
|
83 | }
|
| 81 | 84 | ||
| 82 | public void verificarAlertas() { |
85 | public void verificarAlertas() { |
| 83 | limparEntidade(); |
86 | limparEntidade(); |
| 84 | - | ||
| 85 | // CONSULTAR MODELOS MAIS VENDIDOS
|
- | |
| 86 | List<RankingModeloDTO> modelosMaisVendidos = new ArrayList<RankingModeloDTO>(); |
- | |
| 87 | ParametrosConsultaModelosMaisVendidosDTO parametrosConsulta = new ParametrosConsultaModelosMaisVendidosDTO(); |
- | |
| 88 | parametrosConsulta.setDataFinal(DataUtils.getDataAtual()); |
- | |
| 89 | parametrosConsulta.setDataInicial(DataUtils.acrescentarDias(DataUtils.getDataAtual(), quantidadeDiasVendas*-1)); |
- | |
| 90 | modelosMaisVendidos.addAll(vendaService.consultarRankingModelos(parametrosConsulta, adicionarModelosFavoritosSemVendas)); |
- | |
| 91 | - | ||
| 92 | List<RankingComprasTransferenciasDTO> rankingComprasTransferencias = new ArrayList<RankingComprasTransferenciasDTO>(); |
- | |
| 93 | rankingComprasTransferencias.addAll(vendaService.consultarRankingComprasTransferencias(getQuantidadeDiasVendas(), getQuantidadeDiasParaAlerta(), modelosMaisVendidos, true)); |
- | |
| 94 | getEntidade().setQuantidadeAlertasModelosPossiveis(modelosMaisVendidos.size()); |
- | |
| 95 | getEntidade().setRankingsComprasTransferenciasDTO(rankingComprasTransferencias); |
- | |
| - | 87 | getEntidade().setAlertasLogisticaCapasDTO(alertasService.consultarAlertasLogistica(getQuantidadeDiasVendas(), getQuantidadeDiasParaAlerta(), getAdicionarModelosFavoritosSemVendas())); |
|
| 96 | }
|
88 | }
|
| 97 | 89 | ||
| 98 | }
|
90 | }
|