| 30652 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
|
|
2 |
|
|
|
3 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
|
|
4 |
|
|
|
5 |
import javax.persistence.*;
|
|
|
6 |
import java.time.LocalDateTime;
|
|
|
7 |
import java.util.Objects;
|
|
|
8 |
|
| 31008 |
amit.gupta |
9 |
@Entity
|
|
|
10 |
@Table(name = "fofo.offer_payout", schema = "fofo")
|
|
|
11 |
@NamedQueries({
|
|
|
12 |
@NamedQuery(name = "OfferPayout.selectPaidOffers", query = "select new com.spice.profitmandi.service.transaction.InventoryMarginModel("
|
|
|
13 |
+ " o.retailerId, li.sgstRate, li.cgstRate, li.igstRate," +
|
|
|
14 |
" cast(case when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp is null then op.amount " +
|
|
|
15 |
" when op.createTimestamp between :startDate and :endDate and op.rejectTimestamp between :startDate and :endDate then 0" +
|
|
|
16 |
" when op.rejectTimestamp between :startDate and :endDate then -op.amount" +
|
|
|
17 |
" else 0 end as float), lii.serialNumber, op.description, o.invoiceNumber, " +
|
|
|
18 |
" case when op.rejectTimestamp between :startDate and :endDate then op.rejectTimestamp else op.createTimestamp end) from "
|
|
|
19 |
+ " OfferPayout op join LineItemImei lii on (op.serialNumber=lii.serialNumber) join LineItem li on li.id=lii.lineItemId "
|
|
|
20 |
+ " join Order o on (o.retailerId=op.fofoId and o.billingTimestamp is not null and o.id=li.orderId) "
|
|
|
21 |
+ " where op.createTimestamp >= :cnDate and ((op.createTimestamp between :startDate and :endDate) or (op.rejectTimestamp between :startDate and :endDate))"
|
| 31139 |
amit.gupta |
22 |
+ " and lii.id=(select max(lii2.id) from LineItemImei lii2 join LineItem li2 on li2.id=lii2.lineItemId join Order o2 on o2.id=li2.orderId where lii2.serialNumber=lii.serialNumber and o2.retailerId=op.fofoId)")
|
| 31008 |
amit.gupta |
23 |
})
|
| 30652 |
amit.gupta |
24 |
public class OfferPayout {
|
|
|
25 |
@Id
|
|
|
26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
27 |
private long id;
|
|
|
28 |
@Column(name = "fofo_id", nullable = false)
|
|
|
29 |
private long fofoId;
|
|
|
30 |
@Column(name = "offer_id", nullable = false)
|
|
|
31 |
private long offerId;
|
|
|
32 |
@Column(name = "criteria_id", nullable = false)
|
|
|
33 |
private long criteriaId;
|
|
|
34 |
@Column(name = "slab_amount", nullable = false)
|
|
|
35 |
private double slabAmount;
|
|
|
36 |
@Column(name = "serial_number", nullable = false)
|
|
|
37 |
private String serialNumber;
|
|
|
38 |
@Column(name = "amount", nullable = false)
|
|
|
39 |
private double amount;
|
|
|
40 |
@Column(name = "status", nullable = false)
|
|
|
41 |
@Enumerated(EnumType.STRING)
|
|
|
42 |
private SchemePayoutStatus status;
|
|
|
43 |
@Column(name = "description", nullable = false)
|
|
|
44 |
private String description;
|
| 31008 |
amit.gupta |
45 |
@Column(name = "inventory_item_id", nullable = false)
|
|
|
46 |
private int inventoryItemId;
|
| 30652 |
amit.gupta |
47 |
|
| 31008 |
amit.gupta |
48 |
@Override
|
|
|
49 |
public String toString() {
|
|
|
50 |
return "OfferPayout{" +
|
|
|
51 |
"id=" + id +
|
|
|
52 |
", fofoId=" + fofoId +
|
|
|
53 |
", offerId=" + offerId +
|
|
|
54 |
", criteriaId=" + criteriaId +
|
|
|
55 |
", slabAmount=" + slabAmount +
|
|
|
56 |
", serialNumber='" + serialNumber + '\'' +
|
|
|
57 |
", amount=" + amount +
|
|
|
58 |
", status=" + status +
|
|
|
59 |
", description='" + description + '\'' +
|
|
|
60 |
", inventoryItemId=" + inventoryItemId +
|
|
|
61 |
", createTimestamp=" + createTimestamp +
|
|
|
62 |
", rejectTimestamp=" + rejectTimestamp +
|
|
|
63 |
'}';
|
|
|
64 |
}
|
| 30996 |
amit.gupta |
65 |
|
| 31008 |
amit.gupta |
66 |
public int getInventoryItemId() {
|
|
|
67 |
return inventoryItemId;
|
| 30996 |
amit.gupta |
68 |
}
|
|
|
69 |
|
| 31008 |
amit.gupta |
70 |
public void setInventoryItemId(int inventoryItemId) {
|
|
|
71 |
this.inventoryItemId = inventoryItemId;
|
|
|
72 |
}
|
|
|
73 |
|
| 30996 |
amit.gupta |
74 |
@Override
|
|
|
75 |
public boolean equals(Object o) {
|
|
|
76 |
if (this == o) return true;
|
|
|
77 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
78 |
OfferPayout that = (OfferPayout) o;
|
| 31008 |
amit.gupta |
79 |
return id == that.id && fofoId == that.fofoId && offerId == that.offerId && criteriaId == that.criteriaId && Double.compare(that.slabAmount, slabAmount) == 0 && Double.compare(that.amount, amount) == 0 && inventoryItemId == that.inventoryItemId && Objects.equals(serialNumber, that.serialNumber) && status == that.status && Objects.equals(description, that.description) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(rejectTimestamp, that.rejectTimestamp);
|
| 30996 |
amit.gupta |
80 |
}
|
|
|
81 |
|
| 31008 |
amit.gupta |
82 |
@Override
|
|
|
83 |
public int hashCode() {
|
|
|
84 |
return Objects.hash(id, fofoId, offerId, criteriaId, slabAmount, serialNumber, amount, status, description, inventoryItemId, createTimestamp, rejectTimestamp);
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
@Column(name = "create_timestamp", nullable = false)
|
|
|
88 |
private LocalDateTime createTimestamp;
|
|
|
89 |
@Column(name = "reject_timestamp")
|
|
|
90 |
private LocalDateTime rejectTimestamp;
|
|
|
91 |
|
|
|
92 |
public OfferPayout() {
|
|
|
93 |
|
|
|
94 |
}
|
|
|
95 |
|
| 30652 |
amit.gupta |
96 |
public OfferPayout(long fofoId, long offerId, long criteriaId, double slabAmount, String serialNumber, double amount, SchemePayoutStatus status, String description, LocalDateTime createTimestamp) {
|
|
|
97 |
this.fofoId = fofoId;
|
|
|
98 |
this.offerId = offerId;
|
|
|
99 |
this.criteriaId = criteriaId;
|
|
|
100 |
this.slabAmount = slabAmount;
|
|
|
101 |
this.serialNumber = serialNumber;
|
|
|
102 |
this.amount = amount;
|
|
|
103 |
this.status = status;
|
|
|
104 |
this.description = description;
|
|
|
105 |
this.createTimestamp = createTimestamp;
|
|
|
106 |
}
|
|
|
107 |
|
| 30996 |
amit.gupta |
108 |
public LocalDateTime getCreateTimestamp() {
|
|
|
109 |
return createTimestamp;
|
| 30652 |
amit.gupta |
110 |
}
|
|
|
111 |
|
| 30996 |
amit.gupta |
112 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
113 |
this.createTimestamp = createTimestamp;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
public LocalDateTime getRejectTimestamp() {
|
|
|
117 |
return rejectTimestamp;
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
public void setRejectTimestamp(LocalDateTime rejectTimestamp) {
|
|
|
121 |
this.rejectTimestamp = rejectTimestamp;
|
|
|
122 |
}
|
|
|
123 |
|
| 30652 |
amit.gupta |
124 |
public long getId() {
|
|
|
125 |
return id;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
public void setId(long id) {
|
|
|
129 |
this.id = id;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
public long getFofoId() {
|
|
|
133 |
return fofoId;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
public void setFofoId(long fofoId) {
|
|
|
137 |
this.fofoId = fofoId;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
public long getOfferId() {
|
|
|
141 |
return offerId;
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
public void setOfferId(long offerId) {
|
|
|
145 |
this.offerId = offerId;
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
public long getCriteriaId() {
|
|
|
149 |
return criteriaId;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
public void setCriteriaId(long criteriaId) {
|
|
|
153 |
this.criteriaId = criteriaId;
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
public double getSlabAmount() {
|
|
|
157 |
return slabAmount;
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
public void setSlabAmount(double slabAmount) {
|
|
|
161 |
this.slabAmount = slabAmount;
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
public String getSerialNumber() {
|
|
|
165 |
return serialNumber;
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
public void setSerialNumber(String serialNumber) {
|
|
|
169 |
this.serialNumber = serialNumber;
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
public double getAmount() {
|
|
|
173 |
return amount;
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
public void setAmount(double amount) {
|
|
|
177 |
this.amount = amount;
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
public SchemePayoutStatus getStatus() {
|
|
|
181 |
return status;
|
|
|
182 |
}
|
|
|
183 |
|
|
|
184 |
public void setStatus(SchemePayoutStatus status) {
|
|
|
185 |
this.status = status;
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
public String getDescription() {
|
|
|
189 |
return description;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
public void setDescription(String description) {
|
|
|
193 |
this.description = description;
|
|
|
194 |
}
|
|
|
195 |
}
|