Subversion Repositories SmartDukaan

Rev

Rev 23134 | Rev 33213 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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