Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
21714 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
21596 ashik.ali 2
 
3
import java.io.Serializable;
25726 amit.gupta 4
import java.time.LocalDate;
21596 ashik.ali 5
import java.time.LocalDateTime;
22243 ashik.ali 6
import java.time.format.DateTimeFormatter;
21596 ashik.ali 7
 
8
import javax.persistence.Column;
22009 ashik.ali 9
import javax.persistence.Convert;
21596 ashik.ali 10
import javax.persistence.Entity;
11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
27579 tejbeer 14
import javax.persistence.NamedQueries;
15
import javax.persistence.NamedQuery;
21596 ashik.ali 16
import javax.persistence.Table;
25083 amit.gupta 17
import javax.persistence.Transient;
21596 ashik.ali 18
 
22009 ashik.ali 19
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
20
 
21596 ashik.ali 21
@Entity
27579 tejbeer 22
@Table(name = "fofo.fofo_order", schema = "fofo")
21596 ashik.ali 23
 
27579 tejbeer 24
@NamedQueries({
25
 
26
		@NamedQuery(name = "FofoOrder.SelectItemWiseTertiary", query = "select new com.spice.profitmandi.dao.model.ItemWiseTertiaryModel(foi.brand,"
27586 tejbeer 27
				+ "foi.modelName, foi.modelNumber, foi.color, foi.quantity, foi.mop)"
27579 tejbeer 28
				+ " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId where fo.cancelledTimestamp is null and fo.fofoId = :fofoId"
29
				+ " and fo.createTimestamp between :startDate and :endDate"),
30
 
31
})
32
public class FofoOrder implements Serializable {
33
 
21596 ashik.ali 34
	private static final long serialVersionUID = 1L;
35
 
36
	@Id
37
	@Column(name = "id")
38
	@GeneratedValue(strategy = GenerationType.IDENTITY)
39
	private int id;
27579 tejbeer 40
 
21596 ashik.ali 41
	@Column(name = "fofo_id")
42
	private int fofoId;
27579 tejbeer 43
 
21596 ashik.ali 44
	@Column(name = "customer_id")
45
	private int customerId;
27579 tejbeer 46
 
21710 ashik.ali 47
	@Column(name = "customer_address_id")
48
	private int customerAddressId;
27579 tejbeer 49
 
23369 ashik.ali 50
	@Column(name = "customer_gst_number")
51
	private String customerGstNumber;
27579 tejbeer 52
 
21596 ashik.ali 53
	@Column(name = "total_amount")
54
	private float totalAmount;
27579 tejbeer 55
 
21609 ashik.ali 56
	@Column(name = "invoice_number", length = 50)
21596 ashik.ali 57
	private String invoiceNumber;
27579 tejbeer 58
 
22859 ashik.ali 59
	@Column(name = "cashback")
60
	private float cashback;
27579 tejbeer 61
 
22009 ashik.ali 62
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21596 ashik.ali 63
	@Column(name = "create_timestamp")
27579 tejbeer 64
	private LocalDateTime createTimestamp = LocalDateTime.now();
65
 
24264 amit.gupta 66
	@Convert(converter = LocalDateTimeAttributeConverter.class)
67
	@Column(name = "cancelled_timestamp")
27579 tejbeer 68
	private LocalDateTime cancelledTimestamp;
69
 
70
	// @Convert(converter = LocalDateTimeAttributeConverter.class)
71
	// @Column(name = "billing_timestamp")
25083 amit.gupta 72
	@Transient
27579 tejbeer 73
	private LocalDateTime billingTimestamp;
74
 
26817 amit.gupta 75
	@Transient
25083 amit.gupta 76
	private FofoOrderItem orderItem;
27579 tejbeer 77
 
25726 amit.gupta 78
	@Transient
79
	private LocalDate dateOfBirth;
27579 tejbeer 80
 
25726 amit.gupta 81
	public LocalDate getDateOfBirth() {
82
		return dateOfBirth;
83
	}
27579 tejbeer 84
 
25726 amit.gupta 85
	public void setDateOfBirth(LocalDate dateOfBirth) {
86
		this.dateOfBirth = dateOfBirth;
87
	}
27579 tejbeer 88
 
25083 amit.gupta 89
	public FofoOrderItem getOrderItem() {
90
		return orderItem;
91
	}
27579 tejbeer 92
 
25083 amit.gupta 93
	public void setOrderItem(FofoOrderItem orderItem) {
94
		this.orderItem = orderItem;
95
	}
27579 tejbeer 96
 
24264 amit.gupta 97
	public LocalDateTime getCancelledTimestamp() {
98
		return cancelledTimestamp;
99
	}
27579 tejbeer 100
 
24264 amit.gupta 101
	public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
102
		this.cancelledTimestamp = cancelledTimestamp;
103
	}
27579 tejbeer 104
 
21984 kshitij.so 105
	public int getId() {
106
		return id;
107
	}
27579 tejbeer 108
 
21984 kshitij.so 109
	public void setId(int id) {
110
		this.id = id;
111
	}
27579 tejbeer 112
 
21984 kshitij.so 113
	public int getFofoId() {
114
		return fofoId;
115
	}
27579 tejbeer 116
 
21984 kshitij.so 117
	public void setFofoId(int fofoId) {
118
		this.fofoId = fofoId;
119
	}
27579 tejbeer 120
 
21984 kshitij.so 121
	public int getCustomerId() {
122
		return customerId;
123
	}
27579 tejbeer 124
 
21984 kshitij.so 125
	public void setCustomerId(int customerId) {
126
		this.customerId = customerId;
127
	}
27579 tejbeer 128
 
21984 kshitij.so 129
	public int getCustomerAddressId() {
130
		return customerAddressId;
131
	}
