Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
23509 amit.gupta 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
import java.time.format.DateTimeFormatter;
6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.EnumType;
11
import javax.persistence.Enumerated;
23638 amit.gupta 12
import javax.persistence.GeneratedValue;
13
import javax.persistence.GenerationType;
23509 amit.gupta 14
import javax.persistence.Id;
15
import javax.persistence.Table;
23638 amit.gupta 16
import javax.persistence.Transient;
23509 amit.gupta 17
 
18
import com.spice.profitmandi.common.enumuration.PurchaseReturnStatus;
19
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
23638 amit.gupta 20
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;
23509 amit.gupta 21
 
22
/**
23
 * This class basically contains api details
24
 * 
25
 * @author ashikali
26
 *
27
 */
23638 amit.gupta 28
/**
29
 * @author amit
30
 *
31
 */
23509 amit.gupta 32
@Entity
33
@Table(name = "fofo.purchase_return_item", schema = "fofo")
34
 
35
public class PurchaseReturnItem implements Serializable {
36
 
37
	private static final long serialVersionUID = 1L;
38
 
39
	@Id
23638 amit.gupta 40
	@Column(name="id", columnDefinition = "int(11)")
41
	@GeneratedValue(strategy = GenerationType.IDENTITY)
42
	private int id;
43
 
44
	public int getId() {
45
		return id;
46
	}
47
 
48
	private ReturnType returnType;
49
 
50
	public ReturnType getReturnType() {
51
		return returnType;
52
	}
53
 
54
	public void setReturnType(ReturnType returnType) {
55
		this.returnType = returnType;
56
	}
57
 
58
	@Transient
59
	private int quantity;
60
 
61
	public int getQuantity() {
62
		return quantity;
63
	}
64
 
65
	public void setQuantity(int quantity) {
66
		this.quantity = quantity;
67
	}
68
 
69
	public void setId(int id) {
70
		this.id = id;
71
	}
72
 
73
	@Override
74
	public String toString() {
75
		return "PurchaseReturnItem [id=" + id + ", returnType=" + returnType + ", quantity=" + quantity
76
				+ ", inventoryItemId=" + inventoryItemId + ", fofoId=" + fofoId + ", status=" + status
77
				+ ", debitNoteId=" + debitNoteId + ", createTimestamp=" + createTimestamp + ", approveTimestamp="
78
				+ approveTimestamp + ", denyTimestamp=" + denyTimestamp + ", pickupCreateTimestamp="
79
				+ pickupCreateTimestamp + ", scheduledPickupTimestamp=" + scheduledPickupTimestamp
80
				+ ", returnTimestamp=" + returnTimestamp + ", refundTimestamp=" + refundTimestamp + "]";
81
	}
82
 
23509 amit.gupta 83
	@Column(name = "inventory_item_id")
84
	private int inventoryItemId;
85
 
86
	@Column(name = "fofo_id")
87
	private int fofoId;
88
 
89
	@Column(name = "status")
90
	@Enumerated(EnumType.STRING)
91
	private PurchaseReturnStatus status = PurchaseReturnStatus.CREATED;
92
 
93
	@Column(name = "debit_note_id")
94
	private int debitNoteId;
95
 
96
	public int getDebitNoteId() {
97
		return debitNoteId;
98
	}
99
 
100
	public void setDebitNoteId(int debitNoteId) {
101
		this.debitNoteId = debitNoteId;
102
	}
103
 
104
	@Convert(converter = LocalDateTimeAttributeConverter.class)
105
	@Column(name = "create_timestamp")
106
	private LocalDateTime createTimestamp = LocalDateTime.now();
107
 
108
	@Convert(converter = LocalDateTimeAttributeConverter.class)
109
	@Column(name = "approve_timestamp")
110
	private LocalDateTime approveTimestamp;
111
 
112
	@Convert(converter = LocalDateTimeAttributeConverter.class)
113
	@Column(name = "deny_timestamp")
114
	private LocalDateTime denyTimestamp;
115
 
116
	@Convert(converter = LocalDateTimeAttributeConverter.class)
117
	@Column(name = "pickup_create_timestamp")
118
	private LocalDateTime pickupCreateTimestamp;
119
 
120
	@Convert(converter = LocalDateTimeAttributeConverter.class)
121
	@Column(name = "scheduled_pickup_timestamp")
122
	private LocalDateTime scheduledPickupTimestamp;
123
 
124
	@Convert(converter = LocalDateTimeAttributeConverter.class)
125
	@Column(name = "return_timestamp")
126
	private LocalDateTime returnTimestamp;
127
 
128
	@Convert(converter = LocalDateTimeAttributeConverter.class)
129
	@Column(name = "refund_timestamp")
130
	private LocalDateTime refundTimestamp;
131
 
132
	@Override
133
	public int hashCode() {
134
		final int prime = 31;
135
		int result = 1;
136
		result = prime * result + inventoryItemId;
137
		return result;
138
	}
139
 
140
	@Override
141
	public boolean equals(Object obj) {
142
		if (this == obj)
143
			return true;
144
		if (obj == null)
145
			return false;
146
		if (getClass() != obj.getClass())
147
			return false;
148
		PurchaseReturnItem other = (PurchaseReturnItem) obj;
149
		if (inventoryItemId != other.inventoryItemId)
150
			return false;
151
		return true;
152
	}
153
 
154
	public LocalDateTime getPickupCreateTimestamp() {
155
		return pickupCreateTimestamp;
156
	}
157
 
158
	public void setPickupCreateTimestamp(LocalDateTime pickupCreateTimestamp) {
159
		this.pickupCreateTimestamp = pickupCreateTimestamp;
160
	}
161
 
162
	public LocalDateTime getScheduledPickupTimestamp() {
163
		return scheduledPickupTimestamp;
164
	}
165
 
166
	public void setScheduledPickupTimestamp(LocalDateTime scheduledPickupTimestamp) {
167
		this.scheduledPickupTimestamp = scheduledPickupTimestamp;
168
	}
169
 
170
	public LocalDateTime getReturnTimestamp() {
171
		return returnTimestamp;
172
	}
173
 
174
	public void setReturnTimestamp(LocalDateTime returnTimestamp) {
175
		this.returnTimestamp = returnTimestamp;
176
	}
177
 
178
	public LocalDateTime getRefundTimestamp() {
179
		return refundTimestamp;
180
	}
181
 
182
	public void setRefundTimestamp(LocalDateTime refundTimestamp) {
183
		this.refundTimestamp = refundTimestamp;
184
	}
185
 
186
	public int getInventoryItemId() {
187
		return inventoryItemId;
188
	}
189
 
190
	public void setInventoryItemId(int inventoryItemId) {
191
		this.inventoryItemId = inventoryItemId;
192
	}
193
 
194
	public int getFofoId() {
195
		return fofoId;
196
	}
197
 
198
	public void setFofoId(int fofoId) {
199
		this.fofoId = fofoId;
200
	}
201
 
202
	public PurchaseReturnStatus getStatus() {
203
		return status;
204
	}
205
 
206
	public void setStatus(PurchaseReturnStatus status) {
207
		this.status = status;
208
	}
209
 
210
	public LocalDateTime getCreateTimestamp() {
211
		return createTimestamp;
212
	}
213
 
214
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
215
		this.createTimestamp = createTimestamp;
216
	}
217
 
218
	public String getFormattedCreateTimestamp() {
219
		if (createTimestamp == null) {
220
			return null;
221
		}
222
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
223
		return createTimestamp.format(formatter);
224
	}
225
 
226
	public String getFormattedApproveTimestamp() {
227
		if (approveTimestamp == null) {
228
			return null;
229
		}
230
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
231
		return approveTimestamp.format(formatter);
232
	}
233
 
234
	public LocalDateTime getApproveTimestamp() {
235
		return approveTimestamp;
236
	}
237
 
238
	public void setApproveTimestamp(LocalDateTime approvedTimestamp) {
239
		this.approveTimestamp = approvedTimestamp;
240
	}
241
 
242
	public LocalDateTime getDenyTimestamp() {
243
		return denyTimestamp;
244
	}
245
 
246
	public void setDenyTimestamp(LocalDateTime denyTimestamp) {
247
		this.denyTimestamp = denyTimestamp;
248
	}
249
}