Subversion Repositories SmartDukaan

Rev

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

Rev 26332 Rev 28566
Line 20... Line 20...
20
import javax.persistence.UniqueConstraint;
20
import javax.persistence.UniqueConstraint;
21
 
21
 
22
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
22
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
23
 
23
 
24
@Entity
24
@Entity
-
 
25
@Table(name = "fofo.fofo_order_item", schema = "fofo", uniqueConstraints = {
25
@Table(name="fofo.fofo_order_item", schema = "fofo", uniqueConstraints = {@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = {"order_id","item_id"})})
26
		@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }) })
26
public class FofoOrderItem implements Serializable{
27
public class FofoOrderItem implements Serializable {
27
 
28
 
28
	private static final long serialVersionUID = 1L;
29
	private static final long serialVersionUID = 1L;
29
 
30
 
30
	@Id
31
	@Id
31
	@Column(name = "id")
32
	@Column(name = "id")
32
	@GeneratedValue(strategy = GenerationType.IDENTITY)
33
	@GeneratedValue(strategy = GenerationType.IDENTITY)
33
	private int id;
34
	private int id;
34
	
35
 
35
	@Column(name = "order_id")
36
	@Column(name = "order_id")
36
	private int orderId;
37
	private int orderId;
37
	
38
 
38
	@Column(name = "item_id")
39
	@Column(name = "item_id")
39
	private int itemId;
40
	private int itemId;
40
	
41
 
41
	@Column(name = "quantity")
42
	@Column(name = "quantity")
42
	private int quantity;
43
	private int quantity;
43
	
44
 
44
	@Column(name = "selling_price")
45
	@Column(name = "selling_price")
45
	private float sellingPrice;
46
	private float sellingPrice;
46
	
47
 
47
	@Column(name = "cost")
48
	@Column(name = "cost")
48
	private float cost;
49
	private float cost;
49
	
-
 
50
	
50
 
51
	@Column(name = "mop")
51
	@Column(name = "mop")
52
	private float mop;
52
	private float mop;
53
	
53
 
54
	@Column(name = "igst_rate")
54
	@Column(name = "igst_rate")
55
	private float igstRate;
55
	private float igstRate;
56
	
56
 
57
	@Column(name = "cgst_rate")
57
	@Column(name = "cgst_rate")
58
	private float cgstRate;
58
	private float cgstRate;
59
	
59
 
60
	@Column(name = "sgst_rate")
60
	@Column(name = "sgst_rate")
61
	private float sgstRate;
61
	private float sgstRate;
62
	
62
 
63
	@Column(name = "hsn_code")
63
	@Column(name = "hsn_code")
64
	private String hsnCode;
64
	private String hsnCode;
65
	
65
 
66
	@Column(name = "dp")
66
	@Column(name = "dp")
67
	private float dp;
67
	private float dp;
68
	
68
 
69
	@Column(name = "brand")
69
	@Column(name = "brand")
70
	private String brand;
70
	private String brand;
71
	
71
 
72
	@Column(name = "model_name")
72
	@Column(name = "model_name")
73
	private String modelName;
73
	private String modelName;
74
	
74
 
75
	@Column(name = "model_number")
75
	@Column(name = "model_number")
76
	private String modelNumber;
76
	private String modelNumber;
77
	
77
 
78
	@Column(name = "color")
78
	@Column(name = "color")
79
	private String color;
79
	private String color;
80
	
80
 
81
	@Column(name = "discount")
81
	@Column(name = "discount")
82
	private float discount;
82
	private float discount;
83
	
83
 
84
	@Transient
84
	@Transient
85
	private boolean doa;
85
	private boolean doa;
-
 
86
 
-
 
87
	@Transient
-
 
88
	private String itemName;
86
	
89
 
87
	public boolean isDoa() {
90
	public boolean isDoa() {
88
		return doa;
91
		return doa;
89
	}
92
	}
-
 
93
 
-
 
94
	public String getItemName() {
-
 
95
		return itemName;
-
 
96
	}
-
 
97
 
-
 
98
	public void setItemName(String itemName) {
-
 
99
		this.itemName = itemName;
-
 
100
	}
-
 
101
 
90
	public void setDoa(boolean doa) {
102
	public void setDoa(boolean doa) {
91
		this.doa = doa;
103
		this.doa = doa;
92
	}
104
	}
-
 
105
 
93
	@Convert(converter = LocalDateTimeAttributeConverter.class)
106
	@Convert(converter = LocalDateTimeAttributeConverter.class)
94
	@Column(name = "create_timestamp")
107
	@Column(name = "create_timestamp")
95
	private LocalDateTime createTimestamp = LocalDateTime.now();
108
	private LocalDateTime createTimestamp = LocalDateTime.now();
96
	
109
 
97
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
110
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
98
	@JoinColumn(name="fofo_order_item_id",insertable=false,updatable=false,nullable=false)
111
	@JoinColumn(name = "fofo_order_item_id", insertable = false, updatable = false, nullable = false)
99
	private Set<FofoLineItem> fofoLineItems;
112
	private Set<FofoLineItem> fofoLineItems;
100
	
-
 
101
	
113
 
102
	public int getId() {
114
	public int getId() {
103
		return id;
115
		return id;
104
	}
116
	}
-
 
117
 
105
	public void setId(int id) {
118
	public void setId(int id) {
106
		this.id = id;
119
		this.id = id;
107
	}
120
	}
-
 
121
 
108
	public int getOrderId() {
122
	public int getOrderId() {
109
		return orderId;
123
		return orderId;
110
	}
124
	}
-
 
125
 
111
	public void setOrderId(int orderId) {
126
	public void setOrderId(int orderId) {
112
		this.orderId = orderId;
127
		this.orderId = orderId;
113
	}
128
	}
-
 
129
 
114
	public int getItemId() {
130
	public int getItemId() {
115
		return itemId;
131
		return itemId;
116
	}
132
	}
-
 
133
 
117
	public void setItemId(int itemId) {
134
	public void setItemId(int itemId) {
118
		this.itemId = itemId;
135
		this.itemId = itemId;
119
	}
136
	}
-
 
137
 
120
	public int getQuantity() {
138
	public int getQuantity() {
121
		return quantity;
139
		return quantity;
122
	}
140
	}
-
 
141
 
123
	public void setQuantity(int quantity) {
142
	public void setQuantity(int quantity) {
124
		this.quantity = quantity;
143
		this.quantity = quantity;
125
	}
144
	}
-
 
145
 
126
	public float getSellingPrice() {
146
	public float getSellingPrice() {
127
		return sellingPrice;
147
		return sellingPrice;
128
	}
148
	}
-
 
149
 
129
	public void setSellingPrice(float sellingPrice) {
150
	public void setSellingPrice(float sellingPrice) {
130
		this.sellingPrice = sellingPrice;
151
		this.sellingPrice = sellingPrice;
131
	}
152
	}
132
	
153
 
133
	public float getCost() {
154
	public float getCost() {
134
		return cost;
155
		return cost;
135
	}
156
	}
-
 
157
 
136
	public void setCost(float cost) {
158
	public void setCost(float cost) {
137
		this.cost = cost;
159
		this.cost = cost;
138
	}
160
	}
139
	
-
 
140
	
161
 
141
	public float getMop() {
162
	public float getMop() {
142
		return mop;
163
		return mop;
143
	}
164
	}
-
 
165
 
144
	public void setMop(float mop) {
166
	public void setMop(float mop) {
145
		this.mop = mop;
167
		this.mop = mop;
146
	}
168
	}
-
 
169
 
147
	public float getIgstRate() {
170
	public float getIgstRate() {
148
		return igstRate;
171
		return igstRate;
149
	}
172
	}
-
 
173
 
150
	public void setIgstRate(float igstRate) {
174
	public void setIgstRate(float igstRate) {
151
		this.igstRate = igstRate;
175
		this.igstRate = igstRate;
152
	}
176
	}
-
 
177
 
153
	public float getCgstRate() {
178
	public float getCgstRate() {
154
		return cgstRate;
179
		return cgstRate;
155
	}
180
	}
-
 
181
 
156
	public void setCgstRate(float cgstRate) {
182
	public void setCgstRate(float cgstRate) {
157
		this.cgstRate = cgstRate;
183
		this.cgstRate = cgstRate;
158
	}
184
	}
-
 
185
 
159
	public float getSgstRate() {
186
	public float getSgstRate() {
160
		return sgstRate;
187
		return sgstRate;
161
	}
188
	}
-
 
189
 
162
	public void setSgstRate(float sgstRate) {
190
	public void setSgstRate(float sgstRate) {
163
		this.sgstRate = sgstRate;
191
		this.sgstRate = sgstRate;
164
	}
192
	}
-
 
193
 
165
	public String getHsnCode() {
194
	public String getHsnCode() {
166
		return hsnCode;
195
		return hsnCode;
167
	}
196
	}
-
 
197
 
168
	public void setHsnCode(String hsnCode) {
198
	public void setHsnCode(String hsnCode) {
169
		this.hsnCode = hsnCode;
199
		this.hsnCode = hsnCode;
170
	}
200
	}
171
	
201
 
172
	public float getDp() {
202
	public float getDp() {
173
		return dp;
203
		return dp;
174
	}
204
	}
175
 
205
 
176
	public void setDp(float dp) {
206
	public void setDp(float dp) {
177
		this.dp = dp;
207
		this.dp = dp;
178
	}
208
	}
-
 
209
 
179
	public String getBrand() {
210
	public String getBrand() {
180
		return brand;
211
		return brand;
181
	}
212
	}
-
 
213
 
182
	public void setBrand(String brand) {
214
	public void setBrand(String brand) {
183
		this.brand = brand;
215
		this.brand = brand;
184
	}
216
	}
-
 
217
 
185
	public String getModelName() {
218
	public String getModelName() {
186
		return modelName;
219
		return modelName;
187
	}
220
	}
-
 
221
 
188
	public void setModelName(String modelName) {
222
	public void setModelName(String modelName) {
189
		this.modelName = modelName;
223
		this.modelName = modelName;
190
	}
224
	}
-
 
225
 
191
	public String getModelNumber() {
226
	public String getModelNumber() {
192
		return modelNumber;
227
		return modelNumber;
193
	}
228
	}
-
 
229
 
194
	public void setModelNumber(String modelNumber) {
230
	public void setModelNumber(String modelNumber) {
195
		this.modelNumber = modelNumber;
231
		this.modelNumber = modelNumber;
196
	}
232
	}
-
 
233
 
197
	public String getColor() {
234
	public String getColor() {
198
		return color;
235
		return color;
199
	}
236
	}
-
 
237
 
200
	public void setColor(String color) {
238
	public void setColor(String color) {
201
		this.color = color;
239
		this.color = color;
202
	}
240
	}
203
	
241
 
204
	public float getDiscount() {
242
	public float getDiscount() {
205
		return discount;
243
		return discount;
206
	}
244
	}
207
	
245
 
208
	public void setDiscount(float discount) {
246
	public void setDiscount(float discount) {
209
		this.discount = discount;
247
		this.discount = discount;
210
	}
248
	}
211
	
249
 
212
	public LocalDateTime getCreateTimestamp() {
250
	public LocalDateTime getCreateTimestamp() {
213
		return createTimestamp;
251
		return createTimestamp;
214
	}
252
	}
-
 
253
 
215
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
254
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
216
		this.createTimestamp = createTimestamp;
255
		this.createTimestamp = createTimestamp;
217
	}
256
	}
