Subversion Repositories SmartDukaan

Rev

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