Rev 106 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import java.beans.Transient; |
||
| 4 | |||
| 5 | import br.com.ec.domain.model.AvaliacaoLoja; |
||
| 6 | import br.com.ec.domain.model.Loja; |
||
| 7 | import br.edu.cesmac.core.util.VerificadorUtil; |
||
| 8 | |||
| 9 | public class RankingLojaDTO implements Comparable<RankingLojaDTO> { |
||
| 10 | |||
| 11 | private AvaliacaoLoja avaliacaoLoja; |
||
| 12 | private Loja loja; |
||
| 13 | private Double valorTotalVendido; |
||
| 14 | private Double valorMetaMensal; |
||
| 15 | |||
| 121 | espaco | 16 | private Double valorCac; |
| 17 | private Integer quantidadeVendas; |
||
| 18 | private Integer quantidadeAtendimentos; |
||
| 19 | private Integer quantidadePedidos; |
||
| 20 | private Integer quantidadePedidosInvalidos; |
||
| 21 | private Integer quantidadeAvarias; |
||
| 22 | private Integer quantidadeTrocas; |
||
| 23 | private Double valorTotalDescontos; |
||
| 24 | private Double valorTotalEstoque; |
||
| 25 | private Integer quantidadeTotalEstoque; |
||
| 26 | private Double custoProdutosVendidos; |
||
| 27 | private Double resultadoLiquido; |
||
| 28 | |||
| 106 | espaco | 29 | public RankingLojaDTO() { |
| 30 | valorTotalVendido = 0.0; |
||
| 31 | valorMetaMensal = 0.0; |
||
| 32 | } |
||
| 33 | |||
| 34 | public AvaliacaoLoja getAvaliacaoLoja() { |
||
| 35 | return avaliacaoLoja; |
||
| 36 | } |
||
| 37 | public void setAvaliacaoLoja(AvaliacaoLoja avaliacaoLoja) { |
||
| 38 | this.avaliacaoLoja = avaliacaoLoja; |
||
| 39 | } |
||
| 40 | |||
| 41 | public Loja getLoja() { |
||
| 42 | return loja; |
||
| 43 | } |
||
| 44 | public void setLoja(Loja loja) { |
||
| 45 | this.loja = loja; |
||
| 46 | } |
||
| 47 | |||
| 48 | public Double getValorTotalVendido() { |
||
| 49 | return valorTotalVendido; |
||
| 50 | } |
||
| 51 | public void setValorTotalVendido(Double valorTotalVendido) { |
||
| 52 | this.valorTotalVendido = valorTotalVendido; |
||
| 53 | } |
||
| 54 | |||
| 55 | public Double getValorMetaMensal() { |
||
| 56 | return valorMetaMensal; |
||
| 57 | } |
||
| 58 | public void setValorMetaMensal(Double valorMetaMensal) { |
||
| 59 | this.valorMetaMensal = valorMetaMensal; |
||
| 60 | } |
||
| 61 | public Double getPercentualMetaMensal() { |
||
| 62 | if (VerificadorUtil.naoEstaNulo(valorTotalVendido) && VerificadorUtil.naoEstaNulo(valorMetaMensal)) { |
||
| 63 | if (valorMetaMensal > new Double(0.0)) { |
||
| 64 | return valorTotalVendido / valorMetaMensal; |
||
| 65 | } |
||
| 66 | } |
||
| 67 | return new Double (0.0); |
||
| 68 | } |
||
| 69 | |||
| 121 | espaco | 70 | public Double getValorCac() { |
| 71 | return valorCac; |
||
| 72 | } |
||
| 73 | public void setValorCac(Double valorCac) { |
||
| 74 | this.valorCac = valorCac; |
||
| 75 | } |
||
| 76 | |||
| 77 | public Integer getQuantidadeVendas() { |
||
| 78 | return quantidadeVendas; |
||
| 79 | } |
||
| 80 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 81 | this.quantidadeVendas = quantidadeVendas; |
||
| 82 | } |
||
| 83 | |||
| 84 | public Integer getQuantidadeAtendimentos() { |
||
| 85 | return quantidadeAtendimentos; |
||
| 86 | } |
||
| 87 | public void setQuantidadeAtendimentos(Integer quantidadeAtendimentos) { |
||
| 88 | this.quantidadeAtendimentos = quantidadeAtendimentos; |
||
| 89 | } |
||
| 90 | |||
| 91 | public Integer getQuantidadePedidos() { |
||
| 92 | return quantidadePedidos; |
||
| 93 | } |
||
| 94 | public void setQuantidadePedidos(Integer quantidadePedidos) { |
||
| 95 | this.quantidadePedidos = quantidadePedidos; |
||
| 96 | } |
||
| 97 | |||
| 98 | public Integer getQuantidadePedidosInvalidos() { |
||
| 99 | return quantidadePedidosInvalidos; |
||
| 100 | } |
||
| 101 | public void setQuantidadePedidosInvalidos(Integer quantidadePedidosInvalidos) { |
||
| 102 | this.quantidadePedidosInvalidos = quantidadePedidosInvalidos; |
||
| 103 | } |
||
| 104 | |||
| 105 | public Integer getQuantidadeAvarias() { |
||
| 106 | return quantidadeAvarias; |
||
| 107 | } |
||
| 108 | public void setQuantidadeAvarias(Integer quantidadeAvarias) { |
||
| 109 | this.quantidadeAvarias = quantidadeAvarias; |
||
| 110 | } |
||
| 111 | |||
| 112 | public Integer getQuantidadeTrocas() { |
||
| 113 | return quantidadeTrocas; |
||
| 114 | } |
||
| 115 | public void setQuantidadeTrocas(Integer quantidadeTrocas) { |
||
| 116 | this.quantidadeTrocas = quantidadeTrocas; |
||
| 117 | } |
||
| 118 | |||
| 119 | public Double getValorTotalDescontos() { |
||
| 120 | return valorTotalDescontos; |
||
| 121 | } |
||
| 122 | public void setValorTotalDescontos(Double valorTotalDescontos) { |
||
| 123 | this.valorTotalDescontos = valorTotalDescontos; |
||
| 124 | } |
||
| 125 | |||
| 126 | public Double getValorTotalEstoque() { |
||
| 127 | return valorTotalEstoque; |
||
| 128 | } |
||
| 129 | public void setValorTotalEstoque(Double valorTotalEstoque) { |
||
| 130 | this.valorTotalEstoque = valorTotalEstoque; |
||
| 131 | } |
||
| 132 | |||
| 133 | public Integer getQuantidadeTotalEstoque() { |
||
| 134 | return quantidadeTotalEstoque; |
||
| 135 | } |
||
| 136 | public void setQuantidadeTotalEstoque(Integer quantidadeTotalEstoque) { |
||
| 137 | this.quantidadeTotalEstoque = quantidadeTotalEstoque; |
||
| 138 | } |
||
| 139 | |||
| 140 | public Double getCustoProdutosVendidos() { |
||
| 141 | return custoProdutosVendidos; |
||
| 142 | } |
||
| 143 | public void setCustoProdutosVendidos(Double custoProdutosVendidos) { |
||
| 144 | this.custoProdutosVendidos = custoProdutosVendidos; |
||
| 145 | } |
||
| 146 | |||
| 147 | public Double getResultadoLiquido() { |
||
| 148 | return resultadoLiquido; |
||
| 149 | } |
||
| 150 | public void setResultadoLiquido(Double resultadoLiquido) { |
||
| 151 | this.resultadoLiquido = resultadoLiquido; |
||
| 152 | } |
||
| 153 | |||
| 154 | /*****************************************/ |
||
| 155 | |||
| 106 | espaco | 156 | @Override |
| 157 | public int compareTo(RankingLojaDTO rankingLojaDTO) { |
||
| 158 | return rankingLojaDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
||
| 159 | } |
||
| 160 | |||
| 161 | @Transient |
||
| 162 | public String corSobreMeta() { |
||
| 163 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal())) { |
||
| 164 | if (getPercentualMetaMensal() > 0.99) return "green"; |
||
| 165 | if (getPercentualMetaMensal() > 0.74) return "orange"; |
||
| 166 | return "red"; |
||
| 167 | } |
||
| 168 | return "black"; |
||
| 169 | } |
||
| 170 | |||
| 171 | @Transient |
||
| 172 | public String corSobreMetaCorrente(Double percentualPercorridoMesAtual) { |
||
| 173 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal()) && VerificadorUtil.naoEstaNulo(percentualPercorridoMesAtual)) { |
||
| 174 | Double diferenca = getPercentualMetaMensal() - (percentualPercorridoMesAtual/100); |
||
| 175 | Double diferencaSetentaCinco = percentualPercorridoMesAtual * 25 / 100; |
||
| 176 | if (diferenca > 0) { |
||
| 177 | return "green"; |
||
| 178 | } else if (diferenca > (diferencaSetentaCinco * -1 / 100)) { |
||
| 179 | return "orange"; |
||
| 180 | } else { |
||
| 181 | return "red"; |
||
| 182 | } |
||
| 183 | } |
||
| 184 | return "black"; |
||
| 185 | } |
||
| 186 | |||
| 121 | espaco | 187 | @Transient |
| 188 | public Double valorTicketMedio() { |
||
| 189 | if (VerificadorUtil.naoEstaNulo(getValorTotalVendido()) && |
||
| 190 | VerificadorUtil.naoEstaNulo(getQuantidadeVendas())) { |
||
| 191 | if (getValorTotalVendido() > 0.0 && getQuantidadeVendas() > 0) { |
||
| 192 | return getValorTotalVendido() / getQuantidadeVendas(); |
||
| 193 | } |
||
| 194 | } |
||
| 195 | return 0.0; |
||
| 196 | } |
||
| 197 | |||
| 198 | @Transient |
||
| 199 | public Double percentualDesconto() { |
||
| 200 | if (VerificadorUtil.naoEstaNulo(getValorTotalVendido()) && |
||
| 201 | VerificadorUtil.naoEstaNulo(getValorTotalDescontos())) { |
||
| 202 | if (getValorTotalVendido() > 0.0 && getValorTotalDescontos() > 0.0) { |
||
| 203 | return (getValorTotalDescontos() * 100) / getValorTotalVendido(); |
||
| 204 | } |
||
| 205 | } |
||
| 206 | return 0.0; |
||
| 207 | } |
||
| 208 | |||
| 106 | espaco | 209 | } |