Rev 333 | 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 | |||
| 195 | espaco | 5 | import br.com.ec.core.util.DataUtils; |
| 6 | import br.com.ec.core.util.VerificadorUtil; |
||
| 106 | espaco | 7 | import br.com.ec.domain.model.AvaliacaoFuncionario; |
| 8 | import br.com.ec.domain.model.Funcionario; |
||
| 9 | import br.com.ec.domain.model.Vendedor; |
||
| 10 | |||
| 11 | public class RankingVendedorDTO implements Comparable<RankingVendedorDTO> { |
||
| 12 | |||
| 13 | private AvaliacaoFuncionario avaliacaoFuncionario; |
||
| 14 | private Vendedor vendedor; |
||
| 15 | private Funcionario funcionario; |
||
| 16 | private Double quantidadeBancoHoras; |
||
| 17 | private Double valorTotalVendidoDoDia; |
||
| 18 | private Double valorTotalVendido; |
||
| 19 | private Integer quantidadeTotalProdutosVendidos; |
||
| 20 | private Double valorTotalVendidoVivo; |
||
| 21 | private Double valorTotalDescontos; |
||
| 22 | private Double percentualDescontos; |
||
| 252 | espaco | 23 | private Integer quantidadeProdutosPromocaoInterna; |
| 24 | private Integer quantidadeTpuSoftNormal; |
||
| 25 | private Integer quantidadeTpuSoftCamera; |
||
| 106 | espaco | 26 | private Integer quantidadePedidos; |
| 27 | private Integer quantidadePedidosInvalidos; |
||
| 28 | private Integer quantidadeVendas; |
||
| 29 | private Integer quantidadeContagens; |
||
| 30 | private Integer quantidadeAtendimentos; |
||
| 31 | private Double percentualMetaDiaria; |
||
| 32 | private Double percentualMetaMensal; |
||
| 33 | private Double percentualMetaMensalVivo; |
||
| 333 | espaco | 34 | private Double percentualMetaTicketMedio; |
| 106 | espaco | 35 | private Double comissao; |
| 36 | private Double comissaoVivo; |
||
| 337 | espaco | 37 | private Double pontuacaoGeral; |
| 106 | espaco | 38 | |
| 39 | public AvaliacaoFuncionario getAvaliacaoFuncionario() { |
||
| 40 | return avaliacaoFuncionario; |
||
| 41 | } |
||
| 42 | public void setAvaliacaoFuncionario(AvaliacaoFuncionario avaliacaoFuncionario) { |
||
| 43 | this.avaliacaoFuncionario = avaliacaoFuncionario; |
||
| 44 | } |
||
| 45 | |||
| 46 | public Vendedor getVendedor() { |
||
| 47 | return vendedor; |
||
| 48 | } |
||
| 49 | public void setVendedor(Vendedor vendedor) { |
||
| 50 | this.vendedor = vendedor; |
||
| 51 | } |
||
| 52 | |||
| 53 | public Funcionario getFuncionario() { |
||
| 54 | return funcionario; |
||
| 55 | } |
||
| 56 | public void setFuncionario(Funcionario funcionario) { |
||
| 57 | this.funcionario = funcionario; |
||
| 58 | } |
||
| 59 | |||
| 60 | public Double getQuantidadeBancoHoras() { |
||
| 61 | return quantidadeBancoHoras; |
||
| 62 | } |
||
| 63 | public void setQuantidadeBancoHoras(Double quantidadeBancoHoras) { |
||
| 64 | this.quantidadeBancoHoras = quantidadeBancoHoras; |
||
| 65 | } |
||
| 66 | |||
| 67 | public Double getValorTotalVendidoDoDia() { |
||
| 68 | return valorTotalVendidoDoDia; |
||
| 69 | } |
||
| 70 | public void setValorTotalVendidoDoDia(Double valorTotalVendidoDoDia) { |
||
| 71 | this.valorTotalVendidoDoDia = valorTotalVendidoDoDia; |
||
| 72 | } |
||
| 73 | |||
| 74 | public Double getValorTotalVendido() { |
||
| 75 | return valorTotalVendido; |
||
| 76 | } |
||
| 77 | public void setValorTotalVendido(Double valorTotalVendido) { |
||
| 78 | this.valorTotalVendido = valorTotalVendido; |
||
| 79 | } |
||
| 80 | |||
| 81 | public Integer getQuantidadeTotalProdutosVendidos() { |
||
| 82 | return quantidadeTotalProdutosVendidos; |
||
| 83 | } |
||
| 84 | public void setQuantidadeTotalProdutosVendidos(Integer quantidadeTotalProdutosVendidos) { |
||
| 85 | this.quantidadeTotalProdutosVendidos = quantidadeTotalProdutosVendidos; |
||
| 86 | } |
||
| 87 | |||
| 88 | public Double getValorTotalVendidoVivo() { |
||
| 89 | return valorTotalVendidoVivo; |
||
| 90 | } |
||
| 91 | public void setValorTotalVendidoVivo(Double valorTotalVendidoVivo) { |
||
| 92 | this.valorTotalVendidoVivo = valorTotalVendidoVivo; |
||
| 93 | } |
||
| 94 | |||
| 95 | public Double getValorTotalDescontos() { |
||
| 96 | return valorTotalDescontos; |
||
| 97 | } |
||
| 98 | public void setValorTotalDescontos(Double valorTotalDescontos) { |
||
| 99 | this.valorTotalDescontos = valorTotalDescontos; |
||
| 100 | } |
||
| 101 | |||
| 102 | public Double getPercentualDescontos() { |
||
| 103 | return percentualDescontos; |
||
| 104 | } |
||
| 105 | public void setPercentualDescontos(Double percentualDescontos) { |
||
| 106 | this.percentualDescontos = percentualDescontos; |
||
| 107 | } |
||
| 108 | |||
| 252 | espaco | 109 | public Integer getQuantidadeProdutosPromocaoInterna() { |
| 110 | return quantidadeProdutosPromocaoInterna; |
||
| 111 | } |
||
| 112 | public void setQuantidadeProdutosPromocaoInterna(Integer quantidadeProdutosPromocaoInterna) { |
||
| 113 | this.quantidadeProdutosPromocaoInterna = quantidadeProdutosPromocaoInterna; |
||
| 114 | } |
||
| 115 | |||
| 116 | public Integer getQuantidadeTpuSoftNormal() { |
||
| 117 | return quantidadeTpuSoftNormal; |
||
| 118 | } |
||
| 119 | public void setQuantidadeTpuSoftNormal(Integer quantidadeTpuSoftNormal) { |
||
| 120 | this.quantidadeTpuSoftNormal = quantidadeTpuSoftNormal; |
||
| 121 | } |
||
| 122 | |||
| 123 | public Integer getQuantidadeTpuSoftCamera() { |
||
| 124 | return quantidadeTpuSoftCamera; |
||
| 125 | } |
||
| 126 | public void setQuantidadeTpuSoftCamera(Integer quantidadeTpuSoftCamera) { |
||
| 127 | this.quantidadeTpuSoftCamera = quantidadeTpuSoftCamera; |
||
| 128 | } |
||
| 129 | |||
| 106 | espaco | 130 | public Integer getQuantidadePedidos() { |
| 131 | return quantidadePedidos; |
||
| 132 | } |
||
| 133 | public void setQuantidadePedidos(Integer quantidadePedidos) { |
||
| 134 | this.quantidadePedidos = quantidadePedidos; |
||
| 135 | } |
||
| 136 | |||
| 137 | public Integer getQuantidadePedidosInvalidos() { |
||
| 138 | return quantidadePedidosInvalidos; |
||
| 139 | } |
||
| 140 | public void setQuantidadePedidosInvalidos(Integer quantidadePedidosInvalidos) { |
||
| 141 | this.quantidadePedidosInvalidos = quantidadePedidosInvalidos; |
||
| 142 | } |
||
| 143 | |||
| 144 | public Integer getQuantidadeVendas() { |
||
| 145 | return quantidadeVendas; |
||
| 146 | } |
||
| 147 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 148 | this.quantidadeVendas = quantidadeVendas; |
||
| 149 | } |
||
| 150 | |||
| 151 | public Integer getQuantidadeContagens() { |
||
| 152 | return quantidadeContagens; |
||
| 153 | } |
||
| 154 | public void setQuantidadeContagens(Integer quantidadeContagens) { |
||
| 155 | this.quantidadeContagens = quantidadeContagens; |
||
| 156 | } |
||
| 157 | |||
| 158 | public Integer getQuantidadeAtendimentos() { |
||
| 159 | return quantidadeAtendimentos; |
||
| 160 | } |
||
| 161 | public void setQuantidadeAtendimentos(Integer quantidadeAtendimentos) { |
||
| 162 | this.quantidadeAtendimentos = quantidadeAtendimentos; |
||
| 163 | } |
||
| 164 | |||
| 165 | public Double getPercentualMetaDiaria() { |
||
| 166 | return percentualMetaDiaria; |
||
| 167 | } |
||
| 168 | public void setPercentualMetaDiaria(Double percentualMetaDiaria) { |
||
| 169 | this.percentualMetaDiaria = percentualMetaDiaria; |
||
| 170 | } |
||
| 171 | |||
| 172 | public Double getPercentualMetaMensal() { |
||
| 173 | return percentualMetaMensal; |
||
| 174 | } |
||
| 175 | public void setPercentualMetaMensal(Double percentualMetaMensal) { |
||
| 176 | this.percentualMetaMensal = percentualMetaMensal; |
||
| 177 | } |
||
| 178 | |||
| 179 | public Double getPercentualMetaMensalVivo() { |
||
| 180 | return percentualMetaMensalVivo; |
||
| 181 | } |
||
| 182 | public void setPercentualMetaMensalVivo(Double percentualMetaMensalVivo) { |
||
| 183 | this.percentualMetaMensalVivo = percentualMetaMensalVivo; |
||
| 184 | } |
||
| 185 | |||
| 333 | espaco | 186 | public Double getPercentualMetaTicketMedio() { |
| 187 | return percentualMetaTicketMedio; |
||
| 188 | } |
||
| 189 | public void setPercentualMetaTicketMedio(Double percentualMetaTicketMedio) { |
||
| 190 | this.percentualMetaTicketMedio = percentualMetaTicketMedio; |
||
| 191 | } |
||
| 192 | |||
| 106 | espaco | 193 | public Double getComissao() { |
| 194 | return comissao; |
||
| 195 | } |
||
| 196 | public void setComissao(Double comissao) { |
||
| 197 | this.comissao = comissao; |
||
| 198 | } |
||
| 199 | |||
| 200 | public Double getComissaoVivo() { |
||
| 201 | return comissaoVivo; |
||
| 202 | } |
||
| 203 | public void setComissaoVivo(Double comissaoVivo) { |
||
| 204 | this.comissaoVivo = comissaoVivo; |
||
| 205 | } |
||
| 206 | |||
| 337 | espaco | 207 | public Double getPontuacaoGeral() { |
| 208 | return pontuacaoGeral; |
||
| 209 | } |
||
| 210 | public void setPontuacaoGeral(Double pontuacaoGeral) { |
||
| 211 | this.pontuacaoGeral = pontuacaoGeral; |
||
| 212 | } |
||
| 213 | |||
| 106 | espaco | 214 | @SuppressWarnings("deprecation") |
| 215 | public Double getPercentualPercorridoMesAtual() { |
||
| 216 | Integer ultimoDiaDoMes = DataUtils.getUltimoDiaDoMesAtual().getDate(); |
||
| 217 | Integer diaAtual = DataUtils.getDataAtual().getDate(); |
||
| 218 | return new Double(100*diaAtual/ultimoDiaDoMes); |
||
| 219 | } |
||
| 220 | |||
| 221 | @Override |
||
| 222 | public int compareTo(RankingVendedorDTO rankingVendedorDTO) { |
||
| 223 | return rankingVendedorDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
||
| 224 | } |
||
| 225 | |||
| 226 | public Double getTicketMedio() { |
||
| 227 | if (VerificadorUtil.naoEstaNulo(getValorTotalVendido()) |
||
| 228 | && VerificadorUtil.naoEstaNulo(getQuantidadeVendas())) { |
||
| 229 | if (getValorTotalVendido() > 0 && getQuantidadeVendas() > 0) { |
||
| 230 | return getValorTotalVendido()/getQuantidadeVendas(); |
||
| 231 | } |
||
| 232 | } |
||
| 233 | return 0.0; |
||
| 234 | } |
||
| 235 | |||
| 236 | @Transient |
||
| 237 | public Double retornarFaixaComissao() { |
||
| 238 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario())) { |
||
| 239 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario().getPorcentagemComissao())) { |
||
| 240 | return getAvaliacaoFuncionario().getPorcentagemComissao(); |
||
| 241 | } |
||
| 242 | return getAvaliacaoFuncionario().retornarFaixaComissao(getValorTotalVendido(), getFuncionario().getTipoComissionamento()); |
||
| 243 | } |
||
| 244 | return 0.0; |
||
| 245 | } |
||
| 246 | |||
| 247 | @Transient |
||
| 248 | public String corSobreMeta() { |
||
| 249 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal())) { |
||
| 250 | if (getPercentualMetaMensal() > 0.99) return "green"; |
||
| 251 | if (getPercentualMetaMensal() > 0.74) return "orange"; |
||
| 252 | return "red"; |
||
| 253 | } |
||
| 254 | return "black"; |
||
| 255 | } |
||
| 256 | |||
| 257 | @Transient |
||
| 333 | espaco | 258 | public String corSobreMetaTicketMedio() { |
| 259 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaTicketMedio())) { |
||
| 260 | if (getPercentualMetaTicketMedio() > 0.99) return "green"; |
||
| 261 | // if (getPercentualMetaTicketMedio() > 0.74) return "orange"; |
||
| 262 | return "red"; |
||
| 263 | } |
||
| 264 | return "black"; |
||
| 265 | } |
||
| 266 | |||
| 267 | @Transient |
||
| 106 | espaco | 268 | public String corSobreMetaCorrente(Double percentualPercorridoMesAtual) { |
| 269 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal()) && VerificadorUtil.naoEstaNulo(percentualPercorridoMesAtual)) { |
||
| 270 | Double diferenca = getPercentualMetaMensal() - (percentualPercorridoMesAtual/100); |
||
| 271 | Double diferencaSetentaCinco = percentualPercorridoMesAtual * 25 / 100; |
||
| 272 | if (diferenca > 0.24) { |
||
| 273 | return "blue"; |
||
| 274 | } else if (diferenca > 0) { |
||
| 275 | return "green"; |
||
| 276 | } else if (diferenca > (diferencaSetentaCinco * -1 / 100)) { |
||
| 277 | return "orange"; |
||
| 278 | } else { |
||
| 279 | return "red"; |
||
| 280 | } |
||
| 281 | } |
||
| 282 | return "black"; |
||
| 283 | } |
||
| 284 | |||
| 285 | @Transient |
||
| 286 | public Boolean percentualDescontosPertoDoLimite() { |
||
| 287 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 288 | if (getPercentualDescontos() > 0.06 && getPercentualDescontos() < 0.07) { |
||
| 289 | return true; |
||
| 290 | } |
||
| 291 | } |
||
| 292 | return false; |
||
| 293 | } |
||
| 294 | |||
| 295 | @Transient |
||
| 296 | public Boolean percentualDescontosSuperiorAoLimite() { |
||
| 297 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 298 | if (getPercentualDescontos() > 0.07) { |
||
| 299 | return true; |
||
| 300 | } |
||
| 301 | } |
||
| 302 | return false; |
||
| 303 | } |
||
| 304 | |||
| 305 | } |