Subversion Repositories SmartDukaan

Rev

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