| 21716 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.transaction;
|
| 21545 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
|
|
|
6 |
import javax.persistence.Column;
|
| 22009 |
ashik.ali |
7 |
import javax.persistence.Convert;
|
| 21545 |
ashik.ali |
8 |
import javax.persistence.Entity;
|
| 21819 |
amit.gupta |
9 |
import javax.persistence.EnumType;
|
|
|
10 |
import javax.persistence.Enumerated;
|
| 21545 |
ashik.ali |
11 |
import javax.persistence.GeneratedValue;
|
|
|
12 |
import javax.persistence.GenerationType;
|
|
|
13 |
import javax.persistence.Id;
|
|
|
14 |
import javax.persistence.NamedQueries;
|
|
|
15 |
import javax.persistence.NamedQuery;
|
|
|
16 |
import javax.persistence.Table;
|
|
|
17 |
|
| 22009 |
ashik.ali |
18 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
|
|
19 |
|
| 21716 |
ashik.ali |
20 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| 21545 |
ashik.ali |
21 |
|
|
|
22 |
/**
|
|
|
23 |
* This class basically contains transaction details
|
|
|
24 |
*
|
|
|
25 |
* @author ashikali
|
|
|
26 |
*
|
|
|
27 |
*/
|
|
|
28 |
@Entity
|
|
|
29 |
@Table(name="transaction.transaction", schema = "transaction")
|
|
|
30 |
@NamedQueries({
|
|
|
31 |
@NamedQuery(name = "Transaction.selectCount", query = "select count(t) from Transaction t"),
|
|
|
32 |
@NamedQuery(name = "Transaction.selectCountByRetailerId", query = "select count(t) from Transaction t where t.retailerId = :retailerId"),
|
|
|
33 |
@NamedQuery(name="Transaction.selectAll", query="select t from Transaction t"),
|
| 21809 |
amit.gupta |
34 |
//and t.status in (1,2,4,5,6)
|
| 22013 |
amit.gupta |
35 |
@NamedQuery(name = "Transaction.selectIdsByRetailerId", query = "select t.id from Transaction t where t.retailerId = :retailerId and t.status != 0 order by t.id desc"),
|
| 21545 |
ashik.ali |
36 |
@NamedQuery(
|
|
|
37 |
name = "Transaction.selectByIds",
|
|
|
38 |
query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
|
|
|
39 |
+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
|
| 22420 |
ashik.ali |
40 |
+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name, o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status, i.catalogItemId from Transaction t join Order o on o.transactionId = t.id "
|
| 23134 |
ashik.ali |
41 |
+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId join Item i on i.id = li.itemId where t.id in :ids and o.status not in(0,1) order by t.id desc")
|
| 21545 |
ashik.ali |
42 |
})
|
|
|
43 |
|
|
|
44 |
public class Transaction implements Serializable{
|
|
|
45 |
|
|
|
46 |
private static final long serialVersionUID = 1L;
|
|
|
47 |
|
|
|
48 |
public Transaction() {
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
@Id
|
|
|
52 |
@Column(name="id", unique=true, updatable=false)
|
|
|
53 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
54 |
private int id;
|
|
|
55 |
|
| 22009 |
ashik.ali |
56 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
57 |
@Column(name = "createdOn")
|
|
|
58 |
private LocalDateTime createTimestamp;
|
|
|
59 |
|
| 21819 |
amit.gupta |
60 |
@Enumerated(EnumType.ORDINAL)
|
| 21545 |
ashik.ali |
61 |
@Column(name = "status")
|
|
|
62 |
private TransactionStatus status;
|
|
|
63 |
|
|
|
64 |
@Column(name = "status_message", length = 100)
|
|
|
65 |
private String statusMessage;
|
|
|
66 |
|
|
|
67 |
@Column(name = "customer_id")
|
|
|
68 |
private int retailerId;
|
|
|
69 |
|
|
|
70 |
@Column(name = "shopping_cart_id")
|
|
|
71 |
private int shoppingCartId;
|
|
|
72 |
|
|
|
73 |
@Column(name = "coupon_code", length = 20)
|
|
|
74 |
private String couponCode;
|
|
|
75 |
|
|
|
76 |
@Column(name = "session_source", length = 100)
|
|
|
77 |
private String sessionSource;
|
|
|
78 |
|
| 22009 |
ashik.ali |
79 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
80 |
@Column(name = "session_start_time")
|
|
|
81 |
private LocalDateTime sessionStateTime;
|
|
|
82 |
|
|
|
83 |
@Column(name = "first_source")
|
|
|
84 |
private String firstSource;
|
|
|
85 |
|
| 22009 |
ashik.ali |
86 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
87 |
@Column(name = "first_source_start_time")
|
|
|
88 |
private LocalDateTime firstSourceStateTime;
|
|
|
89 |
|
|
|
90 |
@Column(name = "totalShippingCost")
|
|
|
91 |
private float totalShippingCost;
|
|
|
92 |
|
|
|
93 |
@Column(name = "totalCodCharges")
|
|
|
94 |
private float totalCodCharges;
|
|
|
95 |
|
|
|
96 |
@Column(name = "payment_option")
|
|
|
97 |
private int paymentOption;
|
|
|
98 |
|
|
|
99 |
public int getId() {
|
|
|
100 |
return id;
|
|
|
101 |
}
|
|
|
102 |
public void setId(int id) {
|
|
|
103 |
this.id = id;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
public LocalDateTime getCreateTimestamp() {
|
|
|
108 |
return createTimestamp;
|
|
|
109 |
}
|
|
|
110 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
111 |
this.createTimestamp = createTimestamp;
|
|
|
112 |
}
|
|
|
113 |
public TransactionStatus getStatus() {
|
|
|
114 |
return status;
|
|
|
115 |
}
|
|
|
116 |
public void setStatus(TransactionStatus status) {
|
|
|
117 |
this.status = status;
|
|
|
118 |
}
|
|
|
119 |
public String getStatusMessage() {
|
|
|
120 |
return statusMessage;
|
|
|
121 |
}
|
|
|
122 |
public void setStatusMessage(String statusMessage) {
|
|
|
123 |
this.statusMessage = statusMessage;
|
|
|
124 |
}
|
|
|
125 |
public int getRetailerId() {
|
|
|
126 |
return retailerId;
|
|
|
127 |
}
|
|
|
128 |
public void setRetailerId(int retailerId) {
|
|
|
129 |
this.retailerId = retailerId;
|
|
|
130 |
}
|
|
|
131 |
public int getShoppingCartId() {
|
|
|
132 |
return shoppingCartId;
|
|
|
133 |
}
|
|
|
134 |
public void setShoppingCartId(int shoppingCartId) {
|
|
|
135 |
this.shoppingCartId = shoppingCartId;
|
|
|
136 |
}
|
|
|
137 |
public String getCouponCode() {
|
|
|
138 |
return couponCode;
|
|
|
139 |
}
|
|
|
140 |
public void setCouponCode(String couponCode) {
|
|
|
141 |
this.couponCode = couponCode;
|
|
|
142 |
}
|
|
|
143 |
public String getSessionSource() {
|
|
|
144 |
return sessionSource;
|
|
|
145 |
}
|
|
|
146 |
public void setSessionSource(String sessionSource) {
|
|
|
147 |
this.sessionSource = sessionSource;
|
|
|
148 |
}
|
|
|
149 |
public LocalDateTime getSessionStateTime() {
|
|
|
150 |
return sessionStateTime;
|
|
|
151 |
}
|
|
|
152 |
public void setSessionStateTime(LocalDateTime sessionStateTime) {
|
|
|
153 |
this.sessionStateTime = sessionStateTime;
|
|
|
154 |
}
|
|
|
155 |
public String getFirstSource() {
|
|
|
156 |
return firstSource;
|
|
|
157 |
}
|
|
|
158 |
public void setFirstSource(String firstSource) {
|
|
|
159 |
this.firstSource = firstSource;
|
|
|
160 |
}
|
|
|
161 |
public LocalDateTime getFirstSourceStateTime() {
|
|
|
162 |
return firstSourceStateTime;
|
|
|
163 |
}
|
|
|
164 |
public void setFirstSourceStateTime(LocalDateTime firstSourceStateTime) {
|
|
|
165 |
this.firstSourceStateTime = firstSourceStateTime;
|
|
|
166 |
}
|
|
|
167 |
public float getTotalShippingCost() {
|
|
|
168 |
return totalShippingCost;
|
|
|
169 |
}
|
|
|
170 |
public void setTotalShippingCost(float totalShippingCost) {
|
|
|
171 |
this.totalShippingCost = totalShippingCost;
|
|
|
172 |
}
|
|
|
173 |
public float getTotalCodCharges() {
|
|
|
174 |
return totalCodCharges;
|
|
|
175 |
}
|
|
|
176 |
public void setTotalCodCharges(float totalCodCharges) {
|
|
|
177 |
this.totalCodCharges = totalCodCharges;
|
|
|
178 |
}
|
|
|
179 |
public int getPaymentOption() {
|
|
|
180 |
return paymentOption;
|
|
|
181 |
}
|
|
|
182 |
public void setPaymentOption(int paymentOption) {
|
|
|
183 |
this.paymentOption = paymentOption;
|
|
|
184 |
}
|
|
|
185 |
|
| 21924 |
ashik.ali |
186 |
|
| 21545 |
ashik.ali |
187 |
@Override
|
| 21924 |
ashik.ali |
188 |
public int hashCode() {
|
|
|
189 |
final int prime = 31;
|
|
|
190 |
int result = 1;
|
|
|
191 |
result = prime * result + id;
|
|
|
192 |
return result;
|
|
|
193 |
}
|
|
|
194 |
@Override
|
|
|
195 |
public boolean equals(Object obj) {
|
|
|
196 |
if (this == obj)
|
|
|
197 |
return true;
|
|
|
198 |
if (obj == null)
|
|
|
199 |
return false;
|
|
|
200 |
if (getClass() != obj.getClass())
|
|
|
201 |
return false;
|
|
|
202 |
Transaction other = (Transaction) obj;
|
|
|
203 |
if (id != other.id)
|
|
|
204 |
return false;
|
|
|
205 |
return true;
|
|
|
206 |
}
|
|
|
207 |
@Override
|
| 21545 |
ashik.ali |
208 |
public String toString() {
|
|
|
209 |
return "Transaction [createTimestamp=" + createTimestamp + ", status=" + status + ", statusMessage="
|
|
|
210 |
+ statusMessage + ", retailerId=" + retailerId + ", shoppingCartId=" + shoppingCartId + ", couponCode="
|
|
|
211 |
+ couponCode + ", sessionSource=" + sessionSource + ", sessionStateTime=" + sessionStateTime
|
|
|
212 |
+ ", firstSource=" + firstSource + ", firstSourceStateTime=" + firstSourceStateTime
|
|
|
213 |
+ ", totalShippingCost=" + totalShippingCost + ", totalCodCharges=" + totalCodCharges
|
|
|
214 |
+ ", paymentOption=" + paymentOption + "]";
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
}
|