Rev 21819 | Rev 21989 | 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 java.io.Serializable;import java.time.LocalDateTime;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.EnumType;import javax.persistence.Enumerated;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;import in.shop2020.model.v1.order.TransactionStatus;/*** This class basically contains transaction details** @author ashikali**/@Entity@Table(name="transaction.transaction", schema = "transaction")@NamedQueries({@NamedQuery(name = "Transaction.selectCount", query = "select count(t) from Transaction t"),@NamedQuery(name = "Transaction.selectCountByRetailerId", query = "select count(t) from Transaction t where t.retailerId = :retailerId"),@NamedQuery(name="Transaction.selectAll", query="select t from Transaction t"),//and t.status in (1,2,4,5,6)@NamedQuery(name="Transaction.selectById", query="select t from Transaction t where t.id= :id"),@NamedQuery(name = "Transaction.selectIdsByRetailerId", query = "select t.id from Transaction t where t.retailerId = :retailerId order by id desc"),@NamedQuery(name = "Transaction.selectByIds",query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name, o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status from Transaction t join Order o on o.transactionId = t.id "+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId where t.id in :ids order by t.id desc")})public class Transaction implements Serializable{private static final long serialVersionUID = 1L;public Transaction() {}@Id@Column(name="id", unique=true, updatable=false)@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "createdOn")private LocalDateTime createTimestamp;@Enumerated(EnumType.ORDINAL)@Column(name = "status")private TransactionStatus status;@Column(name = "status_message", length = 100)private String statusMessage;@Column(name = "customer_id")private int retailerId;@Column(name = "shopping_cart_id")private int shoppingCartId;@Column(name = "coupon_code", length = 20)private String couponCode;@Column(name = "session_source", length = 100)private String sessionSource;@Column(name = "session_start_time")private LocalDateTime sessionStateTime;@Column(name = "first_source")private String firstSource;@Column(name = "first_source_start_time")private LocalDateTime firstSourceStateTime;@Column(name = "totalShippingCost")private float totalShippingCost;@Column(name = "totalCodCharges")private float totalCodCharges;@Column(name = "payment_option")private int paymentOption;public int getId() {return id;}public void setId(int id) {this.id = id;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}public TransactionStatus getStatus() {return status;}public void setStatus(TransactionStatus status) {this.status = status;}public String getStatusMessage() {return statusMessage;}public void setStatusMessage(String statusMessage) {this.statusMessage = statusMessage;}public int getRetailerId() {return retailerId;}public void setRetailerId(int retailerId) {this.retailerId = retailerId;}public int getShoppingCartId() {return shoppingCartId;}public void setShoppingCartId(int shoppingCartId) {this.shoppingCartId = shoppingCartId;}public String getCouponCode() {return couponCode;}public void setCouponCode(String couponCode) {this.couponCode = couponCode;}public String getSessionSource() {return sessionSource;}public void setSessionSource(String sessionSource) {this.sessionSource = sessionSource;}public LocalDateTime getSessionStateTime() {return sessionStateTime;}public void setSessionStateTime(LocalDateTime sessionStateTime) {this.sessionStateTime = sessionStateTime;}public String getFirstSource() {return firstSource;}public void setFirstSource(String firstSource) {this.firstSource = firstSource;}public LocalDateTime getFirstSourceStateTime() {return firstSourceStateTime;}public void setFirstSourceStateTime(LocalDateTime firstSourceStateTime) {this.firstSourceStateTime = firstSourceStateTime;}public float getTotalShippingCost() {return totalShippingCost;}public void setTotalShippingCost(float totalShippingCost) {this.totalShippingCost = totalShippingCost;}public float getTotalCodCharges() {return totalCodCharges;}public void setTotalCodCharges(float totalCodCharges) {this.totalCodCharges = totalCodCharges;}public int getPaymentOption() {return paymentOption;}public void setPaymentOption(int paymentOption) {this.paymentOption = paymentOption;}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + ((couponCode == null) ? 0 : couponCode.hashCode());result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());result = prime * result + ((firstSource == null) ? 0 : firstSource.hashCode());result = prime * result + ((firstSourceStateTime == null) ? 0 : firstSourceStateTime.hashCode());result = prime * result + id;result = prime * result + paymentOption;result = prime * result + retailerId;result = prime * result + ((sessionSource == null) ? 0 : sessionSource.hashCode());result = prime * result + ((sessionStateTime == null) ? 0 : sessionStateTime.hashCode());result = prime * result + shoppingCartId;result = prime * result + ((status == null) ? 0 : status.hashCode());result = prime * result + ((statusMessage == null) ? 0 : statusMessage.hashCode());result = prime * result + Float.floatToIntBits(totalCodCharges);result = prime * result + Float.floatToIntBits(totalShippingCost);return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Transaction other = (Transaction) obj;if (couponCode == null) {if (other.couponCode != null)return false;} else if (!couponCode.equals(other.couponCode))return false;if (createTimestamp == null) {if (other.createTimestamp != null)return false;} else if (!createTimestamp.equals(other.createTimestamp))return false;if (firstSource == null) {if (other.firstSource != null)return false;} else if (!firstSource.equals(other.firstSource))return false;if (firstSourceStateTime == null) {if (other.firstSourceStateTime != null)return false;} else if (!firstSourceStateTime.equals(other.firstSourceStateTime))return false;if (id != other.id)return false;if (paymentOption != other.paymentOption)return false;if (retailerId != other.retailerId)return false;if (sessionSource == null) {if (other.sessionSource != null)return false;} else if (!sessionSource.equals(other.sessionSource))return false;if (sessionStateTime == null) {if (other.sessionStateTime != null)return false;} else if (!sessionStateTime.equals(other.sessionStateTime))return false;if (shoppingCartId != other.shoppingCartId)return false;if (status != other.status)return false;if (statusMessage == null) {if (other.statusMessage != null)return false;} else if (!statusMessage.equals(other.statusMessage))return false;if (Float.floatToIntBits(totalCodCharges) != Float.floatToIntBits(other.totalCodCharges))return false;if (Float.floatToIntBits(totalShippingCost) != Float.floatToIntBits(other.totalShippingCost))return false;return true;}@Overridepublic String toString() {return "Transaction [createTimestamp=" + createTimestamp + ", status=" + status + ", statusMessage="+ statusMessage + ", retailerId=" + retailerId + ", shoppingCartId=" + shoppingCartId + ", couponCode="+ couponCode + ", sessionSource=" + sessionSource + ", sessionStateTime=" + sessionStateTime+ ", firstSource=" + firstSource + ", firstSourceStateTime=" + firstSourceStateTime+ ", totalShippingCost=" + totalShippingCost + ", totalCodCharges=" + totalCodCharges+ ", paymentOption=" + paymentOption + "]";}}