Subversion Repositories SmartDukaan

Rev

Rev 22859 | Rev 24402 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21714 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
21633 ashik.ali 2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
21984 kshitij.so 5
import java.time.format.DateTimeFormatter;
21633 ashik.ali 6
 
7
import javax.persistence.Column;
21639 kshitij.so 8
import javax.persistence.Convert;
21633 ashik.ali 9
import javax.persistence.Entity;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
13
import javax.persistence.Table;
23532 amit.gupta 14
import javax.persistence.Transient;
21633 ashik.ali 15
 
21639 kshitij.so 16
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
 
21633 ashik.ali 18
/**
19
 * This class basically contains api details
20
 * 
21
 * @author ashikali
22
 *
23
 */
24
@Entity
21637 kshitij.so 25
@Table(name="fofo.purchase", schema = "fofo")
26
 
21633 ashik.ali 27
public class Purchase implements Serializable{
21984 kshitij.so 28
 
21633 ashik.ali 29
	private static final long serialVersionUID = 1L;
30
 
31
	public Purchase() {
32
	}
33
 
34
	@Id
35
	@Column(name="id")
36
	@GeneratedValue(strategy = GenerationType.IDENTITY)
37
	private int id;
38
 
21640 kshitij.so 39
	@Column(name = "fofo_id")
40
	private int fofoId;
41
 
21653 ashik.ali 42
	@Column(name="purchase_reference")
21633 ashik.ali 43
	private String purchaseReference;
44
 
45
	@Column(name = "serialized_quantity")
46
	private int serializedQuantity;
47
 
48
	@Column(name = "non_serialized_quantity")
49
	private int nonSerializedQuantity;
50
 
51
	@Column(name = "unfullfilled_serialized_quantity")
52
	private int unfullfilledSerializedQuantity;
53
 
54
	@Column(name = "unfullfilled_non_serialized_quantity")
55
	private int unfullfilledNonSerializedQuantity;
56
 
22859 ashik.ali 57
	@Convert(converter = LocalDateTimeAttributeConverter.class)
58
	@Column(name = "complete_timestamp")
59
	private LocalDateTime completeTimestamp = null;
21633 ashik.ali 60
 
22859 ashik.ali 61
	@Column(name = "cashback")
62
	private float cashback;
63
 
21639 kshitij.so 64
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21633 ashik.ali 65
	@Column(name = "create_timestamp")
21640 kshitij.so 66
	private LocalDateTime createTimestamp = LocalDateTime.now();
21633 ashik.ali 67
 
23532 amit.gupta 68
	@Transient
69
	private LocalDateTime invoiceTimeStamp;
70
 
71
	public LocalDateTime getInvoiceTimeStamp() {
72
		return invoiceTimeStamp;
73
	}
74
	public void setInvoiceTimeStamp(LocalDateTime invoiceTimeStamp) {
75
		this.invoiceTimeStamp = invoiceTimeStamp;
76
	}
21633 ashik.ali 77
	public int getId() {
78
		return id;
79
	}
80
	public void setId(int id) {
81
		this.id = id;
82
	}
83
 
21640 kshitij.so 84
	public int getFofoId() {
85
		return fofoId;
86
	}
87
	public void setFofoId(int fofoId) {
88
		this.fofoId = fofoId;
89
	}
90
 
21633 ashik.ali 91
    public String getPurchaseReference() {
92
		return purchaseReference;
93
	}
94
	public void setPurchaseReference(String purchaseReference) {
95
		this.purchaseReference = purchaseReference;
96
	}
97
	public int getSerializedQuantity() {
98
		return serializedQuantity;
99
	}
100
	public void setSerializedQuantity(int serializedQuantity) {
101
		this.serializedQuantity = serializedQuantity;
102
	}
103
	public int getNonSerializedQuantity() {
104
		return nonSerializedQuantity;
105
	}
106
	public void setNonSerializedQuantity(int nonSerializedQuantity) {
107
		this.nonSerializedQuantity = nonSerializedQuantity;
108
	}
109
	public int getUnfullfilledSerializedQuantity() {
110
		return unfullfilledSerializedQuantity;
111
	}
112
	public void setUnfullfilledSerializedQuantity(int unfullfilledSerializedQuantity) {
113
		this.unfullfilledSerializedQuantity = unfullfilledSerializedQuantity;
114
	}
115
	public int getUnfullfilledNonSerializedQuantity() {
116
		return unfullfilledNonSerializedQuantity;
117
	}
118
	public void setUnfullfilledNonSerializedQuantity(int unfullfilledNonSerializedQuantity) {
119
		this.unfullfilledNonSerializedQuantity = unfullfilledNonSerializedQuantity;
120
	}
22859 ashik.ali 121
	public LocalDateTime getCompleteTimestamp() {
122
		return completeTimestamp;
21633 ashik.ali 123
	}
22859 ashik.ali 124
	public void setCompleteTimestamp(LocalDateTime completeTimestamp) {
125
		this.completeTimestamp = completeTimestamp;
21633 ashik.ali 126
	}
22859 ashik.ali 127
	public float getCashback() {
128
		return cashback;
129
	}
130
	public void setCashback(float cashback) {
131
		this.cashback = cashback;
132
	}
21924 ashik.ali 133
	public LocalDateTime getCreateTimestamp() {
134
		return createTimestamp;
135
	}
136
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
137
		this.createTimestamp = createTimestamp;
138
	}
139
 
21984 kshitij.so 140
    public String getFormattedDate(){
141
    	DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
142
		return this.createTimestamp.format(formatter);
143
    }
21633 ashik.ali 144
 
22009 ashik.ali 145
    @Override
146
	public int hashCode() {
147
		final int prime = 31;
148
		int result = 1;
149
		result = prime * result + id;
150
		return result;
151
	}
152
	@Override
153
	public boolean equals(Object obj) {
154
		if (this == obj)
155
			return true;
156
		if (obj == null)
157
			return false;
158
		if (getClass() != obj.getClass())
159
			return false;
160
		Purchase other = (Purchase) obj;
161
		if (id != other.id)
162
			return false;
163
		return true;
164
	}
165
	@Override
166
	public String toString() {
167
		return "Purchase [id=" + id + ", purchaseReference=" + purchaseReference + ", serializedQuantity="
168
				+ serializedQuantity + ", nonSerializedQuantity=" + nonSerializedQuantity
169
				+ ", unfullfilledSerializedQuantity=" + unfullfilledSerializedQuantity
22859 ashik.ali 170
				+ ", unfullfilledNonSerializedQuantity=" + unfullfilledNonSerializedQuantity + ", completedTimestamp="
171
				+ completeTimestamp + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp + "]";
22009 ashik.ali 172
	}
173
 
21633 ashik.ali 174
}