27579 tejbeer 132
 
21984 kshitij.so 133
	public void setCustomerAddressId(int customerAddressId) {
134
		this.customerAddressId = customerAddressId;
135
	}
27579 tejbeer 136
 
23369 ashik.ali 137
	public String getCustomerGstNumber() {
138
		return customerGstNumber;
139
	}
27579 tejbeer 140
 
23369 ashik.ali 141
	public void setCustomerGstNumber(String customerGstNumber) {
142
		this.customerGstNumber = customerGstNumber;
143
	}
27579 tejbeer 144
 
21984 kshitij.so 145
	public float getTotalAmount() {
146
		return totalAmount;
147
	}
27579 tejbeer 148
 
21984 kshitij.so 149
	public void setTotalAmount(float totalAmount) {
150
		this.totalAmount = totalAmount;
151
	}
27579 tejbeer 152
 
21984 kshitij.so 153
	public String getInvoiceNumber() {
154
		return invoiceNumber;
155
	}
27579 tejbeer 156
 
21984 kshitij.so 157
	public void setInvoiceNumber(String invoiceNumber) {
158
		this.invoiceNumber = invoiceNumber;
159
	}
27579 tejbeer 160
 
22859 ashik.ali 161
	public float getCashback() {
162
		return cashback;
163
	}
27579 tejbeer 164
 
22859 ashik.ali 165
	public void setCashback(float cashback) {
166
		this.cashback = cashback;
167
	}
27579 tejbeer 168
 
21984 kshitij.so 169
	public LocalDateTime getCreateTimestamp() {
170
		return createTimestamp;
171
	}
27579 tejbeer 172
 
21984 kshitij.so 173
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
174
		this.createTimestamp = createTimestamp;
175
	}
27579 tejbeer 176
 
177
	public String getFormattedDate() {
178
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
22243 ashik.ali 179
		return this.createTimestamp.format(formatter);
27579 tejbeer 180
	}
181
 
21924 ashik.ali 182
	@Override
22009 ashik.ali 183
	public int hashCode() {
184
		final int prime = 31;
185
		int result = 1;
26817 amit.gupta 186
		result = prime * result + ((billingTimestamp == null) ? 0 : billingTimestamp.hashCode());
187
		result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
188
		result = prime * result + Float.floatToIntBits(cashback);
189
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
190
		result = prime * result + customerAddressId;
191
		result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
192
		result = prime * result + customerId;
193
		result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
194
		result = prime * result + fofoId;
22009 ashik.ali 195
		result = prime * result + id;
26817 amit.gupta 196
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
197
		result = prime * result + ((orderItem == null) ? 0 : orderItem.hashCode());
198
		result = prime * result + Float.floatToIntBits(totalAmount);
22009 ashik.ali 199
		return result;
200
	}
27579 tejbeer 201
 
22009 ashik.ali 202
	@Override
203
	public boolean equals(Object obj) {
204
		if (this == obj)
205
			return true;
206
		if (obj == null)
207
			return false;
208
		if (getClass() != obj.getClass())
209
			return false;
210
		FofoOrder other = (FofoOrder) obj;
26817 amit.gupta 211
		if (billingTimestamp == null) {
212
			if (other.billingTimestamp != null)
213
				return false;
214
		} else if (!billingTimestamp.equals(other.billingTimestamp))
215
			return false;
216
		if (cancelledTimestamp == null) {
217
			if (other.cancelledTimestamp != null)
218
				return false;
219
		} else if (!cancelledTimestamp.equals(other.cancelledTimestamp))
220
			return false;
221
		if (Float.floatToIntBits(cashback) != Float.floatToIntBits(other.cashback))
222
			return false;
223
		if (createTimestamp == null) {
224
			if (other.createTimestamp != null)
225
				return false;
226
		} else if (!createTimestamp.equals(other.createTimestamp))
227
			return false;
228
		if (customerAddressId != other.customerAddressId)
229
			return false;
230
		if (customerGstNumber == null) {
231
			if (other.customerGstNumber != null)
232
				return false;
233
		} else if (!customerGstNumber.equals(other.customerGstNumber))
234
			return false;
235
		if (customerId != other.customerId)
236
			return false;
237
		if (dateOfBirth == null) {
238
			if (other.dateOfBirth != null)
239
				return false;
240
		} else if (!dateOfBirth.equals(other.dateOfBirth))
241
			return false;
242
		if (fofoId != other.fofoId)
243
			return false;
22009 ashik.ali 244
		if (id != other.id)
245
			return false;
26817 amit.gupta 246
		if (invoiceNumber == null) {
247
			if (other.invoiceNumber != null)
248
				return false;
249
		} else if (!invoiceNumber.equals(other.invoiceNumber))
250
			return false;
251
		if (orderItem == null) {
252
			if (other.orderItem != null)
253
				return false;
254
		} else if (!orderItem.equals(other.orderItem))
255
			return false;
256
		if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))
257
			return false;
22009 ashik.ali 258
		return true;
259
	}
27586 tejbeer 260
 
22009 ashik.ali 261
	@Override
21602 ashik.ali 262
	public String toString() {
21710 ashik.ali 263
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
23369 ashik.ali 264
				+ customerAddressId + ", customerGstNumber=" + customerGstNumber + ", totalAmount=" + totalAmount
265
				+ ", invoiceNumber=" + invoiceNumber + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp
26817 amit.gupta 266
				+ ", cancelledTimestamp=" + cancelledTimestamp + ", billingTimestamp=" + billingTimestamp
267
				+ ", orderItem=" + orderItem + ", dateOfBirth=" + dateOfBirth + "]";
21602 ashik.ali 268
	}
27586 tejbeer 269
 
21596 ashik.ali 270
}