Subversion Repositories SmartDukaan

Rev

Rev 25209 | Rev 30449 | 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
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
21653 ashik.ali 6
import javax.persistence.CascadeType;
21545 ashik.ali 7
import javax.persistence.Column;
22009 ashik.ali 8
import javax.persistence.Convert;
21545 ashik.ali 9
import javax.persistence.Entity;
21653 ashik.ali 10
import javax.persistence.FetchType;
21545 ashik.ali 11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
21653 ashik.ali 14
import javax.persistence.JoinColumn;
21545 ashik.ali 15
import javax.persistence.NamedQueries;
16
import javax.persistence.NamedQuery;
21653 ashik.ali 17
import javax.persistence.OneToOne;
21545 ashik.ali 18
import javax.persistence.Table;
19
 
22009 ashik.ali 20
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
21716 ashik.ali 21
import com.spice.profitmandi.dao.entity.catalog.Item;
22
 
21545 ashik.ali 23
/**
24
 * This class basically contains api details
25
 * 
26
 * @author ashikali
27
 *
28
 */
29
@Entity
30
@Table(name="transaction.lineitem", schema = "transaction")
31
@NamedQueries({
32
	@NamedQuery(name="LineItem.selectAll",query="select li from LineItem li"),
21580 ashik.ali 33
	@NamedQuery(name="LineItem.selectById",query="select li from LineItem li where li.id= :id")
21545 ashik.ali 34
})
35
public class LineItem implements Serializable{
36
 
37
	private static final long serialVersionUID = 1L;
38
 
39
	public LineItem() {
40
	}
41
 
42
	@Id
43
	@Column(name="id", unique=true, updatable=false)
44
	@GeneratedValue(strategy = GenerationType.IDENTITY)
21628 kshitij.so 45
	private Integer id;
21545 ashik.ali 46
 
47
	@Column(name = "item_id")
21628 kshitij.so 48
	private Integer itemId;
21545 ashik.ali 49
 
50
	@Column(name = "productGroup", length = 100)
51
	private String productGoup;
52
 
53
	@Column(name = "brand", length = 100)
54
	private String brand;
55
 
56
	@Column(name = "model_number", length = 100)
57
	private String modelNumber;
58
 
59
	@Column(name = "model_name", length = 100)
60
	private String modelName;
61
 
62
	@Column(name = "color", length = 20)
63
	private String color;
64
 
65
	@Column(name = "extra_info", length = 100)
66
	private String extraInfo;
67
 
68
	@Column(name = "quantity")
23464 amit.gupta 69
	private Integer quantity;
21545 ashik.ali 70
 
71
	@Column(name = "mrp")
21628 kshitij.so 72
	private Float mrp;
21545 ashik.ali 73
 
74
	@Column(name = "unit_price")
21628 kshitij.so 75
	private Float unitPrice;
21545 ashik.ali 76
 
77
	@Column(name = "unit_weight")
21628 kshitij.so 78
	private Float unitWeight;
21545 ashik.ali 79
 
80
	@Column(name = "total_price")
21628 kshitij.so 81
	private Float totalPrice;
21545 ashik.ali 82
 
83
	@Column(name = "transfer_price")
21628 kshitij.so 84
	private Float transferPrice;
21545 ashik.ali 85
 
21628 kshitij.so 86
	@Column(name = "total_weight")
87
	private Float totalWeight;
21545 ashik.ali 88
 
89
	@Column(name = "order_id")
21628 kshitij.so 90
	private Integer orderId;
21545 ashik.ali 91
 
92
	@Column(name = "imei_number", length = 20)
93
	private String imeiNumber;
94
 
95
	@Column(name = "item_number", length = 50)
96
	private String itemNumber;
97
 
98
	@Column(name = "dealText", length = 100)
99
	private String dealText;
100
 
22009 ashik.ali 101
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 102
	@Column(name = "warranty_expiry_timestamp")
103
	private LocalDateTime warrantyExpiryTimestamp;
104
 
105
	@Column(name = "serial_number", length = 8192)
106
	private String serialNumber;
107
 
108
	@Column(name = "vatRate")
21628 kshitij.so 109
	private Float vatRate;
21545 ashik.ali 110
 
111
	@Column(name = "nlc")
21628 kshitij.so 112
	private Float nlc;
21545 ashik.ali 113
 
114
	@Column(name = "logisticsCost")
21628 kshitij.so 115
	private Float logisticsCost;
21545 ashik.ali 116
 
117
	@Column(name = "codCollectionCharges")
21628 kshitij.so 118
	private Float codCollectionCharges;
21545 ashik.ali 119
 
120
	@Column(name = "returnQty")
27878 amit.gupta 121
	private int returnQty;
21545 ashik.ali 122
 
22859 ashik.ali 123
	@Column(name = "igstRate")
23694 tejbeer 124
	private Float igstRate;
22859 ashik.ali 125
 
126
	@Column(name = "cgstRate")
23694 tejbeer 127
	private Float cgstRate;
22859 ashik.ali 128
 
129
	@Column(name = "sgstRate")
23694 tejbeer 130
	private Float sgstRate;
22859 ashik.ali 131
 
132
	@Column(name = "hsnCode")
133
	private String hsnCode;
134
 
22009 ashik.ali 135
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 136
	@Column(name = "damaged_expiry_timestamp")
137
	private LocalDateTime damagedExpiryTimestamp;
138
 
24658 tejbeer 139
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
21653 ashik.ali 140
	//@Fetch(value = FetchMode.SUBSELECT)
141
	@JoinColumn(name="item_id",insertable=false,updatable=false,nullable=false, referencedColumnName = "id")
142
	private Item item;
143
 
25209 amit.gupta 144
 
145
	public String getItemDescription(){
146
		StringBuilder itemString = new StringBuilder();
147
		if(this.getBrand() != null && !this.getBrand().isEmpty()){
148
			itemString.append(this.getBrand().trim());
149
		}
150
		itemString.append(" ");
151
		if(this.getModelName() != null && !this.getModelName().isEmpty()){
152
			itemString.append(this.getModelName().trim());
153
		}
154
		if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){
155
			itemString.append(" ");
156
			itemString.append(this.getModelNumber().trim());
157
		}
158
		if(this.getColor() != null && !this.getColor().isEmpty() && !this.getColor().trim().equals("f_")){
159
			itemString.append(" ");
160
			itemString.append(this.getColor().trim());
161
		}
162
		return itemString.toString().replaceAll("\\s+", " ").trim();
163
	}
