Subversion Repositories Integrator Subversion

Rev

Rev 583 | Rev 585 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
583 blopes 1
package br.com.ec.domain.dto;
2
 
3
import java.util.ArrayList;
4
import java.util.List;
5
 
6
import br.com.ec.domain.model.tipos.TipoProduto;
7
 
8
public class AlertasComprasGeralDTO {
9
 
10
        private TipoProduto tipoProduto;
11
        private List<RankingProdutoDTO> alertasProdutosSemSubtipo;
12
        private List<AlertasComprasGeralSubTipoDTO> alertasComprasGeralSubTipoDTO;
13
        private Integer quantidadeAlertasPossiveis;
584 blopes 14
        private Integer quantidadeAlertasPossiveisComSubtipo;
583 blopes 15
 
16
        private Boolean verificado;
17
 
18
        public AlertasComprasGeralDTO() {
19
                setAlertasProdutosSemSubtipo(new ArrayList<RankingProdutoDTO>());
20
                setAlertasComprasGeralSubTipoDTO(new ArrayList<AlertasComprasGeralSubTipoDTO>());
21
                setQuantidadeAlertasPossiveis(0);
584 blopes 22
                setQuantidadeAlertasPossiveisComSubtipo(0);
583 blopes 23
                setVerificado(false);
24
        }
25
 
26
        public TipoProduto getTipoProduto() {
27
                return tipoProduto;
28
        }
29
        public void setTipoProduto(TipoProduto tipoProduto) {
30
                this.tipoProduto = tipoProduto;
31
        }
32
 
33
        public List<RankingProdutoDTO> getAlertasProdutosSemSubtipo() {
34
                return alertasProdutosSemSubtipo;
35
        }
36
        public void setAlertasProdutosSemSubtipo(List<RankingProdutoDTO> alertasProdutosSemSubtipo) {
37
                this.alertasProdutosSemSubtipo = alertasProdutosSemSubtipo;
38
        }
39
 
40
        public List<AlertasComprasGeralSubTipoDTO> getAlertasComprasGeralSubTipoDTO() {
41
                return alertasComprasGeralSubTipoDTO;
42
        }
43
        public void setAlertasComprasGeralSubTipoDTO(List<AlertasComprasGeralSubTipoDTO> alertasComprasGeralSubTipoDTO) {
44
                this.alertasComprasGeralSubTipoDTO = alertasComprasGeralSubTipoDTO;
45
        }
46
 
47
        public Integer getQuantidadeAlertasPossiveis() {
48
                return quantidadeAlertasPossiveis;
49
        }
50
        public void setQuantidadeAlertasPossiveis(Integer quantidadeAlertasPossiveis) {
51
                this.quantidadeAlertasPossiveis = quantidadeAlertasPossiveis;
52
        }
53
 
584 blopes 54
        public Integer getQuantidadeAlertasPossiveisComSubtipo() {
55
                return quantidadeAlertasPossiveisComSubtipo;
56
        }
57
        public void setQuantidadeAlertasPossiveisComSubtipo(Integer quantidadeAlertasPossiveisComSubtipo) {
58
                this.quantidadeAlertasPossiveisComSubtipo = quantidadeAlertasPossiveisComSubtipo;
59
        }
60
 
583 blopes 61
        public Boolean getVerificado() {
62
                return verificado;
63
        }
64
        public void setVerificado(Boolean verificado) {
65
                this.verificado = verificado;
66
        }
67
 
68
        /******************************************************/
69
 
70
        public Integer getQuantidadeTotalAlertas() {
71
                Integer quantidadeTotalAlertas = 0;
72
                /*
73
                if (!getAlertasComprasGeralSubTipoDTO().isEmpty()) {
74
                        for (AlertasComprasGeralSubTipoDTO ranking : getAlertasComprasGeralSubTipoDTO()) {
75
                                quantidadeTotalAlertas += ranking.getAlertas().size();
76
                        }
77
                }
78
                */
79
                return quantidadeTotalAlertas;
80
        }
81
 
82
        public Integer getQuantidadeTotalAlertasPossiveis() {
83
                Integer quantidadeTotalAlertasPossiveis = 0;
84
                if (!getAlertasComprasGeralSubTipoDTO().isEmpty()) {
85
                        for (AlertasComprasGeralSubTipoDTO ranking : getAlertasComprasGeralSubTipoDTO()) {
86
                                quantidadeTotalAlertasPossiveis += ranking.getQuantidadeAlertasPossiveis();
87
                        }
88
                }
89
                return quantidadeTotalAlertasPossiveis + getQuantidadeTotalAlertas();
90
        }
91
 
92
        public Double percentualAlertas() {
93
                Double percentual = new Double(getQuantidadeTotalAlertas())/new Double(getQuantidadeTotalAlertasPossiveis());
94
                return 100 - (percentual * 100.0);
95
        }
96
 
97
        public String corPercentualAlerta() {
98
                Double percentual = percentualAlertas();
99
                if (percentual > 90.0) {
100
                        return "green-haze";
101
                }
102
                if (percentual > 50.0) {
103
                        return "orange";
104
                }
105
                return "red";
106
        }
107
 
108
}