Subversion Repositories SmartDukaan

Rev

Rev 26851 | Rev 28455 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26851 Rev 28443
Line 8... Line 8...
8
import javax.persistence.Convert;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
9
import javax.persistence.Entity;
10
import javax.persistence.GeneratedValue;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
12
import javax.persistence.Id;
-
 
13
import javax.persistence.NamedQueries;
-
 
14
import javax.persistence.NamedQuery;
13
import javax.persistence.Table;
15
import javax.persistence.Table;
14
import javax.persistence.Transient;
16
import javax.persistence.Transient;
15
 
17
 
16
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
18
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
 
19
 
Line 25... Line 27...
25
 * @author amit
27
 * @author amit
26
 *
28
 *
27
 */
29
 */
28
@Entity
30
@Entity
29
@Table(name = "transaction.price_drop", schema = "transaction")
31
@Table(name = "transaction.price_drop", schema = "transaction")
-
 
32
 
-
 
33
@NamedQueries({
-
 
34
		@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropYearMonthModel(i.brand, "
-
 
35
				+ "   DATE_FORMAT(pd.affectedOn, '%m-%Y'),sum(cast(pd.amount As int)) ) from PriceDrop pd join  PriceDropIMEI pdi  on"
-
 
36
				+ " (pd.id = pdi.priceDropId) join InventoryItem it  on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
-
 
37
				+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
-
 
38
				+ " pd.amount > 0 and pd.affectedOn >= :startDate group by i.brand, DATE_FORMAT(pd.affectedOn, '%m-%Y')"),
-
 
39
 
-
 
40
})
30
public class PriceDrop implements Serializable {
41
public class PriceDrop implements Serializable {
31
 
42
 
32
	private static final long serialVersionUID = 1L;
43
	private static final long serialVersionUID = 1L;
33
 
44
 
34
	public PriceDrop() {
45
	public PriceDrop() {
Line 42... Line 53...
42
	@Column(name = "catalog_id")
53
	@Column(name = "catalog_id")
43
	private int catalogItemId;
54
	private int catalogItemId;
44
 
55
 
45
	@Column(name = "amount")
56
	@Column(name = "amount")
46
	private float amount;
57
	private float amount;
47
	
58
 
48
	@Column(name="new_dp")
59
	@Column(name = "new_dp")
49
	private float newDp;
60
	private float newDp;
50
	
61
 
51
	@Column(name="old_dp")
62
	@Column(name = "old_dp")
52
	private float oldDp;
63
	private float oldDp;
53
	
64
 
54
	@Column(name="mop")
65
	@Column(name = "mop")
55
	private float mop;
66
	private float mop;
56
	
67
 
57
	@Column(name="tp")
68
	@Column(name = "tp")
58
	private float tp;
69
	private float tp;
59
	
70
 
60
	@Column(name="nlc")
71
	@Column(name = "nlc")
61
	private float nlc;
72
	private float nlc;
62
	
73
 
63
	@Transient
74
	@Transient
64
	private String description;
75
	private String description;
65
 
76
 
66
	public String getDescription() {
77
	public String getDescription() {
67
		return description;
78
		return description;
Line 69... Line 80...
69
 
80
 
70
	public void setDescription(String description) {
81
	public void setDescription(String description) {
71
		this.description = description;
82
		this.description = description;
72
	}
83
	}
73
 
84
 
74
	
-
 
75
	public float getMop() {
85
	public float getMop() {
76
		return mop;
86
		return mop;
77
	}
87
	}
78
 
88
 
79
	public void setMop(float mop) {
89
	public void setMop(float mop) {
80
		this.mop = mop;
90
		this.mop = mop;
81
	}
91
	}
82
 
92
 
83
 
-
 
84
	public float getNewDp() {
93
	public float getNewDp() {
85
		return newDp;
94
		return newDp;
86
	}
95
	}
87
 
96
 
88
	public void setNewDp(float newDp) {
97
	public void setNewDp(float newDp) {
Line 121... Line 130...
121
	private LocalDateTime processTimestamp;
130
	private LocalDateTime processTimestamp;
122
 
131
 
123
	@Convert(converter = LocalDateTimeAttributeConverter.class)
132
	@Convert(converter = LocalDateTimeAttributeConverter.class)
124
	@Column(name = "complete_timestamp")
133
	@Column(name = "complete_timestamp")
125
	private LocalDateTime completeTimestamp;
134
	private LocalDateTime completeTimestamp;
126
	
-
 
127
	
135
 
128
	@Column(name = "price_drop_in")
136
	@Column(name = "price_drop_in")
129
	private float priceDropIn;
137
	private float priceDropIn;
130
	
138
 
131
	@Column(name = "partner_payout")
139
	@Column(name = "partner_payout")
132
	private float partnerPayout;
140
	private float partnerPayout;
133
 
141
 
134
	@Convert(converter = LocalDateTimeAttributeConverter.class)
142
	@Convert(converter = LocalDateTimeAttributeConverter.class)
135
	@Column(name = "created_on")
143
	@Column(name = "created_on")
Line 148... Line 156...
148
	}
156
	}
149
 
157
 
150
	public void setId(int id) {
158
	public void setId(int id) {
151
		this.id = id;
159
		this.id = id;
152
	}
160
	}
153
	
-
 
154
	
-
 
155
	
-
 
156
 
161
 
157
	public float getPriceDropIn() {
162
	public float getPriceDropIn() {
158
		return priceDropIn;
163
		return priceDropIn;
159
	}
164
	}
160
 
165
 
Line 209... Line 214...
209
 
214
 
210
	public void setCreatedOn(LocalDateTime createdOn) {
215
	public void setCreatedOn(LocalDateTime createdOn) {
211
		this.createdOn = createdOn;
216
		this.createdOn = createdOn;
212
	}
217
	}
213
 
218
 
214
	
-
 
215
 
-
 
216
	public LocalDateTime getAffectedOn() {
219
	public LocalDateTime getAffectedOn() {
217
		return affectedOn;
220
		return affectedOn;
218
	}
221
	}
219
 
222
 
220
	public void setAffectedOn(LocalDateTime affectedOn) {
223
	public void setAffectedOn(LocalDateTime affectedOn) {
Line 234... Line 237...
234
	}
237
	}
235
 
238
 
236
	public float getDropAmount() {
239
	public float getDropAmount() {
237
		return oldDp - newDp;
240
		return oldDp - newDp;
238
	}
241
	}
-
 
242
 
239
	public float getAutoPartnerPayout() {
243
	public float getAutoPartnerPayout() {
240
		if(this.getPartnerPayout() == 0) {
244
		if (this.getPartnerPayout() == 0) {
241
			return this.getDropAmount()/1.18f;
245
			return this.getDropAmount() / 1.18f;
242
		} else {
246
		} else {
243
			return this.getPartnerPayout();
247
			return this.getPartnerPayout();
244
		}
248
		}
245
	}
249
	}
246
	
250
 
247
	public void setPartnerPayout(float partnerPayout) {
251
	public void setPartnerPayout(float partnerPayout) {
248
		this.partnerPayout = partnerPayout;
252
		this.partnerPayout = partnerPayout;
249
	}
253
	}
250
 
254
 
251
	public String getDate(LocalDateTime ldt) {
255
	public String getDate(LocalDateTime ldt) {
252
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
256
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
253
		String s = dtf.format(ldt);
257
		String s = dtf.format(ldt);
254
		return s;
258
		return s;
255
	}
259
	}
256
 
260
 
257
	
-
 
258
	public LocalDateTime getCompleteTimestamp() {
261
	public LocalDateTime getCompleteTimestamp() {
259
		return completeTimestamp;
262
		return completeTimestamp;
260
	}
263
	}
261
 
264
 
262
	public void setCompleteTimestamp(LocalDateTime completeTimestamp) {
265
	public void setCompleteTimestamp(LocalDateTime completeTimestamp) {