Subversion Repositories SmartDukaan

Rev

Rev 33213 | 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;
33213 tejus.loha 86
 
87
	@Column(name = "createdBy")
88
	private int createdBy;
89
 
34373 tejus.loha 90
	@Column(name = "addId", length = 10)
91
	private int addId;
92
 
93
	public void setAddId(int addId) {
94
		this.addId = addId;
95
	}
96
 
97
	public int getAddId() {
98
		return addId;
99
	}
100
 
33213 tejus.loha 101
	public int getCreatedBy() {
102
		return createdBy;
103
	}
104
 
105
	public void setCreatedBy(int createdBy) {
106
		this.createdBy = createdBy;
107
	}
21545 ashik.ali 108
	public int getId() {
109
		return id;
110
	}
111
	public void setId(int id) {
112
		this.id = id;
113
	}
114
	public LocalDateTime getCreateTimestamp() {
115
		return createTimestamp;
116
	}
117
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
118
		this.createTimestamp = createTimestamp;
119
	}
120
	public TransactionStatus getStatus() {
121
		return status;
122
	}
123
	public void setStatus(TransactionStatus status) {
124
		this.status = status;
125
	}
126
	public String getStatusMessage() {
127
		return statusMessage;
128
	}
129
	public void setStatusMessage(String statusMessage) {
130
		this.statusMessage = statusMessage;
131
	}
132
	public int getRetailerId() {
133
		return retailerId;
134
	}
135
	public void setRetailerId(int retailerId) {
136
		this.retailerId = retailerId;
137
	}
138
	public int getShoppingCartId() {
139
		return shoppingCartId;
140
	}
141
	public void setShoppingCartId(int shoppingCartId) {
142
		this.shoppingCartId = shoppingCartId;
143
	}
144
	public String getCouponCode() {
145
		return couponCode;
146
	}
147
	public void setCouponCode(String couponCode) {
148
		this.couponCode = couponCode;
149
	}
150
	public String getSessionSource() {
151
		return sessionSource;
152
	}
153
	public void setSessionSource(String sessionSource) {
154
		this.sessionSource = sessionSource;
155
	}
156
	public LocalDateTime getSessionStateTime() {
157
		return sessionStateTime;
158
	}
159
	public void setSessionStateTime(LocalDateTime sessionStateTime) {
160
		this.sessionStateTime = sessionStateTime;
161
	}
162
	public String getFirstSource() {
163
		return firstSource;
164
	}
165
	public void setFirstSource(String firstSource) {
166
		this.firstSource = firstSource;
167
	}
168
	public LocalDateTime getFirstSourceStateTime() {
169
		return firstSourceStateTime;
170
	}
171
	public void setFirstSourceStateTime(LocalDateTime firstSourceStateTime) {
172
		this.firstSourceStateTime = firstSourceStateTime;
173
	}
174
	public float getTotalShippingCost() {
175
		return totalShippingCost;
176
	}
177
	public void setTotalShippingCost(float totalShippingCost) {
178
		this.totalShippingCost = totalShippingCost;
179
	}
180
	public float getTotalCodCharges() {
181
		return totalCodCharges;
182
	}
183
	public void setTotalCodCharges(float totalCodCharges) {
184
		this.totalCodCharges = totalCodCharges;
185
	}
186
	public int getPaymentOption() {
187
		return paymentOption;
188
	}
189
	public void setPaymentOption(int paymentOption) {
190
		this.paymentOption = paymentOption;
191
	}
192
 
21924 ashik.ali 193
 
21545 ashik.ali 194
	@Override
21924 ashik.ali 195
	public int hashCode() {
196
		final int prime = 31;
197
		int result = 1;
198
		result = prime * result + id;
199
		return result;
200
	}
201
	@Override
202
	public boolean equals(Object obj) {
203
		if (this == obj)
204
			return true;
205
		if (obj == null)
206
			return false;
207
		if (getClass() != obj.getClass())
208
			return false;
209
		Transaction other = (Transaction) obj;
210
		if (id != other.id)
211
			return false;
212
		return true;
213
	}
214
	@Override
21545 ashik.ali 215
	public String toString() {
216
		return "Transaction [createTimestamp=" + createTimestamp + ", status=" + status + ", statusMessage="
217
				+ statusMessage + ", retailerId=" + retailerId + ", shoppingCartId=" + shoppingCartId + ", couponCode="
218
				+ couponCode + ", sessionSource=" + sessionSource + ", sessionStateTime=" + sessionStateTime
219
				+ ", firstSource=" + firstSource + ", firstSourceStateTime=" + firstSourceStateTime
220
				+ ", totalShippingCost=" + totalShippingCost + ", totalCodCharges=" + totalCodCharges
221
				+ ", paymentOption=" + paymentOption + "]";
222
	}
223
 
224
 
225
}