Subversion Repositories SmartDukaan

Rev

Rev 23640 | Rev 31860 | 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
 
23639 amit.gupta 44
	@Column(name="id", columnDefinition = "int(11)")
23638 amit.gupta 45
	public int getId() {
46
		return id;
47
	}
48
 
23639 amit.gupta 49
 
23640 amit.gupta 50
	@Column(name = "type")
23639 amit.gupta 51
	@Enumerated(EnumType.STRING)
23638 amit.gupta 52
	private ReturnType returnType;
53
 
54
	public ReturnType getReturnType() {
55
		return returnType;
56
	}
57
 
58
	public void setReturnType(ReturnType returnType) {
59
		this.returnType = returnType;
60
	}
61
 
62
	@Transient
63
	private int quantity;
64
 
65
	public int getQuantity() {
66
		return quantity;
67
	}
68
 
69
	public void setQuantity(int quantity) {
70
		this.quantity = quantity;
71
	}
72
 
73
	public void setId(int id) {
74
		this.id = id;
75
	}
76
 
77
	@Override
78
	public String toString() {
79
		return "PurchaseReturnItem [id=" + id + ", returnType=" + returnType + ", quantity=" + quantity
80
				+ ", inventoryItemId=" + inventoryItemId + ", fofoId=" + fofoId + ", status=" + status
81
				+ ", debitNoteId=" + debitNoteId + ", createTimestamp=" + createTimestamp + ", approveTimestamp="
82
				+ approveTimestamp + ", denyTimestamp=" + denyTimestamp + ", pickupCreateTimestamp="
83
				+ pickupCreateTimestamp + ", scheduledPickupTimestamp=" + scheduledPickupTimestamp
84
				+ ", returnTimestamp=" + returnTimestamp + ", refundTimestamp=" + refundTimestamp + "]";
85
	}
86
 
23509 amit.gupta 87
	@Column(name = "inventory_item_id")
88
	private int inventoryItemId;
89
 
90
	@Column(name = "fofo_id")
91
	private int fofoId;
92
 
93
	@Column(name = "status")
94
	@Enumerated(EnumType.STRING)
95
	private PurchaseReturnStatus status = PurchaseReturnStatus.CREATED;
96
 
97
	@Column(name = "debit_note_id")
98
	private int debitNoteId;
99
 
100
	public int getDebitNoteId() {
101
		return debitNoteId;
102
	}
103
 
104
	public void setDebitNoteId(int debitNoteId) {
105
		this.debitNoteId = debitNoteId;
106
	}
107
 
108
	@Convert(converter = LocalDateTimeAttributeConverter.class)
109
	@Column(name = "create_timestamp")
110
	private LocalDateTime createTimestamp = LocalDateTime.now();
111
 
112
	@Convert(converter = LocalDateTimeAttributeConverter.class)
113
	@Column(name = "approve_timestamp")
114
	private LocalDateTime approveTimestamp;
115
 
116
	@Convert(converter = LocalDateTimeAttributeConverter.class)
117
	@Column(name = "deny_timestamp")
118
	private LocalDateTime denyTimestamp;
119
 
120
	@Convert(converter = LocalDateTimeAttributeConverter.class)
121
	@Column(name = "pickup_create_timestamp")
122
	private LocalDateTime pickupCreateTimestamp;
123
 
124
	@Convert(converter = LocalDateTimeAttributeConverter.class)
125
	@Column(name = "scheduled_pickup_timestamp")
126
	private LocalDateTime scheduledPickupTimestamp;
127
 
128
	@Convert(converter = LocalDateTimeAttributeConverter.class)
129
	@Column(name = "return_timestamp")
130
	private LocalDateTime returnTimestamp;
131
 
132
	@Convert(converter = LocalDateTimeAttributeConverter.class)
133
	@Column(name = "refund_timestamp")
134
	private LocalDateTime refundTimestamp;
135
 
136
	@Override
137
	public int hashCode() {
138
		final int prime = 31;
139
		int result = 1;
140
		result = prime * result + inventoryItemId;
141
		return result;
142
	}
143
 
144
	@Override
145
	public boolean equals(Object obj) {
146
		if (this == obj)
147
			return true;
148
		if (obj == null)
149
			return false;
150
		if (getClass() != obj.getClass())
151
			return false;
152
		PurchaseReturnItem other = (PurchaseReturnItem) obj;
153
		if (inventoryItemId != other.inventoryItemId)
154
			return false;
155
		return true;
156
	}
157
 
158
	public LocalDateTime getPickupCreateTimestamp() {
159
		return pickupCreateTimestamp;
160
	}
161
 
162
	public void setPickupCreateTimestamp(LocalDateTime pickupCreateTimestamp) {
163
		this.pickupCreateTimestamp = pickupCreateTimestamp;
164
	}
165
 
166
	public LocalDateTime getScheduledPickupTimestamp() {
167
		return scheduledPickupTimestamp;
168
	}
169
 
170
	public void setScheduledPickupTimestamp(LocalDateTime scheduledPickupTimestamp) {
171
		this.scheduledPickupTimestamp = scheduledPickupTimestamp;
172
	}
173
 
174
	public LocalDateTime getReturnTimestamp() {
175
		return returnTimestamp;
176
	}
177
 
178
	public void setReturnTimestamp(LocalDateTime returnTimestamp) {
179
		this.returnTimestamp = returnTimestamp;
180
	}
181
 
182
	public LocalDateTime getRefundTimestamp() {
183
		return refundTimestamp;
184
	}
185
 
186
	public void setRefundTimestamp(LocalDateTime refundTimestamp) {
187
		this.refundTimestamp = refundTimestamp;
188
	}
189
 
190
	public int getInventoryItemId() {
191
		return inventoryItemId;
192
	}
193
 
194
	public void setInventoryItemId(int inventoryItemId) {
195
		this.inventoryItemId = inventoryItemId;
196
	}
197
 
198
	public int getFofoId() {
199
		return fofoId;
200
	}
201
 
202
	public void setFofoId(int fofoId) {
203
		this.fofoId = fofoId;
204
	}
205
 
206
	public PurchaseReturnStatus getStatus() {
207
		return status;
208
	}
209
 
210
	public void setStatus(PurchaseReturnStatus status) {
211
		this.status = status;
212
	}
213
 
214
	public LocalDateTime getCreateTimestamp() {
215
		return createTimestamp;
216
	}
217
 
218
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
219
		this.createTimestamp = createTimestamp;
220
	}
221
 
222
	public String getFormattedCreateTimestamp() {
223
		if (createTimestamp == null) {
224
			return null;
225
		}
24402 amit.gupta 226
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
23509 amit.gupta 227
		return createTimestamp.format(formatter);
228
	}
229
 
230
	public String getFormattedApproveTimestamp() {
231
		if (approveTimestamp == null) {
232
			return null;
233
		}
24402 amit.gupta 234
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
23509 amit.gupta 235
		return approveTimestamp.format(formatter);
236
	}
237
 
238
	public LocalDateTime getApproveTimestamp() {
239
		return approveTimestamp;
240
	}
241
 
242
	public void setApproveTimestamp(LocalDateTime approvedTimestamp) {
243
		this.approveTimestamp = approvedTimestamp;
244
	}
245
 
246
	public LocalDateTime getDenyTimestamp() {
247
		return denyTimestamp;
248
	}
249
 
250
	public void setDenyTimestamp(LocalDateTime denyTimestamp) {
251
		this.denyTimestamp = denyTimestamp;
252
	}
253
}