164
 
165
	public String getItemDescriptionNoColor(){
166
		StringBuilder itemString = new StringBuilder();
167
		if(this.getBrand() != null && !this.getBrand().isEmpty()){
168
			itemString.append(this.getBrand().trim());
169
		}
170
		itemString.append(" ");
171
		if(this.getModelName() != null && !this.getModelName().isEmpty()){
172
			itemString.append(this.getModelName().trim());
173
		}
174
		if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){
175
			itemString.append(" ");
176
			itemString.append(this.getModelNumber().trim());
177
		}
178
 
179
		return itemString.toString().replaceAll("\\s+", " ").trim();
180
	}
181
 
21628 kshitij.so 182
	public Integer getId() {
21545 ashik.ali 183
		return id;
184
	}
21628 kshitij.so 185
	public void setId(Integer id) {
21545 ashik.ali 186
		this.id = id;
187
	}
21628 kshitij.so 188
	public Integer getItemId() {
21545 ashik.ali 189
		return itemId;
190
	}
21628 kshitij.so 191
	public void setItemId(Integer itemId) {
21545 ashik.ali 192
		this.itemId = itemId;
193
	}
194
	public String getProductGoup() {
195
		return productGoup;
196
	}
197
	public void setProductGoup(String productGoup) {
198
		this.productGoup = productGoup;
199
	}
200
	public String getBrand() {
201
		return brand;
202
	}
203
	public void setBrand(String brand) {
204
		this.brand = brand;
205
	}
206
	public String getModelNumber() {
207
		return modelNumber;
208
	}
209
	public void setModelNumber(String modelNumber) {
210
		this.modelNumber = modelNumber;
211
	}
21924 ashik.ali 212
 
21545 ashik.ali 213
	public String getModelName() {
214
		return modelName;
215
	}
216
	public void setModelName(String modelName) {
217
		this.modelName = modelName;
218
	}
219
	public String getColor() {
220
		return color;
221
	}
222
	public void setColor(String color) {
223
		this.color = color;
224
	}
225
	public String getExtraInfo() {
226
		return extraInfo;
227
	}
228
	public void setExtraInfo(String extraInfo) {
229
		this.extraInfo = extraInfo;
230
	}
