Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 574 | blopes | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import java.util.ArrayList; |
||
| 4 | import java.util.List; |
||
| 5 | |||
| 6 | public class AnaliseComprasProdutosDTO { |
||
| 7 | |||
| 8 | private List<AnaliseVendaProdutoDTO> analisesVendaProdutoDTO; |
||
| 9 | private Integer quantidadeAlertasModelosPossiveis; |
||
| 10 | |||
| 11 | public AnaliseComprasProdutosDTO() { |
||
| 12 | setAnalisesVendaProdutoDTO(new ArrayList<AnaliseVendaProdutoDTO>()); |
||
| 13 | setQuantidadeAlertasModelosPossiveis(0); |
||
| 14 | } |
||
| 15 | |||
| 16 | public List<AnaliseVendaProdutoDTO> getAnalisesVendaProdutoDTO() { |
||
| 17 | return analisesVendaProdutoDTO; |
||
| 18 | } |
||
| 19 | public void setAnalisesVendaProdutoDTO(List<AnaliseVendaProdutoDTO> analisesVendaProdutoDTO) { |
||
| 20 | this.analisesVendaProdutoDTO = analisesVendaProdutoDTO; |
||
| 21 | } |
||
| 22 | |||
| 23 | public Integer getQuantidadeAlertasModelosPossiveis() { |
||
| 24 | return quantidadeAlertasModelosPossiveis; |
||
| 25 | } |
||
| 26 | public void setQuantidadeAlertasModelosPossiveis(Integer quantidadeAlertasModelosPossiveis) { |
||
| 27 | this.quantidadeAlertasModelosPossiveis = quantidadeAlertasModelosPossiveis; |
||
| 28 | } |
||
| 29 | |||
| 30 | /******************************************************/ |
||
| 31 | |||
| 32 | /* |
||
| 33 | public Integer getQuantidadeTotalAlertas() { |
||
| 34 | Integer quantidadeTotalAlertas = 0; |
||
| 35 | if (!getAnalisesVendaProdutoDTO().isEmpty()) { |
||
| 36 | for (AnaliseVendaProdutoDTO analise : getAnalisesVendaProdutoDTO()) { |
||
| 37 | quantidadeTotalAlertas += analise.getAlertas().size(); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | return quantidadeTotalAlertas; |
||
| 41 | } |
||
| 42 | |||
| 43 | public Integer getQuantidadeTotalAlertasPossiveis() { |
||
| 44 | Integer quantidadeTotalAlertasPossiveis = 0; |
||
| 45 | if (!getAnalisesVendaProdutoDTO().isEmpty()) { |
||
| 46 | for (AnaliseVendaProdutoDTO analise : getAnalisesVendaProdutoDTO()) { |
||
| 47 | quantidadeTotalAlertasPossiveis += analise.getQuantidadeAlertasPossiveis(); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | return quantidadeTotalAlertasPossiveis + getQuantidadeTotalAlertas(); |
||
| 51 | } |
||
| 52 | |||
| 53 | public Double percentualAlertas() { |
||
| 54 | Double percentual = new Double(getQuantidadeTotalAlertas())/new Double(getQuantidadeTotalAlertasPossiveis()); |
||
| 55 | return 100 - (percentual * 100.0); |
||
| 56 | } |
||
| 57 | |||
| 58 | public String corPercentualAlerta() { |
||
| 59 | Double percentual = percentualAlertas(); |
||
| 60 | if (percentual > 90.0) { |
||
| 61 | return "green-haze"; |
||
| 62 | } |
||
| 63 | if (percentual > 50.0) { |
||
| 64 | return "orange"; |
||
| 65 | } |
||
| 66 | return "red"; |
||
| 67 | } |
||
| 68 | */ |
||
| 69 | } |