Subversion Repositories SmartDukaan

Rev

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