23464 amit.gupta 231
	public Integer getQuantity() {
21545 ashik.ali 232
		return quantity;
233
	}
23464 amit.gupta 234
	public void setQuantity(Integer quantity) {
21545 ashik.ali 235
		this.quantity = quantity;
236
	}
21628 kshitij.so 237
	public Float getMrp() {
21545 ashik.ali 238
		return mrp;
239
	}
21628 kshitij.so 240
	public void setMrp(Float mrp) {
21545 ashik.ali 241
		this.mrp = mrp;
242
	}
21628 kshitij.so 243
	public Float getUnitPrice() {
21545 ashik.ali 244
		return unitPrice;
245
	}
21628 kshitij.so 246
	public void setUnitPrice(Float unitPrice) {
21545 ashik.ali 247
		this.unitPrice = unitPrice;
248
	}
21628 kshitij.so 249
	public Float getUnitWeight() {
21545 ashik.ali 250
		return unitWeight;
251
	}
21628 kshitij.so 252
	public void setUnitWeight(Float unitWeight) {
21545 ashik.ali 253
		this.unitWeight = unitWeight;
254
	}
21628 kshitij.so 255
	public Float getTotalPrice() {
21545 ashik.ali 256
		return totalPrice;
257
	}
21628 kshitij.so 258
	public void setTotalPrice(Float totalPrice) {
21545 ashik.ali 259
		this.totalPrice = totalPrice;
260
	}
21628 kshitij.so 261
	public Float getTransferPrice() {
21545 ashik.ali 262
		return transferPrice;
263
	}
21628 kshitij.so 264
	public void setTransferPrice(Float transferPrice) {
21545 ashik.ali 265
		this.transferPrice = transferPrice;
266
	}
21628 kshitij.so 267
	public Float getTotalWeight() {
21545 ashik.ali 268
		return totalWeight;
269
	}
21628 kshitij.so 270
	public void setTotalWeight(Float totalWeight) {
21545 ashik.ali 271
		this.totalWeight = totalWeight;
272
	}
21628 kshitij.so 273
	public Integer getOrderId(){
21545 ashik.ali 274
		return orderId;
275
	}
21628 kshitij.so 276
	public void setOrderId(Integer orderId) {
21545 ashik.ali 277
		this.orderId = orderId;
278
	}
279
	public String getImeiNumber() {
280
		return imeiNumber;
281
	}
282
	public void setImeiNumber(String imeiNumber) {
283
		this.imeiNumber = imeiNumber;
284
	}
285
	public String getItemNumber() {
286
		return itemNumber;
287
	}
288
	public void setItemNumber(String itemNumber) {
289
		this.itemNumber = itemNumber;
290
	}
291
	public String getDealText() {
292
		return dealText;
293
	}
294
	public void setDealText(String dealText) {
295
		this.dealText = dealText;
296
	}
297
	public LocalDateTime getWarrantyExpiryTimestamp() {
298
		return warrantyExpiryTimestamp;
299
	}
300
	public void setWarrantyExpiryTimestamp(LocalDateTime warrantyExpiryTimestamp) {
301
		this.warrantyExpiryTimestamp = warrantyExpiryTimestamp;
302
	}
303
	public String getSerialNumber() {
304
		return serialNumber;
305
	}
306
	public void setSerialNumber(String serialNumber) {
307
		this.serialNumber = serialNumber;
308
	}
21628 kshitij.so 309
	public Float getVatRate() {
21545 ashik.ali 310
		return vatRate;
311
	}
21628 kshitij.so 312
	public void setVatRate(Float vatRate) {
21545 ashik.ali 313
		this.vatRate = vatRate;
314
	}
21628 kshitij.so 315
	public Float getNlc() {
21545 ashik.ali 316
		return nlc;
317
	}
21628 kshitij.so 318
	public void setNlc(Float nlc) {
21545 ashik.ali 319
		this.nlc = nlc;
320
	}
21628 kshitij.so 321
	public Float getLogisticsCost() {
21545 ashik.ali 322
		return logisticsCost;
323
	}
21628 kshitij.so 324
	public void setLogisticsCost(Float logisticsCost) {
21545 ashik.ali 325
		this.logisticsCost = logisticsCost;
326
	}
21628 kshitij.so 327
	public Float getCodCollectionCharges() {
21545 ashik.ali 328
		return codCollectionCharges;
329
	}
