Rev 31860 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.transaction;import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;import com.spice.profitmandi.dao.entity.catalog.Item;import javax.persistence.*;import java.io.Serializable;import java.time.LocalDateTime;import java.util.Objects;/*** This class basically contains api details** @author ashikali*/@Entity@Table(name = "transaction.lineitem")@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")})public class LineItem implements Serializable {private static final long serialVersionUID = 1L;public LineItem() {}@Id@Column(name = "id", unique = true, updatable = false)@GeneratedValue(strategy = GenerationType.IDENTITY)private Integer id;@Column(name = "item_id")private Integer itemId;@Column(name = "productGroup", length = 100)private String productGoup;@Column(name = "brand", length = 100)private String brand;@Column(name = "model_number", length = 100)private String modelNumber;@Column(name = "model_name", length = 100)private String modelName;@Column(name = "color", length = 20)private String color;@Column(name = "extra_info", length = 100)private String extraInfo;@Column(name = "quantity")private Integer quantity;@Column(name = "mrp")private Float mrp;@Column(name = "unit_price")private Float unitPrice;@Column(name = "unit_weight")private Float unitWeight;@Column(name = "total_price")private Float totalPrice;@Column(name = "transfer_price")private Float transferPrice;@Column(name = "total_weight")private Float totalWeight;@Column(name = "order_id")private Integer orderId;@Column(name = "serial_number", length = 20)private String serialNumber;@Column(name = "item_number", length = 50)private String itemNumber;@Column(name = "dealText", length = 100)private String dealText;@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name = "warranty_expiry_timestamp")private LocalDateTime warrantyExpiryTimestamp;@Column(name = "nlc")private Float nlc;@Column(name = "logisticsCost")private Float logisticsCost;@Column(name = "codCollectionCharges")private Float codCollectionCharges;@Column(name = "returnQty")private int returnQty;@Column(name = "igstRate")private Float igstRate;@Column(name = "cgstRate")private Float cgstRate;@Column(name = "sgstRate")private Float sgstRate;@Column(name = "hsnCode")private String hsnCode;@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name = "damaged_expiry_timestamp")private LocalDateTime damagedExpiryTimestamp;@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)//@Fetch(value = FetchMode.SUBSELECT)@JoinColumn(name = "item_id", insertable = false, updatable = false, nullable = false, referencedColumnName = "id")private Item item;public float getTotalTaxRate() {return (this.cgstRate == null ? 0 : this.cgstRate) + (this.sgstRate == null ? 0 : this.sgstRate) + (this.igstRate == null ? 0 : this.igstRate);}public String getItemDescription() {StringBuilder itemString = new StringBuilder();if (this.getBrand() != null && !this.getBrand().isEmpty()) {itemString.append(this.getBrand().trim());}itemString.append(" ");if (this.getModelName() != null && !this.getModelName().isEmpty()) {itemString.append(this.getModelName().trim());}if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {itemString.append(" ");itemString.append(this.getModelNumber().trim());}if (this.getColor() != null && !this.getColor().isEmpty() && !this.getColor().trim().equals("f_")) {itemString.append(" ");itemString.append(this.getColor().trim());}return itemString.toString().replaceAll("\\s+", " ").trim();}public String getItemDescriptionNoColor() {StringBuilder itemString = new StringBuilder();if (this.getBrand() != null && !this.getBrand().isEmpty()) {itemString.append(this.getBrand().trim());}itemString.append(" ");if (this.getModelName() != null && !this.getModelName().isEmpty()) {itemString.append(this.getModelName().trim());}if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {itemString.append(" ");itemString.append(this.getModelNumber().trim());}return itemString.toString().replaceAll("\\s+", " ").trim();}public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public Integer getItemId() {return itemId;}public void setItemId(Integer itemId) {this.itemId = itemId;}public String getProductGoup() {return productGoup;}public void setProductGoup(String productGoup) {this.productGoup = productGoup;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand = brand;}public String getModelNumber() {return modelNumber;}public void setModelNumber(String modelNumber) {this.modelNumber = modelNumber;}public String getModelName() {return modelName;}public void setModelName(String modelName) {this.modelName = modelName;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public String getExtraInfo() {return extraInfo;}public void setExtraInfo(String extraInfo) {this.extraInfo = extraInfo;}public Integer getQuantity() {return quantity;}public void setQuantity(Integer quantity) {this.quantity = quantity;}public Float getMrp() {return mrp;}public void setMrp(Float mrp) {this.mrp = mrp;}public Float getUnitPrice() {return unitPrice;}public void setUnitPrice(Float unitPrice) {this.unitPrice = unitPrice;}public Float getUnitWeight() {return unitWeight;}public void setUnitWeight(Float unitWeight) {this.unitWeight = unitWeight;}public Float getTotalPrice() {return totalPrice;}public void setTotalPrice(Float totalPrice) {this.totalPrice = totalPrice;}public Float getTransferPrice() {return transferPrice;}public void setTransferPrice(Float transferPrice) {this.transferPrice = transferPrice;}public Float getTotalWeight() {return totalWeight;}public void setTotalWeight(Float totalWeight) {this.totalWeight = totalWeight;}public Integer getOrderId() {return orderId;}public void setOrderId(Integer orderId) {this.orderId = orderId;}public String getSerialNumber() {return serialNumber;}public void setSerialNumber(String serialNumber) {this.serialNumber = serialNumber;}public String getItemNumber() {return itemNumber;}public void setItemNumber(String itemNumber) {this.itemNumber = itemNumber;}public String getDealText() {return dealText;}public void setDealText(String dealText) {this.dealText = dealText;}public LocalDateTime getWarrantyExpiryTimestamp() {return warrantyExpiryTimestamp;}public void setWarrantyExpiryTimestamp(LocalDateTime warrantyExpiryTimestamp) {this.warrantyExpiryTimestamp = warrantyExpiryTimestamp;}public Float getNlc() {return nlc;}public void setNlc(Float nlc) {this.nlc = nlc;}public Float getLogisticsCost() {return logisticsCost;}public void setLogisticsCost(Float logisticsCost) {this.logisticsCost = logisticsCost;}public Float getCodCollectionCharges() {return codCollectionCharges;}public void setCodCollectionCharges(Float codCollectionCharges) {this.codCollectionCharges = codCollectionCharges;}public int getReturnQty() {return returnQty;}public void setReturnQty(int returnQty) {this.returnQty = returnQty;}public Float getIgstRate() {return igstRate;}public void setIgstRate(Float igstRate) {this.igstRate = igstRate;}public Float getCgstRate() {return cgstRate;}public void setCgstRate(Float cgstRate) {this.cgstRate = cgstRate;}public Float getSgstRate() {return sgstRate;}public void setSgstRate(Float sgstRate) {this.sgstRate = sgstRate;}public String getHsnCode() {return hsnCode;}public void setHsnCode(String hsnCode) {this.hsnCode = hsnCode;}public LocalDateTime getDamagedExpiryTimestamp() {return damagedExpiryTimestamp;}@Overridepublic String toString() {return "LineItem{" +"id=" + id +", itemId=" + itemId +", productGoup='" + productGoup + '\'' +", brand='" + brand + '\'' +", modelNumber='" + modelNumber + '\'' +", modelName='" + modelName + '\'' +", color='" + color + '\'' +", extraInfo='" + extraInfo + '\'' +", quantity=" + quantity +", mrp=" + mrp +", unitPrice=" + unitPrice +", unitWeight=" + unitWeight +", totalPrice=" + totalPrice +", transferPrice=" + transferPrice +", totalWeight=" + totalWeight +", orderId=" + orderId +", serialNumber='" + serialNumber + '\'' +", itemNumber='" + itemNumber + '\'' +", dealText='" + dealText + '\'' +", warrantyExpiryTimestamp=" + warrantyExpiryTimestamp +", nlc=" + nlc +", logisticsCost=" + logisticsCost +", codCollectionCharges=" + codCollectionCharges +", returnQty=" + returnQty +", igstRate=" + igstRate +", cgstRate=" + cgstRate +", sgstRate=" + sgstRate +", hsnCode='" + hsnCode + '\'' +", damagedExpiryTimestamp=" + damagedExpiryTimestamp +", item=" + item +'}';}@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;LineItem lineItem = (LineItem) o;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);}@Overridepublic int hashCode() {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);}public void setDamagedExpiryTimestamp(LocalDateTime damagedExpiryTimestamp) {this.damagedExpiryTimestamp = damagedExpiryTimestamp;}public Item getItem() {return item;}public void setItem(Item item) {this.item = item;}}