| 27878 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.model;
|
|
|
2 |
|
| 30670 |
amit.gupta |
3 |
import com.fasterxml.jackson.annotation.JsonIgnore;
|
| 27878 |
amit.gupta |
4 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
|
|
5 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
|
|
6 |
import com.spice.profitmandi.service.offers.PayoutSlab;
|
|
|
7 |
|
| 30651 |
amit.gupta |
8 |
import java.util.List;
|
|
|
9 |
|
| 27878 |
amit.gupta |
10 |
public class ItemCriteriaPayout {
|
|
|
11 |
private AmountType amountType;
|
| 30651 |
amit.gupta |
12 |
private ItemCriteria itemCriteria;
|
|
|
13 |
private List<PayoutSlab> payoutSlabs;
|
|
|
14 |
private String itemCriteriaString;
|
|
|
15 |
private long achievedValue;
|
|
|
16 |
private long shortValue;
|
|
|
17 |
private PayoutSlab currentSlab;
|
|
|
18 |
private PayoutSlab nextSlab;
|
| 27878 |
amit.gupta |
19 |
|
| 30670 |
amit.gupta |
20 |
@JsonIgnore
|
| 30651 |
amit.gupta |
21 |
public String getCurretPayoutString() {
|
|
|
22 |
String templateString = null;
|
|
|
23 |
if (this.getAmountType().equals(AmountType.FIXED)) {
|
|
|
24 |
templateString = "Rs. %f per pc";
|
|
|
25 |
} else if (this.getAmountType().equals(AmountType.PERCENTAGE)) {
|
|
|
26 |
templateString = "%f %%";
|
|
|
27 |
} else {
|
|
|
28 |
templateString = "%f %%";
|
|
|
29 |
}
|
|
|
30 |
return String.format(templateString, this.getCurrentSlab().getPayoutAmount());
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
public long getShortValue() {
|
| 29785 |
amit.gupta |
34 |
return shortValue;
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
public void setShortValue(long shortValue) {
|
|
|
39 |
this.shortValue = shortValue;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
public PayoutSlab getCurrentSlab() {
|
|
|
44 |
return currentSlab;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
public void setCurrentSlab(PayoutSlab currentSlab) {
|
|
|
49 |
this.currentSlab = currentSlab;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
public PayoutSlab getNextSlab() {
|
|
|
54 |
return nextSlab;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
public void setNextSlab(PayoutSlab nextSlab) {
|
|
|
59 |
this.nextSlab = nextSlab;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
public ItemCriteria getItemCriteria() {
|
| 27878 |
amit.gupta |
64 |
return itemCriteria;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
public AmountType getAmountType() {
|
|
|
69 |
return amountType;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
public void setAmountType(AmountType amountType) {
|
|
|
75 |
this.amountType = amountType;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
| 29785 |
amit.gupta |
80 |
public long getAchievedValue() {
|
|
|
81 |
return achievedValue;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
public void setAchievedValue(long achievedValue) {
|
|
|
86 |
this.achievedValue = achievedValue;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
|
| 27878 |
amit.gupta |
90 |
public String getItemCriteriaString() {
|
|
|
91 |
return itemCriteriaString;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setItemCriteriaString(String itemCriteriaString) {
|
|
|
95 |
this.itemCriteriaString = itemCriteriaString;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
@Override
|
|
|
99 |
public int hashCode() {
|
|
|
100 |
final int prime = 31;
|
|
|
101 |
int result = 1;
|
|
|
102 |
result = prime * result + ((amountType == null) ? 0 : amountType.hashCode());
|
| 29785 |
amit.gupta |
103 |
result = prime * result + ((currentSlab == null) ? 0 : currentSlab.hashCode());
|
| 27878 |
amit.gupta |
104 |
result = prime * result + ((itemCriteria == null) ? 0 : itemCriteria.hashCode());
|
|
|
105 |
result = prime * result + ((itemCriteriaString == null) ? 0 : itemCriteriaString.hashCode());
|
|
|
106 |
return result;
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
@Override
|
|
|
112 |
public boolean equals(Object obj) {
|
|
|
113 |
if (this == obj)
|
|
|
114 |
return true;
|
|
|
115 |
if (obj == null)
|
|
|
116 |
return false;
|
|
|
117 |
if (getClass() != obj.getClass())
|
|
|
118 |
return false;
|
|
|
119 |
ItemCriteriaPayout other = (ItemCriteriaPayout) obj;
|
|
|
120 |
if (amountType != other.amountType)
|
|
|
121 |
return false;
|
| 29785 |
amit.gupta |
122 |
if (currentSlab == null) {
|
|
|
123 |
if (other.currentSlab != null)
|
|
|
124 |
return false;
|
|
|
125 |
} else if (!currentSlab.equals(other.currentSlab))
|
|
|
126 |
return false;
|
| 27878 |
amit.gupta |
127 |
if (itemCriteria == null) {
|
|
|
128 |
if (other.itemCriteria != null)
|
|
|
129 |
return false;
|
|
|
130 |
} else if (!itemCriteria.equals(other.itemCriteria))
|
|
|
131 |
return false;
|
|
|
132 |
if (itemCriteriaString == null) {
|
|
|
133 |
if (other.itemCriteriaString != null)
|
|
|
134 |
return false;
|
|
|
135 |
} else if (!itemCriteriaString.equals(other.itemCriteriaString))
|
|
|
136 |
return false;
|
|
|
137 |
return true;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
public void setItemCriteria(ItemCriteria itemCriteria) {
|
|
|
141 |
this.itemCriteria = itemCriteria;
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
public List<PayoutSlab> getPayoutSlabs() {
|
|
|
145 |
return payoutSlabs;
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
public void setPayoutSlabs(List<PayoutSlab> payoutSlabs) {
|
|
|
149 |
this.payoutSlabs = payoutSlabs;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
@Override
|
|
|
155 |
public String toString() {
|
|
|
156 |
return "ItemCriteriaPayout [amountType=" + amountType + ", itemCriteria=" + itemCriteria + ", payoutSlabs="
|
| 29785 |
amit.gupta |
157 |
+ payoutSlabs + ", itemCriteriaString=" + itemCriteriaString + ", achievedValue=" + achievedValue
|
|
|
158 |
+ ", shortValue=" + shortValue + ", currentSlab=" + currentSlab + ", nextSlab=" + nextSlab + "]";
|
| 27878 |
amit.gupta |
159 |
}
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
}
|