Rev 583 | Rev 587 | 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) |
||
| 17 | // ALERTAS COMPRAS (EXCETO CAPAS) |
||
| 583 | blopes | 18 | private List<AlertasComprasGeralDTO> alertasComprasGeralDTO; |
| 582 | blopes | 19 | |
| 20 | // ALERTAS LOGÍSTICA (CAPAS) |
||
| 21 | // ALERTAS LOGÍSTICA (EXCETO CAPAS) |
||
| 22 | |||
| 23 | // ALERTAS COMERCIAL |
||
| 24 | |||
| 25 | // ALERTAS GESTAO |
||
| 26 | |||
| 583 | blopes | 27 | public AlertasGeralDTO() { |
| 28 | setAlertasComprasGeralDTO(new ArrayList<AlertasComprasGeralDTO>()); |
||
| 29 | } |
||
| 582 | blopes | 30 | |
| 31 | public Integer getQuantidadeDiasVendas() { |
||
| 32 | return quantidadeDiasVendas; |
||
| 33 | } |
||
| 34 | public void setQuantidadeDiasVendas(Integer quantidadeDiasVendas) { |
||
| 35 | this.quantidadeDiasVendas = quantidadeDiasVendas; |
||
| 36 | } |
||
| 37 | |||
| 38 | public Integer getTempoDeEstoqueParaAlerta() { |
||
| 39 | return tempoDeEstoqueParaAlerta; |
||
| 40 | } |
||
| 41 | public void setTempoDeEstoqueParaAlerta(Integer tempoDeEstoqueParaAlerta) { |
||
| 42 | this.tempoDeEstoqueParaAlerta = tempoDeEstoqueParaAlerta; |
||
| 43 | } |
||
| 44 | |||
| 45 | public Boolean getAdicionarModelosFavoritosSemVendas() { |
||
| 46 | return adicionarModelosFavoritosSemVendas; |
||
| 47 | } |
||
| 48 | public void setAdicionarModelosFavoritosSemVendas(Boolean adicionarModelosFavoritosSemVendas) { |
||
| 49 | this.adicionarModelosFavoritosSemVendas = adicionarModelosFavoritosSemVendas; |
||
| 50 | } |
||
| 51 | |||
| 52 | public List<TipoProduto> getTiposProdutoSelecionados() { |
||
| 53 | return tiposProdutoSelecionados; |
||
| 54 | } |
||
| 55 | public void setTiposProdutoSelecionados(List<TipoProduto> tiposProdutoSelecionados) { |
||
| 56 | this.tiposProdutoSelecionados = tiposProdutoSelecionados; |
||
| 57 | } |
||
| 58 | |||
| 583 | blopes | 59 | public List<AlertasComprasGeralDTO> getAlertasComprasGeralDTO() { |
| 60 | return alertasComprasGeralDTO; |
||
| 61 | } |
||
| 62 | public void setAlertasComprasGeralDTO(List<AlertasComprasGeralDTO> alertasComprasGeralDTO) { |
||
| 63 | this.alertasComprasGeralDTO = alertasComprasGeralDTO; |
||
| 64 | } |
||
| 65 | |||
| 585 | blopes | 66 | /************************************************************/ |
| 67 | |||
| 68 | public Integer getQuantidadeTotalAlertasComprasGeral() { |
||
| 69 | Integer quantidadeTotalAlertas = 0; |
||
| 70 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
||
| 71 | quantidadeTotalAlertas += alertasComprasGeralDTO.getQuantidadeTotalAlertas(); |
||
| 72 | } |
||
| 73 | return quantidadeTotalAlertas; |
||
| 74 | } |
||
| 75 | |||
| 76 | public Integer getQuantidadeTotalAlertasPossiveisComprasGeral() { |
||
| 77 | Integer quantidadeTotalAlertasPossiveis = 0; |
||
| 78 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
||
| 79 | quantidadeTotalAlertasPossiveis += alertasComprasGeralDTO.getQuantidadeTotalAlertasPossiveis(); |
||
| 80 | } |
||
| 81 | return quantidadeTotalAlertasPossiveis; |
||
| 82 | } |
||
| 83 | |||
| 84 | public Double percentualAlertasComprasGeral() { |
||
| 85 | Double percentual = new Double(getQuantidadeTotalAlertasComprasGeral())/new Double(getQuantidadeTotalAlertasPossiveisComprasGeral()); |
||
| 86 | return 100 - (percentual * 100.0); |
||
| 87 | } |
||
| 88 | |||
| 89 | public String corPercentualAlertaComprasGeral() { |
||
| 90 | Double percentual = percentualAlertasComprasGeral(); |
||
| 91 | if (percentual > 90.0) { |
||
| 92 | return "green-haze"; |
||
| 93 | } |
||
| 94 | if (percentual > 50.0) { |
||
| 95 | return "orange"; |
||
| 96 | } |
||
| 97 | return "red"; |
||
| 98 | } |
||
| 99 | |||
| 582 | blopes | 100 | } |