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