Subversion Repositories SmartDukaan

Rev

Rev 23202 | Rev 24264 | 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 com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

@Entity
@Table(name="fofo.fofo_order", schema = "fofo")
public class FofoOrder 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 = "customer_address_id")
        private int customerAddressId;
        
        @Column(name = "customer_gst_number")
        private String customerGstNumber;
        
        @Column(name = "total_amount")
        private float totalAmount;
        
        @Column(name = "invoice_number", length = 50)
        private String invoiceNumber;
        
        @Column(name = "cashback")
        private float cashback;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();    
        
        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 int getCustomerId() {
                return customerId;
        }
        public void setCustomerId(int customerId) {
                this.customerId = customerId;
        }
        public int getCustomerAddressId() {
                return customerAddressId;
        }
        public void setCustomerAddressId(int customerAddressId) {
                this.customerAddressId = customerAddressId;
        }
        public String getCustomerGstNumber() {
                return customerGstNumber;
        }
        public void setCustomerGstNumber(String customerGstNumber) {
                this.customerGstNumber = customerGstNumber;
        }
        public float getTotalAmount() {
                return totalAmount;
        }
        public void setTotalAmount(float totalAmount) {
                this.totalAmount = totalAmount;
        }
        public String getInvoiceNumber() {
                return invoiceNumber;
        }
        public void setInvoiceNumber(String invoiceNumber) {
                this.invoiceNumber = invoiceNumber;
        }
        public float getCashback() {
                return cashback;
        }
        public void setCashback(float cashback) {
                this.cashback = cashback;
        }
        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
        
        public String getFormattedDate(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
                return this.createTimestamp.format(formatter);
    }
        
        @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;
                FofoOrder other = (FofoOrder) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        
        @Override
        public String toString() {
                return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
                                + customerAddressId + ", customerGstNumber=" + customerGstNumber + ", totalAmount=" + totalAmount
                                + ", invoiceNumber=" + invoiceNumber + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp
                                + "]";
        }
        
}