| Line 4... |
Line 4... |
| 4 |
|
4 |
|
| 5 |
import javax.persistence.*;
|
5 |
import javax.persistence.*;
|
| 6 |
import java.time.LocalDateTime;
|
6 |
import java.time.LocalDateTime;
|
| 7 |
import java.util.Objects;
|
7 |
import java.util.Objects;
|
| 8 |
|
8 |
|
| - |
|
9 |
@Entity
|
| 9 |
@Entity(name = "fofo.offer_payout")
|
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))"
|
| - |
|
22 |
+ " and lii.id=(select max(lii2.id) from LineItemImei lii2 where lii2.serialNumber=lii.serialNumber)")
|
| - |
|
23 |
})
|
| 10 |
public class OfferPayout {
|
24 |
public class OfferPayout {
|
| 11 |
@Id
|
25 |
@Id
|
| 12 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 13 |
private long id;
|
27 |
private long id;
|
| 14 |
@Column(name = "fofo_id", nullable = false)
|
28 |
@Column(name = "fofo_id", nullable = false)
|
| Line 26... |
Line 40... |
| 26 |
@Column(name = "status", nullable = false)
|
40 |
@Column(name = "status", nullable = false)
|
| 27 |
@Enumerated(EnumType.STRING)
|
41 |
@Enumerated(EnumType.STRING)
|
| 28 |
private SchemePayoutStatus status;
|
42 |
private SchemePayoutStatus status;
|
| 29 |
@Column(name = "description", nullable = false)
|
43 |
@Column(name = "description", nullable = false)
|
| 30 |
private String description;
|
44 |
private String description;
|
| 31 |
@Column(name = "create_timestamp", nullable = false)
|
45 |
@Column(name = "inventory_item_id", nullable = false)
|
| 32 |
private LocalDateTime createTimestamp;
|
46 |
private int inventoryItemId;
|
| 33 |
@Column(name = "reject_timestamp")
|
- |
|
| 34 |
private LocalDateTime rejectTimestamp;
|
- |
|
| 35 |
|
47 |
|
| - |
|
48 |
@Override
|
| - |
|
49 |
public String toString() {
|
| 36 |
public OfferPayout() {
|
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 |
}
|
| - |
|
65 |
|
| - |
|
66 |
public int getInventoryItemId() {
|
| - |
|
67 |
return inventoryItemId;
|
| - |
|
68 |
}
|
| 37 |
|
69 |
|
| - |
|
70 |
public void setInventoryItemId(int inventoryItemId) {
|
| - |
|
71 |
this.inventoryItemId = inventoryItemId;
|
| 38 |
}
|
72 |
}
|
| 39 |
|
73 |
|
| 40 |
@Override
|
74 |
@Override
|
| 41 |
public boolean equals(Object o) {
|
75 |
public boolean equals(Object o) {
|
| 42 |
if (this == o) return true;
|
76 |
if (this == o) return true;
|
| 43 |
if (o == null || getClass() != o.getClass()) return false;
|
77 |
if (o == null || getClass() != o.getClass()) return false;
|
| 44 |
OfferPayout that = (OfferPayout) o;
|
78 |
OfferPayout that = (OfferPayout) o;
|
| 45 |
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 && Objects.equals(serialNumber, that.serialNumber) && status == that.status && Objects.equals(description, that.description) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(rejectTimestamp, that.rejectTimestamp);
|
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);
|
| - |
|
80 |
}
|
| - |
|
81 |
|
| - |
|
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 |
|
| 46 |
}
|
94 |
}
|
| 47 |
|
95 |
|
| 48 |
public OfferPayout(long fofoId, long offerId, long criteriaId, double slabAmount, String serialNumber, double amount, SchemePayoutStatus status, String description, LocalDateTime createTimestamp) {
|
96 |
public OfferPayout(long fofoId, long offerId, long criteriaId, double slabAmount, String serialNumber, double amount, SchemePayoutStatus status, String description, LocalDateTime createTimestamp) {
|
| 49 |
this.fofoId = fofoId;
|
97 |
this.fofoId = fofoId;
|
| 50 |
this.offerId = offerId;
|
98 |
this.offerId = offerId;
|
| Line 55... |
Line 103... |
| 55 |
this.status = status;
|
103 |
this.status = status;
|
| 56 |
this.description = description;
|
104 |
this.description = description;
|
| 57 |
this.createTimestamp = createTimestamp;
|
105 |
this.createTimestamp = createTimestamp;
|
| 58 |
}
|
106 |
}
|
| 59 |
|
107 |
|
| 60 |
@Override
|
- |
|
| 61 |
public int hashCode() {
|
- |
|
| 62 |
return Objects.hash(id, fofoId, offerId, criteriaId, slabAmount, serialNumber, amount, status, description, createTimestamp, rejectTimestamp);
|
- |
|
| 63 |
}
|
- |
|
| 64 |
|
- |
|
| 65 |
@Override
|
- |
|
| 66 |
public String toString() {
|
- |
|
| 67 |
return "OfferPayout{" +
|
- |
|
| 68 |
"id=" + id +
|
- |
|
| 69 |
", fofoId=" + fofoId +
|
- |
|
| 70 |
", offerId=" + offerId +
|
- |
|
| 71 |
", criteriaId=" + criteriaId +
|
- |
|
| 72 |
", slabAmount=" + slabAmount +
|
- |
|
| 73 |
", serialNumber='" + serialNumber + '\'' +
|
- |
|
| 74 |
", amount=" + amount +
|
- |
|
| 75 |
", status=" + status +
|
- |
|
| 76 |
", description='" + description + '\'' +
|
- |
|
| 77 |
", createTimestamp=" + createTimestamp +
|
- |
|
| 78 |
", rejectTimestamp=" + rejectTimestamp +
|
- |
|
| 79 |
'}';
|
- |
|
| 80 |
}
|
- |
|
| 81 |
|
- |
|
| 82 |
public LocalDateTime getCreateTimestamp() {
|
108 |
public LocalDateTime getCreateTimestamp() {
|
| 83 |
return createTimestamp;
|
109 |
return createTimestamp;
|
| 84 |
}
|
110 |
}
|
| 85 |
|
111 |
|
| 86 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
112 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|