Subversion Repositories SmartDukaan

Rev

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