218
	
257
 
219
	public Set<FofoLineItem> getFofoLineItems() {
258
	public Set<FofoLineItem> getFofoLineItems() {
220
		return fofoLineItems;
259
		return fofoLineItems;
221
	}
260
	}
-
 
261
 
222
	public void setFofoLineItems(Set<FofoLineItem> fofoLineItems) {
262
	public void setFofoLineItems(Set<FofoLineItem> fofoLineItems) {
223
		this.fofoLineItems = fofoLineItems;
263
		this.fofoLineItems = fofoLineItems;
224
	}
264
	}
225
	
265
 
226
	@Override
266
	@Override
227
	public int hashCode() {
267
	public int hashCode() {
228
		final int prime = 31;
268
		final int prime = 31;
229
		int result = 1;
269
		int result = 1;
-
 
270
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
-
 
271
		result = prime * result + Float.floatToIntBits(cgstRate);
-
 
272
		result = prime * result + ((color == null) ? 0 : color.hashCode());
-
 
273
		result = prime * result + Float.floatToIntBits(cost);
-
 
274
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
275
		result = prime * result + Float.floatToIntBits(discount);
-
 
276
		result = prime * result + (doa ? 1231 : 1237);
-
 
277
		result = prime * result + Float.floatToIntBits(dp);
-
 
278
		result = prime * result + ((fofoLineItems == null) ? 0 : fofoLineItems.hashCode());
-
 
279
		result = prime * result + ((hsnCode == null) ? 0 : hsnCode.hashCode());
230
		result = prime * result + id;
280
		result = prime * result + id;
-
 
281
		result = prime * result + Float.floatToIntBits(igstRate);
-
 
282
		result = prime * result + itemId;
-
 
283
		result = prime * result + ((itemName == null) ? 0 : itemName.hashCode());
-
 
284
		result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());
-
 
285
		result = prime * result + ((modelNumber == null) ? 0 : modelNumber.hashCode());
-
 
286
		result = prime * result + Float.floatToIntBits(mop);
-
 
287
		result = prime * result + orderId;
-
 
288
		result = prime * result + quantity;
-
 
289
		result = prime * result + Float.floatToIntBits(sellingPrice);
-
 
290
		result = prime * result + Float.floatToIntBits(sgstRate);
231
		return result;
291
		return result;
232
	}
