Rev 585 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 582 | blopes | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 583 | blopes | 3 | import java.util.ArrayList; |
| 582 | blopes | 4 | import java.util.List; |
| 5 | |||
| 6 | import br.com.ec.domain.model.tipos.TipoProduto; |
||
| 7 | |||
| 8 | public class AlertasGeralDTO { |
||
| 9 | |||
| 10 | private Integer quantidadeDiasVendas = 0; |
||
| 11 | private Integer tempoDeEstoqueParaAlerta = 0; |
||
| 12 | private Boolean adicionarModelosFavoritosSemVendas; |
||
| 13 | |||
| 583 | blopes | 14 | private List<TipoProduto> tiposProdutoSelecionados; |
| 582 | blopes | 15 | |
| 16 | // ALERTAS COMPRAS (CAPAS) |
||
| 587 | blopes | 17 | |
| 18 | // ALERTAS COMPRAS (GERAL) |
||
| 583 | blopes | 19 | private List<AlertasComprasGeralDTO> alertasComprasGeralDTO; |
| 582 | blopes | 20 | |
| 21 | // ALERTAS LOGÍSTICA (CAPAS) |
||
| 22 | // ALERTAS LOGÍSTICA (EXCETO CAPAS) |
||
| 23 | |||
| 24 | // ALERTAS COMERCIAL |
||
| 25 | |||
| 26 | // ALERTAS GESTAO |
||
| 27 | |||
| 583 | blopes | 28 | public AlertasGeralDTO() { |
| 29 | setAlertasComprasGeralDTO(new ArrayList<AlertasComprasGeralDTO>()); |
||
| 30 | } |
||
| 582 | blopes | 31 | |
| 32 | public Integer getQuantidadeDiasVendas() { |
||
| 33 | return quantidadeDiasVendas; |
||
| 34 | } |
||
| 35 | public void setQuantidadeDiasVendas(Integer quantidadeDiasVendas) { |
||
| 36 | this.quantidadeDiasVendas = quantidadeDiasVendas; |
||
| 37 | } |
||
| 38 | |||
| 39 | public Integer getTempoDeEstoqueParaAlerta() { |
||
| 40 | return tempoDeEstoqueParaAlerta; |
||
| 41 | } |
||
| 42 | public void setTempoDeEstoqueParaAlerta(Integer tempoDeEstoqueParaAlerta) { |
||
| 43 | this.tempoDeEstoqueParaAlerta = tempoDeEstoqueParaAlerta; |
||
| 44 | } |
||
| 45 | |||
| 46 | public Boolean getAdicionarModelosFavoritosSemVendas() { |
||
| 47 | return adicionarModelosFavoritosSemVendas; |
||
| 48 | } |
||
| 49 | public void setAdicionarModelosFavoritosSemVendas(Boolean adicionarModelosFavoritosSemVendas) { |
||
| 50 | this.adicionarModelosFavoritosSemVendas = adicionarModelosFavoritosSemVendas; |
||
| 51 | } |
||
| 52 | |||
| 53 | public List<TipoProduto> getTiposProdutoSelecionados() { |
||
| 54 | return tiposProdutoSelecionados; |
||
| 55 | } |
||
| 56 | public void setTiposProdutoSelecionados(List<TipoProduto> tiposProdutoSelecionados) { |
||
| 57 | this.tiposProdutoSelecionados = tiposProdutoSelecionados; |
||
| 58 | } |
||
| 59 | |||
| 583 | blopes | 60 | public List<AlertasComprasGeralDTO> getAlertasComprasGeralDTO() { |
| 61 | return alertasComprasGeralDTO; |
||
| 62 | } |
||
| 63 | public void setAlertasComprasGeralDTO(List<AlertasComprasGeralDTO> alertasComprasGeralDTO) { |
||
| 64 | this.alertasComprasGeralDTO = alertasComprasGeralDTO; |
||
| 65 | } |
||
| 66 | |||
| 585 | blopes | 67 | /************************************************************/ |
| 68 | |||
| 69 | public Integer getQuantidadeTotalAlertasComprasGeral() { |
||
| 70 | Integer quantidadeTotalAlertas = 0; |
||
| 71 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
||
| 72 | quantidadeTotalAlertas += alertasComprasGeralDTO.getQuantidadeTotalAlertas(); |
||
| 73 | } |
||
| 74 | return quantidadeTotalAlertas; |
||
| 75 | } |
||
| 76 | |||
| 77 | public Integer getQuantidadeTotalAlertasPossiveisComprasGeral() { |
||
| 78 | Integer quantidadeTotalAlertasPossiveis = 0; |
||
| 79 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
||
| 80 | quantidadeTotalAlertasPossiveis += alertasComprasGeralDTO.getQuantidadeTotalAlertasPossiveis(); |
||
| 81 | } |
||
| 82 | return quantidadeTotalAlertasPossiveis; |
||
| 83 | } |
||
| 84 | |||
| 587 | blopes | 85 | public Integer getQuantidadeTotalAlertasCriticos() { |
| 86 | Integer quantidadeTotalAlertasCriticos = 0; |
||
| 87 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
||
| 88 | quantidadeTotalAlertasCriticos += alertasComprasGeralDTO.getQuantidadeAlertasCriticos(); |
||
| 89 | } |
||
| 90 | return quantidadeTotalAlertasCriticos; |
||
| 91 | } |
||
| 92 | |||
| 585 | blopes | 93 | public Double percentualAlertasComprasGeral() { |
| 94 | Double percentual = new Double(getQuantidadeTotalAlertasComprasGeral())/new Double(getQuantidadeTotalAlertasPossiveisComprasGeral()); |
||
| 95 | return 100 - (percentual * 100.0); |
||
| 96 | } |
||
| 97 | |||
| 98 | public String corPercentualAlertaComprasGeral() { |
||
| 99 | Double percentual = percentualAlertasComprasGeral(); |
||
| 100 | if (percentual > 90.0) { |
||
| 101 | return "green-haze"; |
||
| 102 | } |
||
| 103 | if (percentual > 50.0) { |
||
| 104 | return "orange"; |
||
| 105 | } |
||
| 106 | return "red"; |
||
| 107 | } |
||
| 108 | |||
| 582 | blopes | 109 | } |