Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
26332 amit.gupta 1
 
21714 ashik.ali 2
package com.spice.profitmandi.dao.entity.fofo;
21596 ashik.ali 3
 
35065 aman 4
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
5
 
6
import javax.persistence.*;
21596 ashik.ali 7
import java.io.Serializable;
23019 ashik.ali 8
import java.time.LocalDateTime;
21687 ashik.ali 9
import java.util.Set;
21596 ashik.ali 10
 
11
@Entity
31860 tejbeer 12
@Table(name = "fofo.fofo_order_item", uniqueConstraints = {
28566 tejbeer 13
		@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }) })
31285 tejbeer 14
 
15
@NamedQueries({
16
		@NamedQuery(name = "FofoOrderItem.selectPartnerMonthlySale", query = "select new com.spice.profitmandi.dao.model.PartnerMonthlySaleModel(fo.fofoId, "
17
				+ " DATE_FORMAT(foi.createTimestamp, '%m-%Y'),sum(CAST(foi.quantity*foi.mop  AS int))) from  FofoOrder fo join FofoOrderItem foi on "
18
				+ " fo.id = foi.orderId  where fo.fofoId in :fofoIds and fo.cancelledTimestamp is null "
19
				+ " and foi.createTimestamp >= :startDate"
35065 aman 20
				+ " group by fo.fofoId,DATE_FORMAT(foi.createTimestamp, '%m-%Y')"),
21
		@NamedQuery(
22
				name = "FofoOrderItem.selectPartnerBrandItemMonthlySale",
23
				query = "select new com.spice.profitmandi.dao.model.BrandItemWisePartnerSaleModel( " +
24
						"foi.brand, " +
25
						"foi.modelName, " +
26
						"foi.modelNumber, " +
27
						"sum(foi.quantity)) " +
28
						"from FofoOrder fo " +
29
						"join FofoOrderItem foi on fo.id = foi.orderId " +
30
						"join Catalog ca on ca.modelNumber = foi.modelNumber " +
31
						"where fo.fofoId in :fofoIds " +
32
						"and foi.brand =:brand " +
33
						"and fo.cancelledTimestamp is null " +
34
						"and foi.createTimestamp >= :startDate " +
35084 aman 35
						"and foi.createTimestamp < :endDate " +
36
						"and ca.categoryId =  10006 " +
37
						"group by foi.brand, foi.modelName, foi.modelNumber,ca.categoryId, fo.fofoId,DATE_FORMAT(foi.createTimestamp, '%m-%Y')"
35065 aman 38
		),
39
 
40
})
28566 tejbeer 41
public class FofoOrderItem implements Serializable {
21596 ashik.ali 42
 
43
	private static final long serialVersionUID = 1L;
44
 
45
	@Id
46
	@Column(name = "id")
47
	@GeneratedValue(strategy = GenerationType.IDENTITY)
48
	private int id;
28566 tejbeer 49
 
21596 ashik.ali 50
	@Column(name = "order_id")
51
	private int orderId;
28566 tejbeer 52
 
34287 vikas.jang 53
	@Column(name = "pending_order_item_id")
54
	private int pendingOrderItemId;
55
 
21596 ashik.ali 56
	@Column(name = "item_id")
57
	private int itemId;
28566 tejbeer 58
 
21596 ashik.ali 59
	@Column(name = "quantity")
60
	private int quantity;
28566 tejbeer 61
 
21596 ashik.ali 62
	@Column(name = "selling_price")
63
	private float sellingPrice;
28566 tejbeer 64
 
21710 ashik.ali 65
	@Column(name = "cost")
66
	private float cost;
28566 tejbeer 67
 
26332 amit.gupta 68
	@Column(name = "mop")
69
	private float mop;
28566 tejbeer 70
 
21895 ashik.ali 71
	@Column(name = "igst_rate")
72
	private float igstRate;
28566 tejbeer 73
 
21895 ashik.ali 74
	@Column(name = "cgst_rate")
75
	private float cgstRate;
28566 tejbeer 76
 
21895 ashik.ali 77
	@Column(name = "sgst_rate")
78
	private float sgstRate;
28566 tejbeer 79
 
21895 ashik.ali 80
	@Column(name = "hsn_code")
81
	private String hsnCode;
28566 tejbeer 82
 
21596 ashik.ali 83
	@Column(name = "dp")
84
	private float dp;
28566 tejbeer 85
 
21596 ashik.ali 86
	@Column(name = "brand")
87
	private String brand;
28566 tejbeer 88
 
21596 ashik.ali 89
	@Column(name = "model_name")
90
	private String modelName;
28566 tejbeer 91
 
21596 ashik.ali 92
	@Column(name = "model_number")
93
	private String modelNumber;
28566 tejbeer 94
 
21596 ashik.ali 95
	@Column(name = "color")
96
	private String color;
28566 tejbeer 97
 
22580 ashik.ali 98
	@Column(name = "discount")
99
	private float discount;
28566 tejbeer 100
 
24094 amit.gupta 101
	@Transient
102
	private boolean doa;
28566 tejbeer 103
 
104
	@Transient
105
	private String itemName;
106
 
24094 amit.gupta 107
	public boolean isDoa() {
108
		return doa;
109
	}
28566 tejbeer 110
 
111
	public String getItemName() {
112
		return itemName;
113
	}
114
 
115
	public void setItemName(String itemName) {
116
		this.itemName = itemName;
117
	}
118
 
24094 amit.gupta 119
	public void setDoa(boolean doa) {
120
		this.doa = doa;
121
	}
28566 tejbeer 122
 
23019 ashik.ali 123
	@Convert(converter = LocalDateTimeAttributeConverter.class)
124
	@Column(name = "create_timestamp")
125
	private LocalDateTime createTimestamp = LocalDateTime.now();
28566 tejbeer 126
 
127
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
128
	@JoinColumn(name = "fofo_order_item_id", insertable = false, updatable = false, nullable = false)
22859 ashik.ali 129
	private Set<FofoLineItem> fofoLineItems;
28566 tejbeer 130
 
21596 ashik.ali 131
	public int getId() {
132
		return id;
133
	}
28566 tejbeer 134
 
21596 ashik.ali 135
	public void setId(int id) {
136
		this.id = id;
137
	}
28566 tejbeer 138
 
21596 ashik.ali 139
	public int getOrderId() {
140
		return orderId;
141
	}
28566 tejbeer 142
 
21596 ashik.ali 143
	public void setOrderId(int orderId) {
144
		this.orderId = orderId;
145
	}
28566 tejbeer 146
 
34287 vikas.jang 147
	public int getPendingOrderItemId() {
148
		return pendingOrderItemId;
149
	}
150
 
151
	public void setPendingOrderItemId(int pendingOrderItemId) {
152
		this.pendingOrderItemId = pendingOrderItemId;
153
	}
154
 
21596 ashik.ali 155
	public int getItemId() {
156
		return itemId;
157
	}
28566 tejbeer 158
 
21596 ashik.ali 159
	public void setItemId(int itemId) {
160
		this.itemId = itemId;
161
	}
28566 tejbeer 162
 
21596 ashik.ali 163
	public int getQuantity() {
164
		return quantity;
165
	}
28566 tejbeer 166
 
21596 ashik.ali 167
	public void setQuantity(int quantity) {
168
		this.quantity = quantity;
169
	}
28566 tejbeer 170
 
21596 ashik.ali 171
	public float getSellingPrice() {
172
		return sellingPrice;
173
	}
28566 tejbeer 174
 
21596 ashik.ali 175
	public void setSellingPrice(float sellingPrice) {
176
		this.sellingPrice = sellingPrice;
177
	}
28566 tejbeer 178
 
21710 ashik.ali 179
	public float getCost() {
180
		return cost;
181
	}
28566 tejbeer 182
 
21710 ashik.ali 183
	public void setCost(float cost) {
184
		this.cost = cost;
185
	}
28566 tejbeer 186
 
26332 amit.gupta 187
	public float getMop() {
188
		return mop;
189
	}
28566 tejbeer 190
 
26332 amit.gupta 191
	public void setMop(float mop) {
192
		this.mop = mop;
193
	}
28566 tejbeer 194
 
21895 ashik.ali 195
	public float getIgstRate() {
196
		return igstRate;
21596 ashik.ali 197
	}
28566 tejbeer 198
 
21895 ashik.ali 199
	public void setIgstRate(float igstRate) {
200
		this.igstRate = igstRate;
21596 ashik.ali 201
	}
28566 tejbeer 202
 
21895 ashik.ali 203
	public float getCgstRate() {
204
		return cgstRate;
21687 ashik.ali 205
	}
28566 tejbeer 206
 
21895 ashik.ali 207
	public void setCgstRate(float cgstRate) {
208
		this.cgstRate = cgstRate;
21687 ashik.ali 209
	}
28566 tejbeer 210
 
21895 ashik.ali 211
	public float getSgstRate() {
212
		return sgstRate;
213
	}
28566 tejbeer 214
 
21895 ashik.ali 215
	public void setSgstRate(float sgstRate) {
216
		this.sgstRate = sgstRate;
217
	}
28566 tejbeer 218
 
21895 ashik.ali 219
	public String getHsnCode() {
220
		return hsnCode;
221
	}
28566 tejbeer 222
 
21895 ashik.ali 223
	public void setHsnCode(String hsnCode) {
224
		this.hsnCode = hsnCode;
225
	}
28566 tejbeer 226
 
21596 ashik.ali 227
	public float getDp() {
228
		return dp;
229
	}
26332 amit.gupta 230
 
21596 ashik.ali 231
	public void setDp(float dp) {
232
		this.dp = dp;
233
	}
28566 tejbeer 234
 
21596 ashik.ali 235
	public String getBrand() {
236
		return brand;
237
	}
28566 tejbeer 238
 
21596 ashik.ali 239
	public void setBrand(String brand) {
240
		this.brand = brand;
241
	}
28566 tejbeer 242
 
21596 ashik.ali 243
	public String getModelName() {
244
		return modelName;
245
	}
28566 tejbeer 246
 
21596 ashik.ali 247
	public void setModelName(String modelName) {
248
		this.modelName = modelName;
249
	}
28566 tejbeer 250
 
21596 ashik.ali 251
	public String getModelNumber() {
252
		return modelNumber;
253
	}
28566 tejbeer 254
 
21596 ashik.ali 255
	public void setModelNumber(String modelNumber) {
256
		this.modelNumber = modelNumber;
257
	}
28566 tejbeer 258
 
21596 ashik.ali 259
	public String getColor() {
260
		return color;
261
	}
28566 tejbeer 262
 
21596 ashik.ali 263
	public void setColor(String color) {
264
		this.color = color;
265
	}
28566 tejbeer 266
 
22580 ashik.ali 267
	public float getDiscount() {
268
		return discount;
269
	}
28566 tejbeer 270
 
22580 ashik.ali 271
	public void setDiscount(float discount) {
272
		this.discount = discount;
273
	}
28566 tejbeer 274
 
23019 ashik.ali 275
	public LocalDateTime getCreateTimestamp() {
276
		return createTimestamp;
277
	}
28566 tejbeer 278
 
23019 ashik.ali 279
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
280
		this.createTimestamp = createTimestamp;
281
	}
