| 31903 |
amit.gupta |
1 |
package com.spice.profitmandi.service.scheme;
|
|
|
2 |
|
|
|
3 |
import com.spice.profitmandi.dao.entity.fofo.OfferPayout;
|
|
|
4 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 31920 |
amit.gupta |
5 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
|
|
6 |
import com.spice.profitmandi.dao.model.AmountModel;
|
| 31903 |
amit.gupta |
7 |
|
|
|
8 |
import java.util.List;
|
|
|
9 |
import java.util.Objects;
|
|
|
10 |
|
|
|
11 |
public class InventoryPayoutModel {
|
| 33459 |
amit.gupta |
12 |
|
|
|
13 |
public float getPriceDropAmount() {
|
|
|
14 |
return priceDropAmount;
|
|
|
15 |
}
|
|
|
16 |
|
|
|
17 |
public void setPriceDropAmount(float priceDropAmount) {
|
|
|
18 |
this.priceDropAmount = priceDropAmount;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
float priceDropAmount;
|
| 31903 |
amit.gupta |
22 |
int inventoryItemId;
|
| 32165 |
amit.gupta |
23 |
List<SchemeInOut> paidSios;
|
|
|
24 |
List<SchemeInOut> pendingSios;
|
| 31903 |
amit.gupta |
25 |
List<OfferPayout> offerPayouts;
|
|
|
26 |
|
| 33459 |
amit.gupta |
27 |
|
| 31903 |
amit.gupta |
28 |
private double fixedAmount;
|
| 33459 |
amit.gupta |
29 |
private double discountAmount;
|
|
|
30 |
|
|
|
31 |
public double getDiscountAmount() {
|
|
|
32 |
return discountAmount;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
public void setDiscountAmount(double discountAmount) {
|
|
|
36 |
this.discountAmount = discountAmount;
|
|
|
37 |
}
|
|
|
38 |
|
| 31903 |
amit.gupta |
39 |
private double percentageAmount;
|
|
|
40 |
private double paidAmount;
|
| 31914 |
amit.gupta |
41 |
private double dp;
|
| 31903 |
amit.gupta |
42 |
|
| 32165 |
amit.gupta |
43 |
public List<SchemeInOut> getPendingSios() {
|
|
|
44 |
return pendingSios;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public void setPendingSios(List<SchemeInOut> pendingSios) {
|
|
|
48 |
this.pendingSios = pendingSios;
|
|
|
49 |
}
|
|
|
50 |
|
| 31989 |
amit.gupta |
51 |
public double getActualRolloutAmount() {
|
|
|
52 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
| 32021 |
amit.gupta |
53 |
double value = effectiveDp * percentageAmount / (100 + percentageAmount);
|
| 33459 |
amit.gupta |
54 |
return this.getFixedAmount() + value + this.getDiscountAmount();
|
| 31989 |
amit.gupta |
55 |
}
|
| 31903 |
amit.gupta |
56 |
|
| 31989 |
amit.gupta |
57 |
|
| 31920 |
amit.gupta |
58 |
public double getRolloutAmount(AmountModel amountModel) {
|
|
|
59 |
double rollout = 0;
|
|
|
60 |
if (amountModel.getAmountType().equals(AmountType.PERCENTAGE)) {
|
|
|
61 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
|
|
62 |
double totalPercentage = this.getPercentageAmount() + amountModel.getAmount();
|
|
|
63 |
rollout = effectiveDp * (totalPercentage / (100 + totalPercentage) - (this.getPercentageAmount() / (100 + this.getPercentageAmount())));
|
|
|
64 |
} else {
|
| 32021 |
amit.gupta |
65 |
if (amountModel.isDiscount()) {
|
|
|
66 |
rollout = amountModel.getAmount();
|
|
|
67 |
} else {
|
|
|
68 |
rollout = amountModel.getAmount() * (100 / (100 + this.getPercentageAmount()));
|
|
|
69 |
}
|
| 31920 |
amit.gupta |
70 |
}
|
|
|
71 |
return rollout;
|
|
|
72 |
}
|
|
|
73 |
|
| 33459 |
amit.gupta |
74 |
public InventoryPayoutModel(int inventoryItemId, float priceDropAmount, List<SchemeInOut> paidSios, List<SchemeInOut> pendingSios, List<OfferPayout> offerPayouts) {
|
| 31903 |
amit.gupta |
75 |
this.inventoryItemId = inventoryItemId;
|
| 32165 |
amit.gupta |
76 |
this.paidSios = paidSios;
|
|
|
77 |
this.pendingSios = pendingSios;
|
| 31903 |
amit.gupta |
78 |
this.offerPayouts = offerPayouts;
|
| 33459 |
amit.gupta |
79 |
this.priceDropAmount = priceDropAmount;
|
| 31903 |
amit.gupta |
80 |
}
|
|
|
81 |
|
|
|
82 |
public double getPercentageAmount() {
|
|
|
83 |
return percentageAmount;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void setPercentageAmount(double percentageAmount) {
|
|
|
87 |
this.percentageAmount = percentageAmount;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public double getPaidAmount() {
|
| 31989 |
amit.gupta |
91 |
return this.paidAmount;
|
| 31903 |
amit.gupta |
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setPaidAmount(double paidAmount) {
|
|
|
95 |
this.paidAmount = paidAmount;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public double getFixedAmount() {
|
| 31990 |
amit.gupta |
99 |
return this.fixedAmount;
|
| 31903 |
amit.gupta |
100 |
}
|
|
|
101 |
|
|
|
102 |
public void setFixedAmount(double fixedAmount) {
|
|
|
103 |
this.fixedAmount = fixedAmount;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public int getInventoryItemId() {
|
|
|
107 |
return inventoryItemId;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public void setInventoryItemId(int inventoryItemId) {
|
|
|
111 |
this.inventoryItemId = inventoryItemId;
|
|
|
112 |
}
|
|
|
113 |
|
| 32165 |
amit.gupta |
114 |
public List<SchemeInOut> getPaidSios() {
|
|
|
115 |
return paidSios;
|
| 31903 |
amit.gupta |
116 |
}
|
|
|
117 |
|
| 32165 |
amit.gupta |
118 |
public void setPaidSios(List<SchemeInOut> paidSios) {
|
|
|
119 |
this.paidSios = paidSios;
|
| 31903 |
amit.gupta |
120 |
}
|
|
|
121 |
|
|
|
122 |
public List<OfferPayout> getOfferPayouts() {
|
|
|
123 |
return offerPayouts;
|
|
|
124 |
}
|
|
|
125 |
|
| 31914 |
amit.gupta |
126 |
public double getDp() {
|
|
|
127 |
return dp;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
public void setDp(double dp) {
|
|
|
131 |
this.dp = dp;
|
|
|
132 |
}
|
|
|
133 |
|
| 31903 |
amit.gupta |
134 |
public void setOfferPayouts(List<OfferPayout> offerPayouts) {
|
|
|
135 |
this.offerPayouts = offerPayouts;
|
|
|
136 |
}
|
| 33459 |
amit.gupta |
137 |
|
|
|
138 |
@Override
|
|
|
139 |
public boolean equals(Object o) {
|
|
|
140 |
if (this == o) return true;
|
|
|
141 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
142 |
InventoryPayoutModel that = (InventoryPayoutModel) o;
|
|
|
143 |
return Float.compare(priceDropAmount, that.priceDropAmount) == 0 && inventoryItemId == that.inventoryItemId && Double.compare(fixedAmount, that.fixedAmount) == 0 && Double.compare(discountAmount, that.discountAmount) == 0 && Double.compare(percentageAmount, that.percentageAmount) == 0 && Double.compare(paidAmount, that.paidAmount) == 0 && Double.compare(dp, that.dp) == 0 && Objects.equals(paidSios, that.paidSios) && Objects.equals(pendingSios, that.pendingSios) && Objects.equals(offerPayouts, that.offerPayouts);
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
@Override
|
|
|
147 |
public int hashCode() {
|
|
|
148 |
return Objects.hash(priceDropAmount, inventoryItemId, paidSios, pendingSios, offerPayouts, fixedAmount, discountAmount, percentageAmount, paidAmount, dp);
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
@Override
|
|
|
152 |
public String toString() {
|
|
|
153 |
return "InventoryPayoutModel{" +
|
|
|
154 |
"priceDropAmount=" + priceDropAmount +
|
|
|
155 |
", inventoryItemId=" + inventoryItemId +
|
|
|
156 |
", paidSios=" + paidSios +
|
|
|
157 |
", pendingSios=" + pendingSios +
|
|
|
158 |
", offerPayouts=" + offerPayouts +
|
|
|
159 |
", fixedAmount=" + fixedAmount +
|
|
|
160 |
", discountAmount=" + discountAmount +
|
|
|
161 |
", percentageAmount=" + percentageAmount +
|
|
|
162 |
", paidAmount=" + paidAmount +
|
|
|
163 |
", dp=" + dp +
|
|
|
164 |
'}';
|
|
|
165 |
}
|
| 31903 |
amit.gupta |
166 |
}
|