Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
23110 ashik.ali 1
package com.spice.profitmandi.dao.entity.transaction;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
23819 govind 5
import java.time.format.DateTimeFormatter;
23110 ashik.ali 6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
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;
23968 amit.gupta 14
import javax.persistence.Transient;
23110 ashik.ali 15
 
16
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
 
18
/**
23819 govind 19
 * This class basically contains details
23110 ashik.ali 20
 * 
21
 * @author ashikali
22
 *
23
 */
23968 amit.gupta 24
/**
25
 * @author amit
26
 *
27
 */
23110 ashik.ali 28
@Entity
23819 govind 29
@Table(name = "transaction.price_drop", schema = "transaction")
30
public class PriceDrop implements Serializable {
31
 
23110 ashik.ali 32
	private static final long serialVersionUID = 1L;
23819 govind 33
 
23110 ashik.ali 34
	public PriceDrop() {
35
	}
23819 govind 36
 
23110 ashik.ali 37
	@Id
23819 govind 38
	@Column(name = "id")
23110 ashik.ali 39
	@GeneratedValue(strategy = GenerationType.IDENTITY)
40
	private int id;
23819 govind 41
 
23951 amit.gupta 42
	@Column(name = "catalog_id")
43
	private int catalogItemId;
24410 amit.gupta 44
 
45
	@Column(name = "amount")
46
	private float amount;
23968 amit.gupta 47
 
24410 amit.gupta 48
	@Column(name="new_dp")
49
	private float newDp;
50
 
51
	@Column(name="old_dp")
52
	private float oldDp;
53
 
54
	@Column(name="mop")
55
	private float mop;
56
 
57
	@Column(name="tp")
58
	private float tp;
59
 
60
	@Column(name="nlc")
61
	private float nlc;
62
 
23968 amit.gupta 63
	@Transient
64
	private String description;
23819 govind 65
 
23968 amit.gupta 66
	public String getDescription() {
67
		return description;
68
	}
69
 
70
	public void setDescription(String description) {
71
		this.description = description;
72
	}
73
 
74
 
24049 amit.gupta 75
	public float getMop() {
76
		return mop;
77
	}
78
 
79
	public void setMop(float mop) {
80
		this.mop = mop;
81
	}
82
 
23819 govind 83
 
23968 amit.gupta 84
	public float getNewDp() {
85
		return newDp;
86
	}
87
 
88
	public void setNewDp(float newDp) {
89
		this.newDp = newDp;
90
	}
91
 
92
	public float getOldDp() {
93
		return oldDp;
94
	}
95
 
96
	public void setOldDp(float oldDp) {
97
		this.oldDp = oldDp;
98
	}
99
 
100
	public float getTp() {
101
		return tp;
102
	}
103
 
104
	public void setTp(float tp) {
105
		this.tp = tp;
106
	}
107
 
108
	public float getNlc() {
109
		return nlc;
110
	}
111
 
112
	public void setNlc(float nlc) {
113
		this.nlc = nlc;
114
	}
115
 
23819 govind 116
	@Column(name = "credit_note_number")
117
	private String creditNoteNumber;
118
 
23110 ashik.ali 119
	@Convert(converter = LocalDateTimeAttributeConverter.class)
120
	@Column(name = "process_timestamp")
23874 amit.gupta 121
	private LocalDateTime processTimestamp;
23819 govind 122
 
26400 amit.gupta 123
	@Convert(converter = LocalDateTimeAttributeConverter.class)
124
	@Column(name = "complete_timestamp")
125
	private LocalDateTime completeTimestamp;
23823 amit.gupta 126
 
26400 amit.gupta 127
 
23823 amit.gupta 128
	@Column(name = "price_drop_in")
129
	private float priceDropIn;
130
 
131
	@Column(name = "partner_payout")
132
	private float partnerPayout;
23819 govind 133
 
134
	@Convert(converter = LocalDateTimeAttributeConverter.class)
135
	@Column(name = "created_on")
136
	private LocalDateTime createdOn = LocalDateTime.now();
137
 
138
	@Convert(converter = LocalDateTimeAttributeConverter.class)
139
	@Column(name = "affected_on")
23874 amit.gupta 140
	private LocalDateTime affectedOn = LocalDateTime.now();
23819 govind 141
 
142
	@Convert(converter = LocalDateTimeAttributeConverter.class)
143
	@Column(name = "credit_note_date")
23874 amit.gupta 144
	private LocalDateTime creditNoteDate;
23819 govind 145
 
23110 ashik.ali 146
	public int getId() {
147
		return id;
148
	}
23819 govind 149
 
23110 ashik.ali 150
	public void setId(int id) {
151
		this.id = id;
152
	}
23823 amit.gupta 153
 
154
 
155
 
23819 govind 156
 
23823 amit.gupta 157
	public float getPriceDropIn() {
158
		return priceDropIn;
159
	}
160
 
161
	public void setPriceDropIn(float priceDropIn) {
162
		this.priceDropIn = priceDropIn;
163
	}
164
 
23951 amit.gupta 165
	public int getCatalogItemId() {
166
		return catalogItemId;
23110 ashik.ali 167
	}
23819 govind 168
 
23951 amit.gupta 169
	public void setCatalogItemId(int catalogItemId) {
170
		this.catalogItemId = catalogItemId;
23110 ashik.ali 171
	}
23819 govind 172
 
23951 amit.gupta 173
	@Override
174
	public String toString() {
23968 amit.gupta 175
		return "PriceDrop [id=" + id + ", catalogItemId=" + catalogItemId + ", description=" + description + ", amount="
24049 amit.gupta 176
				+ amount + ", newDp=" + newDp + ", mop=" + mop + ", oldDp=" + oldDp + ", tp=" + tp + ", nlc=" + nlc
23968 amit.gupta 177
				+ ", creditNoteNumber=" + creditNoteNumber + ", processTimestamp=" + processTimestamp + ", priceDropIn="
178
				+ priceDropIn + ", partnerPayout=" + partnerPayout + ", createdOn=" + createdOn + ", affectedOn="
179
				+ affectedOn + ", creditNoteDate=" + creditNoteDate + "]";
23951 amit.gupta 180
	}
181
 
23110 ashik.ali 182
	public float getAmount() {
183
		return amount;
184
	}
23819 govind 185
 
23110 ashik.ali 186
	public void setAmount(float amount) {
187
		this.amount = amount;
188
	}
23819 govind 189
 
23110 ashik.ali 190
	public LocalDateTime getProcessTimestamp() {
191
		return processTimestamp;
192
	}
23819 govind 193
 
23110 ashik.ali 194
	public void setProcessTimestamp(LocalDateTime processTimestamp) {
195
		this.processTimestamp = processTimestamp;
196
	}
23819 govind 197
 
198
	public String getCreditNoteNumber() {
199
		return creditNoteNumber;
200
	}
201
 
202
	public void setCreditNoteNumber(String creditNoteNumber) {
203
		this.creditNoteNumber = creditNoteNumber;
204
	}
205
 
206
	public LocalDateTime getCreatedOn() {
207
		return createdOn;
208
	}
209
 
210
	public void setCreatedOn(LocalDateTime createdOn) {
211
		this.createdOn = createdOn;
212
	}
213
 
23110 ashik.ali 214
 
23819 govind 215
 
23874 amit.gupta 216
	public LocalDateTime getAffectedOn() {
217
		return affectedOn;
23819 govind 218
	}
219
 
23874 amit.gupta 220
	public void setAffectedOn(LocalDateTime affectedOn) {
221
		this.affectedOn = affectedOn;
23819 govind 222
	}
223
 
224
	public LocalDateTime getCreditNoteDate() {
225
		return creditNoteDate;
226
	}
227
 
228
	public void setCreditNoteDate(LocalDateTime creditNoteDate) {
229
		this.creditNoteDate = creditNoteDate;
230
	}
231
 
23823 amit.gupta 232
	public float getPartnerPayout() {
233
		return partnerPayout;
23819 govind 234
	}
235
 
26340 amit.gupta 236
	public float getDropAmount() {
237
		return oldDp - newDp;
238
	}
26332 amit.gupta 239
	public float getAutoPartnerPayout() {
240
		if(this.getPartnerPayout() == 0) {
26340 amit.gupta 241
			return this.getDropAmount()/1.12f;
26332 amit.gupta 242
		} else {
243
			return this.getPartnerPayout();
244
		}
245
	}
246
 
23823 amit.gupta 247
	public void setPartnerPayout(float partnerPayout) {
248
		this.partnerPayout = partnerPayout;
23819 govind 249
	}
250
 
251
	public String getDate(LocalDateTime ldt) {
252
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
253
		String s = dtf.format(ldt);
254
		return s;
255
	}
256
 
26400 amit.gupta 257
 
258
	public LocalDateTime getCompleteTimestamp() {
259
		return completeTimestamp;
260
	}
261
 
262
	public void setCompleteTimestamp(LocalDateTime completeTimestamp) {
263
		this.completeTimestamp = completeTimestamp;
264
	}
265
 
23110 ashik.ali 266
	@Override
267
	public int hashCode() {
268
		final int prime = 31;
269
		int result = 1;
270
		result = prime * result + id;
271
		return result;
272
	}
23819 govind 273
 
23110 ashik.ali 274
	@Override
275
	public boolean equals(Object obj) {
276
		if (this == obj)
277
			return true;
278
		if (obj == null)
279
			return false;
280
		if (getClass() != obj.getClass())
281
			return false;
282
		PriceDrop other = (PriceDrop) obj;
283
		if (id != other.id)
284
			return false;
285
		return true;
286
	}
23819 govind 287
 
23110 ashik.ali 288
}