Rev 582 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 582 | Rev 588 | ||
|---|---|---|---|
| Line 3... | Line 3... | ||
| 3 | import java.util.ArrayList; |
3 | import java.util.ArrayList; |
| 4 | import java.util.List; |
4 | import java.util.List; |
| 5 | 5 | ||
| 6 | public class AlertasComprasDTO { |
6 | public class AlertasComprasDTO { |
| 7 | 7 | ||
| 8 | private List<RankingComprasTransferenciasDTO> rankingsComprasTransferenciasDTO; |
- | |
| 9 | private Integer quantidadeAlertasPossiveis; |
- | |
| 10 | - | ||
| - | 8 | private List<AlertasComprasGeralDTO> alertasComprasGeralDTO; |
|
| - | 9 | ||
| 11 | public AlertasComprasDTO() { |
10 | public AlertasComprasDTO() { |
| 12 | setRankingsComprasTransferenciasDTO(new ArrayList<RankingComprasTransferenciasDTO>()); |
- | |
| 13 | setQuantidadeAlertasPossiveis(0); |
- | |
| - | 11 | alertasComprasGeralDTO = new ArrayList<AlertasComprasGeralDTO>(); |
|
| 14 | }
|
12 | }
|
| 15 | 13 | ||
| 16 | public List<RankingComprasTransferenciasDTO> getRankingsComprasTransferenciasDTO() { |
- | |
| 17 | return rankingsComprasTransferenciasDTO; |
- | |
| - | 14 | public List<AlertasComprasGeralDTO> getAlertasComprasGeralDTO() { |
|
| - | 15 | return alertasComprasGeralDTO; |
|
| 18 | }
|
16 | }
|
| 19 | public void setRankingsComprasTransferenciasDTO(List<RankingComprasTransferenciasDTO> rankingsComprasTransferenciasDTO) { |
- | |
| 20 | this.rankingsComprasTransferenciasDTO = rankingsComprasTransferenciasDTO; |
- | |
| - | 17 | public void setAlertasComprasGeralDTO(List<AlertasComprasGeralDTO> alertasComprasGeralDTO) { |
|
| - | 18 | this.alertasComprasGeralDTO = alertasComprasGeralDTO; |
|
| 21 | }
|
19 | }
|
| 22 | 20 | ||
| 23 | public Integer getQuantidadeAlertasPossiveis() { |
- | |
| 24 | return quantidadeAlertasPossiveis; |
- | |
| 25 | }
|
- | |
| 26 | public void setQuantidadeAlertasPossiveis(Integer quantidadeAlertasPossiveis) { |
- | |
| 27 | this.quantidadeAlertasPossiveis = quantidadeAlertasPossiveis; |
- | |
| 28 | }
|
- | |
| - | 21 | /****************************************************************/
|
|
| 29 | 22 | ||
| 30 | /******************************************************/
|
- | |
| 31 | - | ||
| 32 | public Integer getQuantidadeTotalAlertas() { |
- | |
| - | 23 | public Integer getQuantidadeTotalAlertasComprasGeral() { |
|
| 33 | Integer quantidadeTotalAlertas = 0; |
24 | Integer quantidadeTotalAlertas = 0; |
| 34 | if (!getRankingsComprasTransferenciasDTO().isEmpty()) { |
- | |
| 35 | for (RankingComprasTransferenciasDTO ranking : getRankingsComprasTransferenciasDTO()) { |
- | |
| 36 | quantidadeTotalAlertas += ranking.getAlertas().size(); |
- | |
| 37 | }
|
- | |
| - | 25 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
|
| - | 26 | quantidadeTotalAlertas += alertasComprasGeralDTO.getQuantidadeTotalAlertas(); |
|
| 38 | }
|
27 | }
|
| 39 | return quantidadeTotalAlertas; |
28 | return quantidadeTotalAlertas; |
| 40 | }
|
29 | }
|
| 41 | 30 | ||
| 42 | public Integer getQuantidadeTotalAlertasPossiveis() { |
- | |
| - | 31 | public Integer getQuantidadeTotalAlertasPossiveisComprasGeral() { |
|
| 43 | Integer quantidadeTotalAlertasPossiveis = 0; |
32 | Integer quantidadeTotalAlertasPossiveis = 0; |
| 44 | if (!getRankingsComprasTransferenciasDTO().isEmpty()) { |
- | |
| 45 | for (RankingComprasTransferenciasDTO ranking : getRankingsComprasTransferenciasDTO()) { |
- | |
| 46 | quantidadeTotalAlertasPossiveis += ranking.getQuantidadeAlertasPossiveis(); |
- | |
| 47 | }
|
- | |
| - | 33 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
|
| - | 34 | quantidadeTotalAlertasPossiveis += alertasComprasGeralDTO.getQuantidadeTotalAlertasPossiveis(); |
|
| - | 35 | }
|
|
| - | 36 | return quantidadeTotalAlertasPossiveis; |
|
| - | 37 | }
|
|
| - | 38 | ||
| - | 39 | public Integer getQuantidadeTotalAlertasCriticos() { |
|
| - | 40 | Integer quantidadeTotalAlertasCriticos = 0; |
|
| - | 41 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
|
| - | 42 | quantidadeTotalAlertasCriticos += alertasComprasGeralDTO.getQuantidadeAlertasCriticos(); |
|
| - | 43 | }
|
|
| - | 44 | return quantidadeTotalAlertasCriticos; |
|
| - | 45 | }
|
|
| - | 46 | ||
| - | 47 | public Integer getQuantidadeTotalAlertasSemPedidoCompra() { |
|
| - | 48 | Integer quantidadeTotalAlertasSemPedidoCompra = 0; |
|
| - | 49 | for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) { |
|
| - | 50 | quantidadeTotalAlertasSemPedidoCompra += alertasComprasGeralDTO.getQuantidadeAlertasSemPedidoCompra(); |
|
| 48 | }
|
51 | }
|
| 49 | return quantidadeTotalAlertasPossiveis + getQuantidadeTotalAlertas(); |
- | |
| - | 52 | return quantidadeTotalAlertasSemPedidoCompra; |
|
| 50 | }
|
53 | }
|
| 51 | 54 | ||
| 52 | public Double percentualAlertas() { |
- | |
| 53 | Double percentual = new Double(getQuantidadeTotalAlertas())/new Double(getQuantidadeTotalAlertasPossiveis()); |
- | |
| - | 55 | public Double percentualAlertasComprasGeral() { |
|
| - | 56 | Double percentual = new Double(getQuantidadeTotalAlertasComprasGeral())/new Double(getQuantidadeTotalAlertasPossiveisComprasGeral()); |
|
| 54 | return 100 - (percentual * 100.0); |
57 | return 100 - (percentual * 100.0); |
| 55 | }
|
58 | }
|
| 56 | 59 | ||
| 57 | public String corPercentualAlerta() { |
- | |
| 58 | Double percentual = percentualAlertas(); |
- | |
| - | 60 | public String corPercentualAlertaComprasGeral() { |
|
| - | 61 | Double percentual = percentualAlertasComprasGeral(); |
|
| 59 | if (percentual > 90.0) { |
62 | if (percentual > 90.0) { |
| 60 | return "green-haze"; |
63 | return "green-haze"; |
| 61 | }
|
64 | }
|
| 62 | if (percentual > 50.0) { |
65 | if (percentual > 50.0) { |
| 63 | return "orange"; |
66 | return "orange"; |