Subversion Repositories SmartDukaan

Rev

Rev 26042 | 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.time.format.DateTimeFormatter;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

@Entity
@Table(name="fofo.prebooking_order", uniqueConstraints = {@UniqueConstraint(columnNames = {"catalog_id", "customer_mobile_number"})})
public class PrebookingOrder 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_name")
        private String customerName;
        
        @Column(name = "customer_mobile_number")
        private String customerMobileNumber;
        
        @Column(name = "customer_email_id")
        private String customerEmailId;
        
        @Column(name = "catalog_id")
        private int catalogId;
        
        @Column(name = "quantity")
        private int quantity;
        
        public int getCatalogId() {
                return catalogId;
        }

        public void setCatalogId(int catalogId) {
                this.catalogId = catalogId;
        }

        @Column(name = "available_quantity")
        private int availableQuantity;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "complete_timestamp")
        private LocalDateTime completeTimestamp = null;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "notify_timestamp")
        private LocalDateTime notifyTimeStamp = null;
        
        @Transient
        private String description;
        
        @Column(name = "advance_paid")
        private float advanceAmount;
        
        @Transient
        private float tentativeAmount;
        
        public LocalDateTime getNotifyTimeStamp() {
                return notifyTimeStamp;
        }

        public void setNotifyTimeStamp(LocalDateTime notifyTimeStamp) {
                this.notifyTimeStamp = notifyTimeStamp;
        }

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }
        
        public int getFofoId() {
                return fofoId;
        }
        
        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        public String getCustomerName() {
                return customerName;
        }

        public void setCustomerName(String customerName) {
                this.customerName = customerName;
        }

        public String getCustomerMobileNumber() {
                return customerMobileNumber;
        }

        public void setCustomerMobileNumber(String customerMobileNumber) {
                this.customerMobileNumber = customerMobileNumber;
        }

        public String getCustomerEmailId() {
                return customerEmailId;
        }

        public void setCustomerEmailId(String customerEmailId) {
                this.customerEmailId = customerEmailId;
        }

        public int getQuantity() {
                return quantity;
        }

        public void setQuantity(int quantity) {
                this.quantity = quantity;
        }
        
        public int getAvailableQuantity() {
                return availableQuantity;
        }
        
        public void setAvailableQuantity(int availableQuantity) {
                this.availableQuantity = availableQuantity;
        }
        
        public LocalDateTime getCompleteTimestamp() {
                return completeTimestamp;
        }
        
        public void setCompleteTimestamp(LocalDateTime completeTimestamp) {
                this.completeTimestamp = completeTimestamp;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
        
        public String getFormattedCreateTimestamp(){
                if(createTimestamp == null){
                        return null;
                }
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
                return createTimestamp.format(formatter);
    }
        
        public String getDescription() {
                return description;
        }
        public void setDescription(String description) {
                this.description = description;
        }
        
        public float getAdvanceAmount() {
                return advanceAmount;
        }
        public void setAdvanceAmount(float advanceAmount) {
                this.advanceAmount = advanceAmount;
        }
        public float getTentativeAmount() {
                return tentativeAmount;
        }
        public void setTentativeAmount(float tentativeAmount) {
                this.tentativeAmount = tentativeAmount;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + id;
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                PrebookingOrder other = (PrebookingOrder) obj;
                if (id != other.id)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "PrebookingOrder [id=" + id + ", fofoId=" + fofoId + ", customerName=" + customerName
                                + ", customerMobileNumber=" + customerMobileNumber + ", customerEmailId=" + customerEmailId
                                + ", catalogId=" + catalogId + ", quantity=" + quantity + ", availableQuantity=" + availableQuantity
                                + ", completeTimestamp=" + completeTimestamp + ", createTimestamp=" + createTimestamp
                                + ", notifyTimeStamp=" + notifyTimeStamp + ", description=" + description + ", advanceAmount="
                                + advanceAmount + ", tentativeAmount=" + tentativeAmount + "]";
        }
        
}