Rev 33436 | Rev 34287 | 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.fofo;import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;import javax.persistence.*;import java.io.Serializable;import java.time.LocalDateTime;import java.util.Objects;@Entity@Table(name = "fofo.pending_order_item", uniqueConstraints = {@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }), })@NamedQueries({@NamedQuery(name = "PendingOrderItem.selectSumSellingPriceOnlineOrder", query = "select new com.spice.profitmandi.common.model.OnlineDeliveredOrderSum("+ "SUM(CAST(poi.sellingPrice AS int)))"+ " from PendingOrder po join PendingOrderItem poi on po.id = poi.orderId"+ " where po.fofoId = :fofoId and po.createTimestamp between :startDate and :endDate and poi.deliveredTimestamp is not null and poi.cancelledTimestamp is null"),})public class PendingOrderItem implements Serializable {public OrderStatus getStatus() {return status;}public String getItemName() {return itemName;}public void setItemName(String itemName) {this.itemName = itemName;}private static final long serialVersionUID = 1L;@Id@Column(name = "id")@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "order_id")private int orderId;@Column(name = "item_id")private int itemId;@Column(name = "remark")private String remark;@Column(name = "is_settled")private boolean isSettled;public String getRemark() {return remark;}public void setRemark(String remark) {this.remark = remark;}@Transientprivate String itemName;@Transientprivate int catalogId;@Transientprivate String imgUrl;public String getImgUrl() {return imgUrl;}public void setImgUrl(String imgUrl) {this.imgUrl = imgUrl;}@Column(name = "quantity")private int quantity;@Column(name = "selling_price")private float sellingPrice;@Transientprivate PendingOrder pendingOrder;public PendingOrder getPendingOrder() {return pendingOrder;}public void setPendingOrder(PendingOrder pendingOrder) {this.pendingOrder = pendingOrder;}@Column(name = "status")@Enumerated(EnumType.STRING)private OrderStatus status;@Column(name = "status_description")private String statusDescription;@Column(name = "cancelled_timestamp")private LocalDateTime cancelledTimestamp;@Column(name = "billed_timestamp")private LocalDateTime billedTimestamp;@Column(name = "verified_timestamp")private LocalDateTime verifiedTimestamp;public LocalDateTime getVerifiedTimestamp() {return verifiedTimestamp;}public void setVerifiedTimestamp(LocalDateTime verifiedTimestamp) {this.verifiedTimestamp = verifiedTimestamp;}@Column(name = "delivered_timestamp")private LocalDateTime deliveredTimestamp;@Column(name = "claimed_timestamp")private LocalDateTime claimedTimestamp;@Column(name = "originalOrderId")private int originalOrderId;public LocalDateTime getClaimedTimestamp() {return claimedTimestamp;}public void setClaimedTimestamp(LocalDateTime claimedTimestamp) {this.claimedTimestamp = claimedTimestamp;}public LocalDateTime getDeliveredTimestamp() {return deliveredTimestamp;}public void setDeliveredTimestamp(LocalDateTime deliveredTimestamp) {this.deliveredTimestamp = deliveredTimestamp;}public String getStatusDescription() {return statusDescription;}public LocalDateTime getBilledTimestamp() {return billedTimestamp;}public void setBilledTimestamp(LocalDateTime billedTimestamp) {this.billedTimestamp = billedTimestamp;}public void setStatusDescription(String statusDescription) {this.statusDescription = statusDescription;}public void setStatus(OrderStatus status) {this.status = status;}public LocalDateTime getCancelledTimestamp() {return cancelledTimestamp;}public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {this.cancelledTimestamp = cancelledTimestamp;}public boolean isSettled() {return isSettled;}public void setSettled(boolean isSettled) {isSettled = isSettled;}public int getOriginalOrderId() {return originalOrderId;}public void setOriginalOrderId(int originalOrderId) {this.originalOrderId = originalOrderId;}@Column(name = "scheduled_delivery_time")private LocalDateTime scheduledDeliveryTime;@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name = "create_timestamp")private LocalDateTime createTimestamp = LocalDateTime.now();@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;PendingOrderItem that = (PendingOrderItem) o;return id == that.id && orderId == that.orderId && itemId == that.itemId && isSettled == that.isSettled && quantity == that.quantity && Float.compare(sellingPrice, that.sellingPrice) == 0 && originalOrderId == that.originalOrderId && Objects.equals(remark, that.remark) && Objects.equals(itemName, that.itemName) && Objects.equals(imgUrl, that.imgUrl) && Objects.equals(pendingOrder, that.pendingOrder) && status == that.status && Objects.equals(statusDescription, that.statusDescription) && Objects.equals(cancelledTimestamp, that.cancelledTimestamp) && Objects.equals(billedTimestamp, that.billedTimestamp) && Objects.equals(verifiedTimestamp, that.verifiedTimestamp) && Objects.equals(deliveredTimestamp, that.deliveredTimestamp) && Objects.equals(claimedTimestamp, that.claimedTimestamp) && Objects.equals(scheduledDeliveryTime, that.scheduledDeliveryTime) && Objects.equals(createTimestamp, that.createTimestamp);}@Overridepublic int hashCode() {return Objects.hash(id, orderId, itemId, remark, isSettled, itemName, imgUrl, quantity, sellingPrice, pendingOrder, status, statusDescription, cancelledTimestamp, billedTimestamp, verifiedTimestamp, deliveredTimestamp, claimedTimestamp, originalOrderId, scheduledDeliveryTime, createTimestamp);}public LocalDateTime getScheduledDeliveryTime() {return scheduledDeliveryTime;}public void setScheduledDeliveryTime(LocalDateTime scheduledDeliveryTime) {this.scheduledDeliveryTime = scheduledDeliveryTime;}public int getId() {return id;}public void setId(int id) {this.id = id;}public int getOrderId() {return orderId;}public void setOrderId(int orderId) {this.orderId = orderId;}public int getItemId() {return itemId;}public void setItemId(int itemId) {this.itemId = itemId;}public int getQuantity() {return quantity;}public void setQuantity(int quantity) {this.quantity = quantity;}public float getSellingPrice() {return sellingPrice;}public void setSellingPrice(float sellingPrice) {this.sellingPrice = sellingPrice;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}public static long getSerialversionuid() {return serialVersionUID;}public int getCatalogId() {return catalogId;}public void setCatalogId(int catalogId) {this.catalogId = catalogId;}@Overridepublic String toString() {return "PendingOrderItem{" +"id=" + id +", orderId=" + orderId +", itemId=" + itemId +", remark='" + remark + '\'' +", isSettled=" + isSettled +", itemName='" + itemName + '\'' +", imgUrl='" + imgUrl + '\'' +", quantity=" + quantity +", sellingPrice=" + sellingPrice +", pendingOrder=" + pendingOrder +", status=" + status +", statusDescription='" + statusDescription + '\'' +", cancelledTimestamp=" + cancelledTimestamp +", billedTimestamp=" + billedTimestamp +", verifiedTimestamp=" + verifiedTimestamp +", deliveredTimestamp=" + deliveredTimestamp +", claimedTimestamp=" + claimedTimestamp +", originalOrderId=" + originalOrderId +", scheduledDeliveryTime=" + scheduledDeliveryTime +", createTimestamp=" + createTimestamp +'}';}}