Subversion Repositories SmartDukaan

Rev

Rev 28241 | Rev 34183 | 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 java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Convert;
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.Table;
import javax.persistence.Transient;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;

/**
 * @author amit
 *
 */
@Entity
@Table(name = "fofo.pending_order")
public class LoanTransaction implements Serializable {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        @Id
        @Column(name = "id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;

        @Column(name = "fofo_id")
        private int fofoId;

        @Column(name = "customer_id")
        private int customerId;

        @Column(name = "pay_method")
        private String payMethod;

        @Column(name = "customer_gst_number")
        private String customerGstNumber;

        @Column(name = "customer_address_id")
        private int customerAddressId;

        @Column(name = "status")
        @Enumerated(EnumType.STRING)
        private OrderStatus status;

        public OrderStatus getStatus() {
                return status;
        }

        public void setStatus(OrderStatus status) {
                this.status = status;
        }

        @Transient
        private Customer customer;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();

        @Column(name = "total_amount")
        private double totalAmount;
        @Column(name = "cancelled_amount")
        private double cancelledAmount;
        @Column(name = "refunded_amount")
        private double refundedAmount;
        @Column(name = "paid_amount")
        private double paidAmount;
        @Column(name = "billed_amount")
        private double billedAmount;

        @Transient
        private List<PendingOrderItem> pendingOrderItems;

        public List<PendingOrderItem> getPendingOrderItems() {
                return pendingOrderItems;
        }

        public void setPendingOrderItems(List<PendingOrderItem> pendingOrderItems) {
                this.pendingOrderItems = pendingOrderItems;
        }

        @Override
        public String toString() {
                return "PendingOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", payMethod="
                                + payMethod + ", customerGstNumber=" + customerGstNumber + ", customerAddressId=" + customerAddressId
                                + ", status=" + status + ", customer=" + customer + ", createTimestamp=" + createTimestamp
                                + ", totalAmount=" + totalAmount + ", cancelledAmount=" + cancelledAmount + ", refundedAmount="
                                + refundedAmount + ", paidAmount=" + paidAmount + ", billedAmount=" + billedAmount
                                + ", pendingOrderItems=" + pendingOrderItems + "]";
        }

        public int getId() {
                return id;
        }

        public Customer getCustomer() {
                return customer;
        }

        public void setCustomer(Customer customer) {
                this.customer = customer;
        }

        public void setId(int id) {
                this.id = id;
        }

        public int getFofoId() {
                return fofoId;
        }

        public String getPayMethod() {
                return payMethod;
        }

        public void setPayMethod(String payMethod) {
                this.payMethod = payMethod;
        }

        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        public int getCustomerId() {
                return customerId;
        }

        public void setCustomerId(int customerId) {
                this.customerId = customerId;
        }

        public String getCustomerGstNumber() {
                return customerGstNumber;
        }

        public void setCustomerGstNumber(String customerGstNumber) {
                this.customerGstNumber = customerGstNumber;
        }

        public int getCustomerAddressId() {
                return customerAddressId;
        }

        public void setCustomerAddressId(int customerAddressId) {
                this.customerAddressId = customerAddressId;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }

        public double getTotalAmount() {
                return totalAmount;
        }

        public void setTotalAmount(double totalAmount) {
                this.totalAmount = totalAmount;
        }

        public double getCancelledAmount() {
                return cancelledAmount;
        }

        public void setCancelledAmount(double cancelledAmount) {
                this.cancelledAmount = cancelledAmount;
        }

        public double getRefundedAmount() {
                return refundedAmount;
        }

        public void setRefundedAmount(double refundedAmount) {
                this.refundedAmount = refundedAmount;
        }

        public double getPaidAmount() {
                return paidAmount;
        }

        public void setPaidAmount(double paidAmount) {
                this.paidAmount = paidAmount;
        }

        public double getBilledAmount() {
                return billedAmount;
        }

        public void setBilledAmount(double billedAmount) {
                this.billedAmount = billedAmount;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                long temp;
                temp = Double.doubleToLongBits(billedAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                temp = Double.doubleToLongBits(cancelledAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                result = prime * result + ((customer == null) ? 0 : customer.hashCode());
                result = prime * result + customerAddressId;
                result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
                result = prime * result + customerId;
                result = prime * result + fofoId;
                result = prime * result + id;
                temp = Double.doubleToLongBits(paidAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((payMethod == null) ? 0 : payMethod.hashCode());
                result = prime * result + ((pendingOrderItems == null) ? 0 : pendingOrderItems.hashCode());
                temp = Double.doubleToLongBits(refundedAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((status == null) ? 0 : status.hashCode());
                temp = Double.doubleToLongBits(totalAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                LoanTransaction other = (LoanTransaction) obj;
                if (Double.doubleToLongBits(billedAmount) != Double.doubleToLongBits(other.billedAmount))
                        return false;
                if (Double.doubleToLongBits(cancelledAmount) != Double.doubleToLongBits(other.cancelledAmount))
                        return false;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (customer == null) {
                        if (other.customer != null)
                                return false;
                } else if (!customer.equals(other.customer))
                        return false;
                if (customerAddressId != other.customerAddressId)
                        return false;
                if (customerGstNumber == null) {
                        if (other.customerGstNumber != null)
                                return false;
                } else if (!customerGstNumber.equals(other.customerGstNumber))
                        return false;
                if (customerId != other.customerId)
                        return false;
                if (fofoId != other.fofoId)
                        return false;
                if (id != other.id)
                        return false;
                if (Double.doubleToLongBits(paidAmount) != Double.doubleToLongBits(other.paidAmount))
                        return false;
                if (payMethod == null) {
                        if (other.payMethod != null)
                                return false;
                } else if (!payMethod.equals(other.payMethod))
                        return false;
                if (pendingOrderItems == null) {
                        if (other.pendingOrderItems != null)
                                return false;
                } else if (!pendingOrderItems.equals(other.pendingOrderItems))
                        return false;
                if (Double.doubleToLongBits(refundedAmount) != Double.doubleToLongBits(other.refundedAmount))
                        return false;
                if (status != other.status)
                        return false;
                if (Double.doubleToLongBits(totalAmount) != Double.doubleToLongBits(other.totalAmount))
                        return false;
                return true;
        }

}