| 33795 |
ranu |
1 |
package com.spice.profitmandi.dao.entity.catalog;
|
|
|
2 |
|
| 33838 |
ranu |
3 |
import com.spice.profitmandi.common.enumuration.UpgradeOfferPaymentStatus;
|
|
|
4 |
|
| 33795 |
ranu |
5 |
import javax.persistence.*;
|
|
|
6 |
import java.time.LocalDateTime;
|
|
|
7 |
import java.util.Objects;
|
|
|
8 |
|
|
|
9 |
@Entity
|
|
|
10 |
@Table(name = "catalog.upgrade_offer")
|
| 33838 |
ranu |
11 |
@NamedQueries({
|
|
|
12 |
@NamedQuery(name = "UpgradeOffer.selectUpgradeOfferGroupByYearMonth", query = "select new com.spice.profitmandi.dao.model.PendingPaymentUpgradeOfferModel(" +
|
|
|
13 |
" sum(cast(coi.schemePayout as long)),cast(fo.fofoId as int), u.name, uo.paymentStatus,uo.customerOfferItemId, DATE_FORMAT(uo.createdTimestamp, '%m-%Y')) " +
|
|
|
14 |
" from UpgradeOffer uo" +
|
|
|
15 |
" JOIN CustomerOfferItem coi on uo.customerOfferItemId = coi.id" +
|
|
|
16 |
" JOIN FofoOrder fo on fo.id = uo.orderId" +
|
|
|
17 |
" JOIN userUser u on u.id = fo.fofoId" +
|
|
|
18 |
" where fo.fofoId = (:fofoId) and uo.paymentStatus = :status and uo.createdTimestamp >= :startDate" +
|
|
|
19 |
" group by DATE_FORMAT(uo.createdTimestamp, '%m-%Y')"),
|
|
|
20 |
|
|
|
21 |
// @NamedQuery(name = "UpgradeOffer.selectUpgradeOfferBeforeSixMonth", query = "select new com.spice.profitmandi.dao.model.PendingPaymentUpgradeOfferModel(" +
|
|
|
22 |
// " sum(coi.schemePayout),fo.fofoId, u.name, uo.paymentStatus,uo.customerOfferItemId, DATE_FORMAT(uo.createdTimestamp, '%m-%Y')) " +
|
|
|
23 |
// " from UpgradeOffer uo" +
|
|
|
24 |
// " JOIN CustomerOfferItem coi on uo.customerOfferItemId = coi.id" +
|
|
|
25 |
// " JOIN FofoOrder fo on fo.id = uo.orderId" +
|
|
|
26 |
// " JOIN userUser u on u.id = fo.fofoId" +
|
|
|
27 |
// " where fo.fofoId = (:fofoId) and uo.paymentStatus = 'PENDING' and uo.createdTimestamp <= :endDate ")
|
|
|
28 |
})
|
| 33795 |
ranu |
29 |
public class UpgradeOffer {
|
|
|
30 |
|
|
|
31 |
@Id
|
|
|
32 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
33 |
private int id;
|
|
|
34 |
|
|
|
35 |
@Column(name = "order_id")
|
|
|
36 |
private int orderId;
|
|
|
37 |
|
|
|
38 |
@Column(name = "item_id")
|
|
|
39 |
private int itemId;
|
|
|
40 |
|
|
|
41 |
@Column(name = "serial_number")
|
|
|
42 |
private String serialNumber;
|
|
|
43 |
|
|
|
44 |
@Column(name = "customer_offer_item_id")
|
|
|
45 |
private int customerOfferItemId;
|
|
|
46 |
|
|
|
47 |
@Column(name = "created_timestamp")
|
|
|
48 |
private LocalDateTime createdTimestamp;
|
|
|
49 |
|
| 33838 |
ranu |
50 |
@Column(name = "payment_status")
|
|
|
51 |
private UpgradeOfferPaymentStatus paymentStatus;
|
|
|
52 |
|
|
|
53 |
@Column(name = "status_description")
|
|
|
54 |
private String statusDescription;
|
|
|
55 |
|
| 33795 |
ranu |
56 |
public int getId() {
|
|
|
57 |
return id;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
public void setId(int id) {
|
|
|
61 |
this.id = id;
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public int getOrderId() {
|
|
|
65 |
return orderId;
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
public void setOrderId(int orderId) {
|
|
|
69 |
this.orderId = orderId;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public String getSerialNumber() {
|
|
|
73 |
return serialNumber;
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
public void setSerialNumber(String serialNumber) {
|
|
|
77 |
this.serialNumber = serialNumber;
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
public int getCustomerOfferItemId() {
|
|
|
81 |
return customerOfferItemId;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
public void setCustomerOfferItemId(int customerOfferItemId) {
|
|
|
85 |
this.customerOfferItemId = customerOfferItemId;
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
89 |
return createdTimestamp;
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
93 |
this.createdTimestamp = createdTimestamp;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public int getItemId() {
|
|
|
97 |
return itemId;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public void setItemId(int itemId) {
|
|
|
101 |
this.itemId = itemId;
|
|
|
102 |
}
|
|
|
103 |
|
| 33838 |
ranu |
104 |
public UpgradeOfferPaymentStatus getPaymentStatus() {
|
|
|
105 |
return paymentStatus;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
public void setPaymentStatus(UpgradeOfferPaymentStatus paymentStatus) {
|
|
|
109 |
this.paymentStatus = paymentStatus;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
public String getStatusDescription() {
|
|
|
113 |
return statusDescription;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
public void setStatusDescription(String statusDescription) {
|
|
|
117 |
this.statusDescription = statusDescription;
|
|
|
118 |
}
|
|
|
119 |
|
| 33795 |
ranu |
120 |
@Override
|
|
|
121 |
public boolean equals(Object o) {
|
|
|
122 |
if (this == o) return true;
|
|
|
123 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
124 |
UpgradeOffer that = (UpgradeOffer) o;
|
| 33838 |
ranu |
125 |
return id == that.id && orderId == that.orderId && itemId == that.itemId && customerOfferItemId == that.customerOfferItemId && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(createdTimestamp, that.createdTimestamp) && paymentStatus == that.paymentStatus && Objects.equals(statusDescription, that.statusDescription);
|
| 33795 |
ranu |
126 |
}
|
|
|
127 |
|
|
|
128 |
@Override
|
|
|
129 |
public int hashCode() {
|
| 33838 |
ranu |
130 |
return Objects.hash(id, orderId, itemId, serialNumber, customerOfferItemId, createdTimestamp, paymentStatus, statusDescription);
|
| 33795 |
ranu |
131 |
}
|
|
|
132 |
|
|
|
133 |
@Override
|
|
|
134 |
public String toString() {
|
|
|
135 |
return "UpgradeOffer{" +
|
|
|
136 |
"id=" + id +
|
|
|
137 |
", orderId=" + orderId +
|
|
|
138 |
", itemId=" + itemId +
|
|
|
139 |
", serialNumber='" + serialNumber + '\'' +
|
|
|
140 |
", customerOfferItemId=" + customerOfferItemId +
|
|
|
141 |
", createdTimestamp=" + createdTimestamp +
|
| 33838 |
ranu |
142 |
", paymentStatus=" + paymentStatus +
|
|
|
143 |
", statusDescription='" + statusDescription + '\'' +
|
| 33795 |
ranu |
144 |
'}';
|
|
|
145 |
}
|
|
|
146 |
}
|