28566 tejbeer 282
 
22859 ashik.ali 283
	public Set<FofoLineItem> getFofoLineItems() {
284
		return fofoLineItems;
21687 ashik.ali 285
	}
28566 tejbeer 286
 
22859 ashik.ali 287
	public void setFofoLineItems(Set<FofoLineItem> fofoLineItems) {
288
		this.fofoLineItems = fofoLineItems;
21687 ashik.ali 289
	}
28566 tejbeer 290
 
21602 ashik.ali 291
	@Override
21924 ashik.ali 292
	public int hashCode() {
293
		final int prime = 31;
294
		int result = 1;
28566 tejbeer 295
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
296
		result = prime * result + Float.floatToIntBits(cgstRate);
297
		result = prime * result + ((color == null) ? 0 : color.hashCode());
298
		result = prime * result + Float.floatToIntBits(cost);
299
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
300
		result = prime * result + Float.floatToIntBits(discount);
301
		result = prime * result + (doa ? 1231 : 1237);
302
		result = prime * result + Float.floatToIntBits(dp);
303
		result = prime * result + ((fofoLineItems == null) ? 0 : fofoLineItems.hashCode());
304
		result = prime * result + ((hsnCode == null) ? 0 : hsnCode.hashCode());
21924 ashik.ali 305
		result = prime * result + id;
28566 tejbeer 306
		result = prime * result + Float.floatToIntBits(igstRate);
307
		result = prime * result + itemId;
308
		result = prime * result + ((itemName == null) ? 0 : itemName.hashCode());
309
		result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());