292
	}
-
 
293
 
233
	@Override
294
	@Override
234
	public boolean equals(Object obj) {
295
	public boolean equals(Object obj) {
235
		if (this == obj)
296
		if (this == obj)
236
			return true;
297
			return true;
237
		if (obj == null)
298
		if (obj == null)
238
			return false;
299
			return false;
239
		if (getClass() != obj.getClass())
300
		if (getClass() != obj.getClass())
240
			return false;
301
			return false;
241
		FofoOrderItem other = (FofoOrderItem) obj;
302
		FofoOrderItem other = (FofoOrderItem) obj;
-
 
303
		if (brand == null) {
-
 
304
			if (other.brand != null)
-
 
305
				return false;
-
 
306
		} else if (!brand.equals(other.brand))
-
 
307
			return false;
-
 
308
		if (Float.floatToIntBits(cgstRate) != Float.floatToIntBits(other.cgstRate))
-
 
309
			return false;
-
 
310
		if (color == null) {
-
 
311
			if (other.color != null)
-
 
312
				return false;
-
 
313
		} else if (!color.equals(other.color))
-
 
314
			return false;
-
 
315
		if (Float.floatToIntBits(cost) != Float.floatToIntBits(other.cost))
-
 
316
			return false;
-
 
317
		if (createTimestamp == null) {
-
 
318
			if (other.createTimestamp != null)
-
 
319
				return false;
-
 
320
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
321
			return false;
-
 
322
		if (Float.floatToIntBits(discount) != Float.floatToIntBits(other.discount))
-
 
323
			return false;
-
 
324
		if (doa != other.doa)
-
 
325
			return false;
-
 
326
		if (Float.floatToIntBits(dp) != Float.floatToIntBits(other.dp))
-
 
327
			return false;
-
 
328
		if (fofoLineItems == null) {
-
 
329
			if (other.fofoLineItems != null)
-
 
330
				return false;
-
 
331
		} else if (!fofoLineItems.equals(other.fofoLineItems))
-
 
332
			return false;
-
 
333
		if (hsnCode == null) {
-
 
334
			if (other.hsnCode != null)
-
 
335
				return false;
-
 
336
		} else if (!hsnCode.equals(other.hsnCode))
-
 
337
			return false;
242
		if (id != other.id)
338
		if (id != other.id)
243
			return false;
339
			return false;
-
 
340
		if (Float.floatToIntBits(igstRate) != Float.floatToIntBits(other.igstRate))
-
 
341
			return false;
-
 
342
		if (itemId != other.itemId)
-
 
343
			return false;
-
 
344
		if (itemName == null) {
-
 
345
			if (other.itemName != null)
-
 
346
				return false;
-
 
347
		} else if (!itemName.equals(other.itemName))
-
 
348
			return false;
-
 
349
		if (modelName == null) {
-
 
350
			if (other.modelName != null)
-
 
351
				return false;
-
 
352
		} else if (!modelName.equals(other.modelName))
-
 
353
			return false;
-
 
354
		if (modelNumber == null) {
-
 
355
			if (other.modelNumber != null)
-
 
356
				return false;
-
 
357
		} else if (!modelNumber.equals(other.modelNumber))
-
 
358
			return false;
-
 
359
		if (Float.floatToIntBits(mop) != Float.floatToIntBits(other.mop))
-
 
360
			return false;
-
 
361
		if (orderId != other.orderId)
-
 
362
			return false;
-
 
363
		if (quantity != other.quantity)
-
 
364
			return false;
-
 
365
		if (Float.floatToIntBits(sellingPrice) != Float.floatToIntBits(other.sellingPrice))
-
 
366
			return false;
-
 
367
		if (Float.floatToIntBits(sgstRate) != Float.floatToIntBits(other.sgstRate))
-
 
368
			return false;
244
		return true;
369
		return true;
245
	}
370
	}
-
 
371
 
246
	@Override
372
	@Override
247
	public String toString() {
373
	public String toString() {
248
		return "FofoOrderItem [id=" + id + ", orderId=" + orderId + ", itemId=" + itemId + ", quantity=" + quantity
374
		return "FofoOrderItem [id=" + id + ", orderId=" + orderId + ", itemId=" + itemId + ", quantity=" + quantity
249
				+ ", sellingPrice=" + sellingPrice + ", cost=" + cost + ", mop=" + mop + ", igstRate=" + igstRate
375
				+ ", sellingPrice=" + sellingPrice + ", cost=" + cost + ", mop=" + mop + ", igstRate=" + igstRate
250
				+ ", cgstRate=" + cgstRate + ", sgstRate=" + sgstRate + ", hsnCode=" + hsnCode + ", dp=" + dp
376
				+ ", cgstRate=" + cgstRate + ", sgstRate=" + sgstRate + ", hsnCode=" + hsnCode + ", dp=" + dp
251
				+ ", brand=" + brand + ", modelName=" + modelName + ", modelNumber=" + modelNumber + ", color=" + color
377
				+ ", brand=" + brand + ", modelName=" + modelName + ", modelNumber=" + modelNumber + ", color=" + color
252
				+ ", discount=" + discount + ", doa=" + doa + ", createTimestamp=" + createTimestamp
378
				+ ", discount=" + discount + ", doa=" + doa + ", itemName=" + itemName + ", createTimestamp="
253
				+ ", fofoLineItems=" + fofoLineItems + "]";
379
				+ createTimestamp + ", fofoLineItems=" + fofoLineItems + "]";
254
	}
380
	}
255
	
-
 
256
	
-
 
257
	
381
 
258
}
382
}