Rev 561 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 561 | blopes | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | public class RankingModeloDTO implements Comparable<RankingModeloDTO> { |
||
| 4 | |||
| 5 | private ModeloDTO modelo; |
||
| 6 | private Double valorTotalVendido; |
||
| 7 | private Double valorTotalComprado; |
||
| 8 | private Integer quantidadeVendas; |
||
| 9 | private Integer quantidadeEstoqueLocal; |
||
| 10 | private Integer quantidadeEstoqueGeral; |
||
| 11 | |||
| 588 | blopes | 12 | private Integer quantidadeTotalVendas; |
| 13 | private Integer quantidadeTotalEstoqueLocal; |
||
| 14 | private Integer quantidadeTotalEstoqueGeral; |
||
| 15 | |||
| 16 | private Integer quantidadeParaTransferir; |
||
| 17 | |||
| 561 | blopes | 18 | public RankingModeloDTO() {} |
| 19 | |||
| 20 | public static String CONSULTA_DTO_COMPLETA = "e.sequencial, e.login, e.nome"; |
||
| 21 | public RankingModeloDTO(ModeloDTO modelo, Integer quantidadeVendas, Integer quantidadeEstoqueGeral) { |
||
| 22 | this.modelo = modelo; |
||
| 23 | this.quantidadeVendas = quantidadeVendas; |
||
| 24 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
||
| 25 | } |
||
| 26 | |||
| 27 | public RankingModeloDTO(ModeloDTO modelo, Double valorTotalVendido, Double valorTotalComprado, Integer quantidadeVendas, Integer quantidadeEstoqueGeral) { |
||
| 28 | this.modelo = modelo; |
||
| 29 | this.valorTotalVendido = valorTotalVendido; |
||
| 30 | this.valorTotalComprado = valorTotalComprado; |
||
| 31 | this.quantidadeVendas = quantidadeVendas; |
||
| 32 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
||
| 33 | } |
||
| 34 | |||
| 35 | public RankingModeloDTO(ModeloDTO modelo, Double valorTotalVendido, Double valorTotalComprado, Integer quantidadeVendas, Integer quantidadeEstoqueLocal, Integer quantidadeEstoqueGeral) { |
||
| 36 | this.modelo = modelo; |
||
| 37 | this.valorTotalVendido = valorTotalVendido; |
||
| 38 | this.valorTotalComprado = valorTotalComprado; |
||
| 39 | this.quantidadeVendas = quantidadeVendas; |
||
| 40 | this.quantidadeEstoqueLocal = quantidadeEstoqueLocal; |
||
| 41 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
||
| 42 | } |
||
| 43 | |||
| 44 | public ModeloDTO getModelo() { |
||
| 45 | return modelo; |
||
| 46 | } |
||
| 47 | public void setModelo(ModeloDTO modelo) { |
||
| 48 | this.modelo = modelo; |
||
| 49 | } |
||
| 50 | |||
| 51 | public Double getValorTotalVendido() { |
||
| 52 | return valorTotalVendido; |
||
| 53 | } |
||
| 54 | public void setValorTotalVendido(Double valorTotalVendido) { |
||
| 55 | this.valorTotalVendido = valorTotalVendido; |
||
| 56 | } |
||
| 57 | |||
| 58 | public Double getValorTotalComprado() { |
||
| 59 | return valorTotalComprado; |
||
| 60 | } |
||
| 61 | public void setValorTotalComprado(Double valorTotalComprado) { |
||
| 62 | this.valorTotalComprado = valorTotalComprado; |
||
| 63 | } |
||
| 64 | |||
| 65 | public Integer getQuantidadeVendas() { |
||
| 66 | return quantidadeVendas; |
||
| 67 | } |
||
| 68 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 69 | this.quantidadeVendas = quantidadeVendas; |
||
| 70 | } |
||
| 71 | |||
| 72 | public Integer getQuantidadeEstoqueLocal() { |
||
| 73 | return quantidadeEstoqueLocal; |
||
| 74 | } |
||
| 75 | public void setQuantidadeEstoqueLocal(Integer quantidadeEstoqueLocal) { |
||
| 76 | this.quantidadeEstoqueLocal = quantidadeEstoqueLocal; |
||
| 77 | } |
||
| 78 | |||
| 79 | public Integer getQuantidadeEstoqueGeral() { |
||
| 80 | return quantidadeEstoqueGeral; |
||
| 81 | } |
||
| 82 | public void setQuantidadeEstoqueGeral(Integer quantidadeEstoqueGeral) { |
||
| 83 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
||
| 84 | } |
||
| 85 | |||
| 588 | blopes | 86 | public Integer getQuantidadeTotalVendas() { |
| 87 | return quantidadeTotalVendas; |
||
| 88 | } |
||
| 89 | public void setQuantidadeTotalVendas(Integer quantidadeTotalVendas) { |
||
| 90 | this.quantidadeTotalVendas = quantidadeTotalVendas; |
||
| 91 | } |
||
| 92 | |||
| 93 | public Integer getQuantidadeTotalEstoqueLocal() { |
||
| 94 | return quantidadeTotalEstoqueLocal; |
||
| 95 | } |
||
| 96 | public void setQuantidadeTotalEstoqueLocal(Integer quantidadeTotalEstoqueLocal) { |
||
| 97 | this.quantidadeTotalEstoqueLocal = quantidadeTotalEstoqueLocal; |
||
| 98 | } |
||
| 99 | |||
| 100 | public Integer getQuantidadeTotalEstoqueGeral() { |
||
| 101 | return quantidadeTotalEstoqueGeral; |
||
| 102 | } |
||
| 103 | public void setQuantidadeTotalEstoqueGeral(Integer quantidadeTotalEstoqueGeral) { |
||
| 104 | this.quantidadeTotalEstoqueGeral = quantidadeTotalEstoqueGeral; |
||
| 105 | } |
||
| 106 | |||
| 107 | public Integer getQuantidadeParaTransferir() { |
||
| 108 | return quantidadeParaTransferir; |
||
| 109 | } |
||
| 110 | public void setQuantidadeParaTransferir(Integer quantidadeParaTransferir) { |
||
| 111 | this.quantidadeParaTransferir = quantidadeParaTransferir; |
||
| 112 | } |
||
| 113 | |||
| 561 | blopes | 114 | @Override |
| 115 | public int compareTo(RankingModeloDTO rankingModeloDTO) { |
||
| 116 | return rankingModeloDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
||
| 117 | } |
||
| 118 | |||
| 588 | blopes | 119 | public Integer quantidadeParaTransferir() { |
| 120 | Double quantidadeParaTransferir = 0.0; |
||
| 121 | quantidadeParaTransferir = quantidadeParaTransferir + getQuantidadeVendas(); |
||
| 122 | quantidadeParaTransferir = quantidadeParaTransferir / getQuantidadeTotalVendas(); |
||
| 123 | quantidadeParaTransferir = quantidadeParaTransferir * getQuantidadeTotalEstoqueLocal(); |
||
| 124 | quantidadeParaTransferir = quantidadeParaTransferir - getQuantidadeEstoqueLocal(); |
||
| 125 | return quantidadeParaTransferir.intValue(); |
||
| 126 | } |
||
| 127 | |||
| 128 | public String corQuantidadeParaTransferir() { |
||
| 129 | return (quantidadeParaTransferir()) > 0? "green" : "red"; |
||
| 130 | } |
||
| 131 | |||
| 561 | blopes | 132 | } |