Rev 561 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 561 | Rev 588 | ||
|---|---|---|---|
| Line 6... | Line 6... | ||
| 6 | private Double valorTotalVendido; |
6 | private Double valorTotalVendido; |
| 7 | private Double valorTotalComprado; |
7 | private Double valorTotalComprado; |
| 8 | private Integer quantidadeVendas; |
8 | private Integer quantidadeVendas; |
| 9 | private Integer quantidadeEstoqueLocal; |
9 | private Integer quantidadeEstoqueLocal; |
| 10 | private Integer quantidadeEstoqueGeral; |
10 | private Integer quantidadeEstoqueGeral; |
| - | 11 | ||
| - | 12 | private Integer quantidadeTotalVendas; |
|
| - | 13 | private Integer quantidadeTotalEstoqueLocal; |
|
| - | 14 | private Integer quantidadeTotalEstoqueGeral; |
|
| - | 15 | ||
| - | 16 | private Integer quantidadeParaTransferir; |
|
| 11 | 17 | ||
| 12 | public RankingModeloDTO() {} |
18 | public RankingModeloDTO() {} |
| 13 | 19 | ||
| 14 | public static String CONSULTA_DTO_COMPLETA = "e.sequencial, e.login, e.nome"; |
20 | public static String CONSULTA_DTO_COMPLETA = "e.sequencial, e.login, e.nome"; |
| 15 | public RankingModeloDTO(ModeloDTO modelo, Integer quantidadeVendas, Integer quantidadeEstoqueGeral) { |
21 | public RankingModeloDTO(ModeloDTO modelo, Integer quantidadeVendas, Integer quantidadeEstoqueGeral) { |
| Line 73... | Line 79... | ||
| 73 | public Integer getQuantidadeEstoqueGeral() { |
79 | public Integer getQuantidadeEstoqueGeral() { |
| 74 | return quantidadeEstoqueGeral; |
80 | return quantidadeEstoqueGeral; |
| 75 | }
|
81 | }
|
| 76 | public void setQuantidadeEstoqueGeral(Integer quantidadeEstoqueGeral) { |
82 | public void setQuantidadeEstoqueGeral(Integer quantidadeEstoqueGeral) { |
| 77 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
83 | this.quantidadeEstoqueGeral = quantidadeEstoqueGeral; |
| - | 84 | }
|
|
| - | 85 | ||
| - | 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; |
|
| 78 | }
|
112 | }
|
| 79 | 113 | ||
| 80 | @Override |
114 | @Override |
| 81 | public int compareTo(RankingModeloDTO rankingModeloDTO) { |
115 | public int compareTo(RankingModeloDTO rankingModeloDTO) { |
| 82 | return rankingModeloDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
116 | return rankingModeloDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
| - | 117 | }
|
|
| - | 118 | ||
| - | 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"; |
|
| 83 | }
|
130 | }
|
| 84 | 131 | ||
| 85 | }
|
132 | }
|