310
		result = prime * result + ((modelNumber == null) ? 0 : modelNumber.hashCode());
311
		result = prime * result + Float.floatToIntBits(mop);
312
		result = prime * result + orderId;
313
		result = prime * result + quantity;
314
		result = prime * result + Float.floatToIntBits(sellingPrice);
315
		result = prime * result + Float.floatToIntBits(sgstRate);
21924 ashik.ali 316
		return result;
317
	}
28566 tejbeer 318
 
21924 ashik.ali 319
	@Override
320
	public boolean equals(Object obj) {
321
		if (this == obj)
322
			return true;
323
		if (obj == null)
324
			return false;
325
		if (getClass() != obj.getClass())
326
			return false;
22859 ashik.ali 327
		FofoOrderItem other = (FofoOrderItem) obj;
28566 tejbeer 328
		if (brand == null) {
329
			if (other.brand != null)
330
				return false;
331
		} else if (!brand.equals(other.brand))
332
			return false;
333
		if (Float.floatToIntBits(cgstRate) != Float.floatToIntBits(other.cgstRate))
334
			return false;
335
		if (color == null) {
336
			if (other.color != null)
337
				return false;
338
		} else if (!color.equals(other.color))
339
			return false;
340
		if (Float.floatToIntBits(cost) != Float.floatToIntBits(other.cost))
341
			return false;
342
		if (createTimestamp == null) {
343
			if (other.createTimestamp != null)
344
				return false;
345
		} else if (!createTimestamp.equals(other.createTimestamp))
346
			return false;
347
		if (Float.floatToIntBits(discount) != Float.floatToIntBits(other.discount))
348
			return false;
349
		if (doa != other.doa)
350
			return false;
351
		if (Float.floatToIntBits(dp) != Float.floatToIntBits(other.dp))
352
			return false;
353
		if (fofoLineItems == null) {
354
			if (other.fofoLineItems != null)
355
				return false;
356
		} else if (!fofoLineItems.equals(other.fofoLineItems))
357
			return false;
358
		if (hsnCode == null) {
359
			if (other.hsnCode != null)
360
				return false;
361
		} else if (!hsnCode.equals(other.hsnCode))
362
			return false;
21924 ashik.ali 363
		if (id != other.id)
364
			return false;
28566 tejbeer 365
		if (Float.floatToIntBits(igstRate) != Float.floatToIntBits(other.igstRate))
366
			return false;
367
		if (itemId != other.itemId)
368
			return false;
369
		if (itemName == null) {
370
			if (other.itemName != null)
371
				return false;
372
		} else if (!itemName.equals(other.itemName))
373
			return false;
374
		if (modelName == null) {
375
			if (other.modelName != null)
376
				return false;
377
		} else if (!modelName.equals(other.modelName))
378
			return false;
379
		if (modelNumber == null) {
380
			if (other.modelNumber != null)
381
				return false;
382
		} else if (!modelNumber.equals(other.modelNumber))
383
			return false;
384
		if (Float.floatToIntBits(mop) != Float.floatToIntBits(other.mop))
385
			return false;
386
		if (orderId != other.orderId)
387
			return false;
388
		if (quantity != other.quantity)
389
			return false;
390
		if (Float.floatToIntBits(sellingPrice) != Float.floatToIntBits(other.sellingPrice))
391
			return false;
392
		if (Float.floatToIntBits(sgstRate) != Float.floatToIntBits(other.sgstRate))
393
			return false;
21924 ashik.ali 394
		return true;
395
	}
28566 tejbeer 396
 
21924 ashik.ali 397
	@Override
21602 ashik.ali 398
	public String toString() {
22859 ashik.ali 399
		return "FofoOrderItem [id=" + id + ", orderId=" + orderId + ", itemId=" + itemId + ", quantity=" + quantity
26332 amit.gupta 400
				+ ", sellingPrice=" + sellingPrice + ", cost=" + cost + ", mop=" + mop + ", igstRate=" + igstRate
401
				+ ", cgstRate=" + cgstRate + ", sgstRate=" + sgstRate + ", hsnCode=" + hsnCode + ", dp=" + dp
402
				+ ", brand=" + brand + ", modelName=" + modelName + ", modelNumber=" + modelNumber + ", color=" + color
28566 tejbeer 403
				+ ", discount=" + discount + ", doa=" + doa + ", itemName=" + itemName + ", createTimestamp="
404
				+ createTimestamp + ", fofoLineItems=" + fofoLineItems + "]";
21602 ashik.ali 405
	}
28566 tejbeer 406
 
21596 ashik.ali 407
}