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