21628 kshitij.so 330
	public void setCodCollectionCharges(Float codCollectionCharges) {
21545 ashik.ali 331
		this.codCollectionCharges = codCollectionCharges;
332
	}
27878 amit.gupta 333
	public int getReturnQty() {
21545 ashik.ali 334
		return returnQty;
335
	}
27878 amit.gupta 336
	public void setReturnQty(int returnQty) {
21545 ashik.ali 337
		this.returnQty = returnQty;
338
	}
23691 tejbeer 339
	public Float getIgstRate() {
22859 ashik.ali 340
		return igstRate;
341
	}
23691 tejbeer 342
	public void setIgstRate(Float igstRate) {
22859 ashik.ali 343
		this.igstRate = igstRate;
344
	}
23691 tejbeer 345
	public Float getCgstRate() {
22859 ashik.ali 346
		return cgstRate;
347
	}
23691 tejbeer 348
	public void setCgstRate(Float cgstRate) {
22859 ashik.ali 349
		this.cgstRate = cgstRate;
350
	}
23691 tejbeer 351
	public Float getSgstRate() {
22859 ashik.ali 352
		return sgstRate;
353
	}
23691 tejbeer 354
	public void setSgstRate(Float sgstRate) {
22859 ashik.ali 355
		this.sgstRate = sgstRate;
356
	}
357
	public String getHsnCode() {
358
		return hsnCode;
359
	}
360
	public void setHsnCode(String hsnCode) {
361
		this.hsnCode = hsnCode;
362
	}
21545 ashik.ali 363
	public LocalDateTime getDamagedExpiryTimestamp() {
364
		return damagedExpiryTimestamp;
365
	}
366
	public void setDamagedExpiryTimestamp(LocalDateTime damagedExpiryTimestamp) {
367
		this.damagedExpiryTimestamp = damagedExpiryTimestamp;
368
	}
21653 ashik.ali 369
 
370
	public Item getItem() {
371
		return item;
21545 ashik.ali 372
	}
21653 ashik.ali 373
	public void setItem(Item item) {
374
		this.item = item;
375
	}
21545 ashik.ali 376
 
21924 ashik.ali 377
 
378
	@Override
379
	public int hashCode() {
380
		final int prime = 31;
381
		int result = 1;
382
		result = prime * result + ((id == null) ? 0 : id.hashCode());
383
		return result;
384
	}
385
	@Override
386
	public boolean equals(Object obj) {
387
		if (this == obj)
388
			return true;
389
		if (obj == null)
390
			return false;
391
		if (getClass() != obj.getClass())
392
			return false;
393
		LineItem other = (LineItem) obj;
394
		if (id == null) {
395
			if (other.id != null)
396
				return false;
397
		} else if (!id.equals(other.id))
398
			return false;
399
		return true;
400
	}
401
	@Override
402
	public String toString() {
403
		return "LineItem [id=" + id + ", itemId=" + itemId + ", productGoup=" + productGoup + ", brand=" + brand
404
				+ ", modelNumber=" + modelNumber + ", modelName=" + modelName + ", color=" + color + ", extraInfo="
405
				+ extraInfo + ", quantity=" + quantity + ", mrp=" + mrp + ", unitPrice=" + unitPrice + ", unitWeight="
406
				+ unitWeight + ", totalPrice=" + totalPrice + ", transferPrice=" + transferPrice + ", totalWeight="
407
				+ totalWeight + ", orderId=" + orderId + ", imeiNumber=" + imeiNumber + ", itemNumber=" + itemNumber
408
				+ ", dealText=" + dealText + ", warrantyExpiryTimestamp=" + warrantyExpiryTimestamp + ", serialNumber="
409
				+ serialNumber + ", vatRate=" + vatRate + ", nlc=" + nlc + ", logisticsCost=" + logisticsCost
22859 ashik.ali 410
				+ ", codCollectionCharges=" + codCollectionCharges + ", returnQty=" + returnQty + ", igstRate="
411
				+ igstRate + ", cgstRate=" + cgstRate + ", sgstRate=" + sgstRate + ", hsnCode=" + hsnCode
21924 ashik.ali 412
				+ ", damagedExpiryTimestamp=" + damagedExpiryTimestamp + ", item=" + item + "]";
413
	}
414
 
21545 ashik.ali 415
}