Subversion Repositories SmartDukaan

Rev

Rev 26332 | Rev 26400 | 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
 
23823 amit.gupta 123
 
124
	@Column(name = "price_drop_in")
125
	private float priceDropIn;
126
 
127
	@Column(name = "partner_payout")
128
	private float partnerPayout;
23819 govind 129
 
130
	@Convert(converter = LocalDateTimeAttributeConverter.class)
131
	@Column(name = "created_on")
132
	private LocalDateTime createdOn = LocalDateTime.now();
133
 
134
	@Convert(converter = LocalDateTimeAttributeConverter.class)
135
	@Column(name = "affected_on")
23874 amit.gupta 136
	private LocalDateTime affectedOn = LocalDateTime.now();
23819 govind 137
 
138
	@Convert(converter = LocalDateTimeAttributeConverter.class)
139
	@Column(name = "credit_note_date")
23874 amit.gupta 140
	private LocalDateTime creditNoteDate;
23819 govind 141
 
23110 ashik.ali 142
	public int getId() {
143
		return id;
144
	}
23819 govind 145
 
23110 ashik.ali 146
	public void setId(int id) {
147
		this.id = id;
148
	}
23823 amit.gupta 149
 
150
 
151
 
23819 govind 152
 
23823 amit.gupta 153
	public float getPriceDropIn() {
154
		return priceDropIn;
155
	}
156
 
157
	public void setPriceDropIn(float priceDropIn) {
158
		this.priceDropIn = priceDropIn;
159
	}
160
 
23951 amit.gupta 161
	public int getCatalogItemId() {
162
		return catalogItemId;
23110 ashik.ali 163
	}
23819 govind 164
 
23951 amit.gupta 165
	public void setCatalogItemId(int catalogItemId) {
166
		this.catalogItemId = catalogItemId;
23110 ashik.ali 167
	}
23819 govind 168
 
23951 amit.gupta 169
	@Override
170
	public String toString() {
23968 amit.gupta 171
		return "PriceDrop [id=" + id + ", catalogItemId=" + catalogItemId + ", description=" + description + ", amount="
24049 amit.gupta 172
				+ amount + ", newDp=" + newDp + ", mop=" + mop + ", oldDp=" + oldDp + ", tp=" + tp + ", nlc=" + nlc
23968 amit.gupta 173
				+ ", creditNoteNumber=" + creditNoteNumber + ", processTimestamp=" + processTimestamp + ", priceDropIn="
174
				+ priceDropIn + ", partnerPayout=" + partnerPayout + ", createdOn=" + createdOn + ", affectedOn="
175
				+ affectedOn + ", creditNoteDate=" + creditNoteDate + "]";
23951 amit.gupta 176
	}
177
 
23110 ashik.ali 178
	public float getAmount() {
179
		return amount;
180
	}
23819 govind 181
 
23110 ashik.ali 182
	public void setAmount(float amount) {
183
		this.amount = amount;
184
	}
23819 govind 185
 
23110 ashik.ali 186
	public LocalDateTime getProcessTimestamp() {
187
		return processTimestamp;
188
	}
23819 govind 189
 
23110 ashik.ali 190
	public void setProcessTimestamp(LocalDateTime processTimestamp) {
191
		this.processTimestamp = processTimestamp;
192
	}
23819 govind 193
 
194
	public String getCreditNoteNumber() {
195
		return creditNoteNumber;
196
	}
197
 
198
	public void setCreditNoteNumber(String creditNoteNumber) {
199
		this.creditNoteNumber = creditNoteNumber;
200
	}
201
 
202
	public LocalDateTime getCreatedOn() {
203
		return createdOn;
204
	}
205
 
206
	public void setCreatedOn(LocalDateTime createdOn) {
207
		this.createdOn = createdOn;
208
	}
209
 
23110 ashik.ali 210
 
23819 govind 211
 
23874 amit.gupta 212
	public LocalDateTime getAffectedOn() {
213
		return affectedOn;
23819 govind 214
	}
215
 
23874 amit.gupta 216
	public void setAffectedOn(LocalDateTime affectedOn) {
217
		this.affectedOn = affectedOn;
23819 govind 218
	}
219
 
220
	public LocalDateTime getCreditNoteDate() {
221
		return creditNoteDate;
222
	}
223
 
224
	public void setCreditNoteDate(LocalDateTime creditNoteDate) {
225
		this.creditNoteDate = creditNoteDate;
226
	}
227
 
23823 amit.gupta 228
	public float getPartnerPayout() {
229
		return partnerPayout;
23819 govind 230
	}
231
 
26340 amit.gupta 232
	public float getDropAmount() {
233
		return oldDp - newDp;
234
	}
26332 amit.gupta 235
	public float getAutoPartnerPayout() {
236
		if(this.getPartnerPayout() == 0) {
26340 amit.gupta 237
			return this.getDropAmount()/1.12f;
26332 amit.gupta 238
		} else {
239
			return this.getPartnerPayout();
240
		}
241
	}
242
 
23823 amit.gupta 243
	public void setPartnerPayout(float partnerPayout) {
244
		this.partnerPayout = partnerPayout;
23819 govind 245
	}
246
 
247
	public String getDate(LocalDateTime ldt) {
248
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
249
		String s = dtf.format(ldt);
250
		return s;
251
	}
252
 
23110 ashik.ali 253
	@Override
254
	public int hashCode() {
255
		final int prime = 31;
256
		int result = 1;
257
		result = prime * result + id;
258
		return result;
259
	}
23819 govind 260
 
23110 ashik.ali 261
	@Override
262
	public boolean equals(Object obj) {
263
		if (this == obj)
264
			return true;
265
		if (obj == null)
266
			return false;
267
		if (getClass() != obj.getClass())
268
			return false;
269
		PriceDrop other = (PriceDrop) obj;
270
		if (id != other.id)
271
			return false;
272
		return true;
273
	}
23819 govind 274
 
23110 ashik.ali 275
}