Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
167 ashish 1
package in.shop2020.hotspot.dashbaord.shared.actions;
2
 
4004 chandransh 3
import java.util.Date;
4
 
167 ashish 5
import com.google.gwt.user.client.rpc.IsSerializable;
6
 
7
public class Order implements IsSerializable{
8
 
9
	private static final long serialVersionUID = 5804421607858217477L;
4004 chandransh 10
 
11
	private static final long MS_IN_HOUR  = 3600000;
167 ashish 12
 
484 rajveer 13
	private long orderId;
167 ashish 14
	private long customerId;
484 rajveer 15
	private String customerName;
16
	private String customerMobileNumber;
17
	private String customerPincode;
737 chandransh 18
	private String customerAddress1;
19
	private String customerAddress2;
671 chandransh 20
	private String customerCity;
21
	private String customerState;
484 rajveer 22
	private String customerEmail;
23
 
167 ashish 24
	private long createdOn;
4004 chandransh 25
	private long shippedAt;
26
	private long verifiedAt;
167 ashish 27
	private long expectedDeliveryTime;
3994 chandransh 28
	private long promisedDeliveryTime;
4004 chandransh 29
	private long expectedShippingTime;
484 rajveer 30
 
31
	private long status;
167 ashish 32
	private String statusMessage;
33
 
706 chandransh 34
	private long itemId;
966 chandransh 35
	private String productGroup;
36
	private String brand;
484 rajveer 37
	private String modelName;
38
	private String modelNumber;
914 chandransh 39
	private String color;
484 rajveer 40
	private String extraInfo;
4172 rajveer 41
	private String dealText;
167 ashish 42
 
484 rajveer 43
	private double totalAmount;
44
	private double totalWeight;
306 ashish 45
 
486 rajveer 46
	private String airwayBillNo;
47
	private String billedBy;
48
	private String invoiceNumber;
639 chandransh 49
	private long jacketNumber;
2781 chandransh 50
	private String itemNumber;
4658 mandeep.dh 51
	private String serialNumber;
1224 chandransh 52
	private long batchNo;
53
	private long serialNo;
306 ashish 54
 
2509 chandransh 55
	private boolean doaFlag;
56
	private String pickupRequestNo;
3065 chandransh 57
	private boolean cod;
2509 chandransh 58
 
3553 chandransh 59
	private String delayReason;
60
 
4398 rajveer 61
	private OrderAlert alert;
4004 chandransh 62
 
167 ashish 63
	@SuppressWarnings("unused")
740 chandransh 64
	private Order(){}
484 rajveer 65
 
66
	public Order(long orderId, long customerId, String customerName,
67
			String customerMobileNumber, String customerPincode,
737 chandransh 68
			String customerAddress1, String customerAddress2, String customerCity, String customerState, String customerEmail, long createdOn,
4004 chandransh 69
			long shippedAt,
70
			long verifiedAt,
71
			long expectedDeliveryTime,
72
			long promisedDeliveryTime,
73
			long expectedShippingTime,
74
			long status, String statusMessage,
966 chandransh 75
			long itemId, String productGroup, String brand, String modelName,
4172 rajveer 76
			String modelNumber, String color, String extraInfo, String dealText, double totalAmount,
486 rajveer 77
			double totalWeight, String airwayBillNo, String billedBy,
2781 chandransh 78
			String invoiceNumber, long jacketNumber, String itemNumber,
4658 mandeep.dh 79
			String serialNumber, long batchNo, long serialNo,
3553 chandransh 80
			boolean doaFlag, String pickupRequestNo, boolean cod, String delayReason) {
484 rajveer 81
		super();
82
		this.orderId = orderId;
167 ashish 83
		this.customerId = customerId;
484 rajveer 84
		this.customerName = customerName;
85
		this.customerMobileNumber = customerMobileNumber;
86
		this.customerPincode = customerPincode;
737 chandransh 87
		this.customerAddress1 = customerAddress1;
740 chandransh 88
		this.customerAddress2 = customerAddress2;
671 chandransh 89
		this.customerCity = customerCity;
90
		this.customerState = customerState;
484 rajveer 91
		this.customerEmail = customerEmail;
167 ashish 92
		this.createdOn = createdOn;
4004 chandransh 93
		this.shippedAt = shippedAt;
94
		this.verifiedAt = verifiedAt;
167 ashish 95
		this.expectedDeliveryTime = expectedDeliveryTime;
3994 chandransh 96
		this.promisedDeliveryTime = promisedDeliveryTime;
4004 chandransh 97
		this.expectedShippingTime = expectedShippingTime;
740 chandransh 98
		this.status = status;
484 rajveer 99
		this.statusMessage = statusMessage;
740 chandransh 100
		this.itemId = itemId;
966 chandransh 101
		this.productGroup = productGroup;
102
		this.brand = brand;
484 rajveer 103
		this.modelName = modelName;
104
		this.modelNumber = modelNumber;
914 chandransh 105
		this.color = color;
484 rajveer 106
		this.extraInfo = extraInfo;
4172 rajveer 107
		this.dealText = dealText;
484 rajveer 108
		this.totalAmount = totalAmount;
109
		this.totalWeight = totalWeight;
486 rajveer 110
		this.airwayBillNo = airwayBillNo;
111
		this.billedBy = billedBy;
639 chandransh 112
		this.invoiceNumber = invoiceNumber;
113
		this.jacketNumber = jacketNumber;
2781 chandransh 114
		this.itemNumber = itemNumber;
4658 mandeep.dh 115
		this.serialNumber = serialNumber;
1224 chandransh 116
		this.batchNo = batchNo;
117
		this.serialNo = serialNo;
2509 chandransh 118
		this.doaFlag = doaFlag;
119
		this.pickupRequestNo = pickupRequestNo;
3065 chandransh 120
		this.cod = cod;
3553 chandransh 121
		this.delayReason = delayReason;
4004 chandransh 122
		checkForAlerts();
167 ashish 123
	}
124
 
4004 chandransh 125
	private void checkForAlerts(){
4398 rajveer 126
	    this.alert = OrderAlert.NONE;
4004 chandransh 127
	    Date date = new Date();
128
	    long currentTime = date.getTime();
129
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
130
	        //Orders whose delivery dates have passed but which are not yet delivered
4398 rajveer 131
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
4004 chandransh 132
	        return;
133
	    }
134
 
135
	    if(this.expectedShippingTime <= currentTime && this.status < 9){
136
	        //Orders whose expected shipping dates have passed but which have not been shipped yet
4398 rajveer 137
	        this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
4004 chandransh 138
	        return;
139
	    }
140
 
141
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
142
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
4398 rajveer 143
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
4004 chandransh 144
            return;
145
        }
146
 
147
	    if(this.verifiedAt <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && this.cod){
148
	        //A COD order has neither been accepted nor marked out of stock after 2 hours of order verification
4398 rajveer 149
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
4004 chandransh 150
            return;
151
	    }
152
 
153
	    if(this.shippedAt <= currentTime - 27 * MS_IN_HOUR && this.status == 9){
154
            //A shipped order has not been picked up even after 6 hours of pickup mismatch being reported
4398 rajveer 155
            this.alert = OrderAlert.ORDER_NOT_CONNECTED_FOR_TOO_LONG;
4004 chandransh 156
            return;
157
        }
158
 
159
	    if(this.cod && this.status == 2 && this.createdOn <= currentTime - MS_IN_HOUR){
160
	        //A COD order has not been verified for an hour
4398 rajveer 161
	        this.alert = OrderAlert.VERIFICATION_DELAYED;
4004 chandransh 162
            return;
163
	    }
164
 
165
        if(this.createdOn <= currentTime - MS_IN_HOUR && this.status == 3 && !this.cod){
166
            //A prepaid order has neither been accepted nor marked out of stock after 1 hour of order creation
4398 rajveer 167
            this.alert = OrderAlert.ACCEPTANCE_DELAYED;
4004 chandransh 168
            return;
169
        }
170
 
171
        if(this.verifiedAt <= currentTime - MS_IN_HOUR && this.status == 3 && this.cod){
172
            //A COD order has neither been accepted nor marked out of stock after an hour of order verification
4398 rajveer 173
            this.alert = OrderAlert.ACCEPTANCE_DELAYED;
4004 chandransh 174
            return;
175
        }
176
 
177
	    if(this.status == 9 && this.shippedAt <= currentTime - 20 * MS_IN_HOUR){
178
            //A shipped order has not been picked up
4398 rajveer 179
            this.alert = OrderAlert.ORDER_NOT_CONNECTED;
4004 chandransh 180
            return;
181
	    }
182
	}
183
 
167 ashish 184
	public long getCustomerId() {
185
		return customerId;
186
	}
187
 
188
	public long getCreatedOn() {
189
		return createdOn;
190
	}
191
 
192
	public long getExpectedDeliveryTime() {
193
		return expectedDeliveryTime;
194
	}
3994 chandransh 195
 
196
	public long getPromisedDeliveryTime() {
197
	    return promisedDeliveryTime;
198
	}
167 ashish 199
 
306 ashish 200
	public void setStatusMessage(String message){
201
		this.statusMessage = message;
202
	}
203
 
167 ashish 204
	public String getStatusMessage() {
205
		return statusMessage;
306 ashish 206
	}
207
 
484 rajveer 208
	public void setOrderId(long orderId) {
209
		this.orderId = orderId;
306 ashish 210
	}
211
 
484 rajveer 212
	public long getOrderId() {
213
		return orderId;
306 ashish 214
	}
215
 
484 rajveer 216
	public void setCustomerName(String customerName) {
217
		this.customerName = customerName;
306 ashish 218
	}
219
 
484 rajveer 220
	public String getCustomerName() {
221
		return customerName;
222
	}
223
 
224
	public void setCustomerMobileNumber(String customerMobileNumber) {
225
		this.customerMobileNumber = customerMobileNumber;
226
	}
227
 
228
	public String getCustomerMobileNumber() {
229
		return customerMobileNumber;
230
	}
231
 
232
	public void setCustomerPincode(String customerPincode) {
233
		this.customerPincode = customerPincode;
234
	}
235
 
236
	public String getCustomerPincode() {
237
		return customerPincode;
238
	}
239
 
240
	public void setCustomerEmail(String customerEmail) {
241
		this.customerEmail = customerEmail;
242
	}
243
 
244
	public String getCustomerEmail() {
245
		return customerEmail;
246
	}
247
 
737 chandransh 248
	public void setCustomerAddress1(String customerAddress) {
249
		this.customerAddress1 = customerAddress;
484 rajveer 250
	}
251
 
737 chandransh 252
	public String getCustomerAddress1() {
253
		return customerAddress1;
484 rajveer 254
	}
737 chandransh 255
 
256
	public void setCustomerAddress2(String customerAddress2) {
257
		this.customerAddress2 = customerAddress2;
258
	}
484 rajveer 259
 
737 chandransh 260
	public String getCustomerAddress2() {
261
		return customerAddress2;
262
	}
263
 
671 chandransh 264
	public String getCustomerCity() {
265
		return customerCity;
266
	}
267
 
268
	public void setCustomerCity(String customerCity) {
269
		this.customerCity = customerCity;
270
	}
271
 
272
	public String getCustomerState() {
273
		return customerState;
274
	}
275
 
276
	public void setCustomerState(String customerState) {
277
		this.customerState = customerState;
278
	}
279
 
484 rajveer 280
	public void setModelName(String modelName) {
281
		this.modelName = modelName;
282
	}
283
 
284
	public String getModelName() {
285
		return modelName;
286
	}
287
 
288
	public void setTotalWeight(double totalWeight) {
289
		this.totalWeight = totalWeight;
290
	}
291
 
292
	public double getTotalWeight() {
293
		return totalWeight;
294
	}
295
 
296
	public void setTotalAmount(double totalAmount) {
297
		this.totalAmount = totalAmount;
298
	}
299
 
300
	public double getTotalAmount() {
301
		return totalAmount;
302
	}
303
 
706 chandransh 304
	public void setItemId(long itemId) {
305
		this.itemId = itemId;
306
	}
307
 
308
	public long getItemId() {
309
		return itemId;
310
	}
311
 
966 chandransh 312
	public void setProductGroup(String productGroup) {
313
		this.productGroup = productGroup;
484 rajveer 314
	}
315
 
966 chandransh 316
	public String getProductGroup() {
317
		return productGroup;
306 ashish 318
	}
319
 
966 chandransh 320
	public void setBrand(String brand) {
321
		this.brand = brand;
322
	}
323
 
324
	public String getBrand() {
325
		return brand;
326
	}
327
 
328
	public void setModelNumber(String modelNumber) {
329
		this.modelNumber = modelNumber;
330
	}
331
 
332
	public String getModelNumber() {
333
		return modelNumber;
334
	}
335
 
336
	public String getColor() {
337
		return color;
338
	}
339
 
340
	public void setColor(String color) {
341
		this.color = color;
342
	}
343
 
344
	public void setExtraInfo(String extraInfo) {
345
		this.extraInfo = extraInfo;
346
	}
347
 
348
	public String getExtraInfo() {
349
		return extraInfo;
350
	}
351
 
484 rajveer 352
	public void setStatus(long status) {
353
		this.status = status;
306 ashish 354
	}
355
 
484 rajveer 356
	public long getStatus() {
357
		return status;
358
	}
359
 
486 rajveer 360
	public void setAirwayBillNo(String airwayBillNo) {
361
		this.airwayBillNo = airwayBillNo;
362
	}
363
 
364
	public String getAirwayBillNo() {
365
		return airwayBillNo;
366
	}
367
 
368
	public void setBilledBy(String billedBy) {
369
		this.billedBy = billedBy;
370
	}
371
 
372
	public String getBilledBy() {
373
		return billedBy;
374
	}
375
 
376
	public void setInvoiceNumber(String invoiceNumber) {
377
		this.invoiceNumber = invoiceNumber;
378
	}
379
 
380
	public String getInvoiceNumber() {
381
		return invoiceNumber;
382
	}
383
 
639 chandransh 384
	public long getJacketNumber() {
385
		return jacketNumber;
386
	}
387
 
388
	public void setJacketNumber(long jacketNumber) {
389
		this.jacketNumber = jacketNumber;
390
	}
1224 chandransh 391
 
2781 chandransh 392
	public void setItemNumber(String itemNumber) {
393
		this.itemNumber = itemNumber;
394
	}
395
 
396
	public String getItemNumber() {
397
		return itemNumber;
398
	}
399
 
4658 mandeep.dh 400
	public void setImeiNumber(String imeiNumber) {
401
		this.serialNumber = imeiNumber;
2352 chandransh 402
	}
403
 
4658 mandeep.dh 404
	public String getImeiNumber() {
405
		return serialNumber;
2352 chandransh 406
	}
407
 
1224 chandransh 408
	public long getBatchNo() {
409
		return batchNo;
410
	}
411
 
412
	public void setBatchNo(long batchNo) {
413
		this.batchNo = batchNo;
414
	}
415
 
416
	public long getSerialNo() {
417
		return serialNo;
418
	}
419
 
420
	public void setSerialNo(long serialNo) {
421
		this.serialNo = serialNo;
422
	}
2509 chandransh 423
 
424
	public void setDoaFlag(boolean doaFlag) {
425
		this.doaFlag = doaFlag;
426
	}
427
 
428
	public boolean isDoaFlag() {
429
		return doaFlag;
430
	}
431
 
432
	public void setPickupRequestNo(String pickupRequestNo) {
433
		this.pickupRequestNo = pickupRequestNo;
434
	}
435
 
436
	public String getPickupRequestNo() {
437
		return pickupRequestNo;
438
	}
3065 chandransh 439
 
440
    public boolean isCod() {
441
        return cod;
442
    }
3553 chandransh 443
 
444
    public String getDelayReason() {
445
        return delayReason;
446
    }
4004 chandransh 447
 
4398 rajveer 448
    public void setAlert(OrderAlert alert) {
4004 chandransh 449
        this.alert = alert;
450
    }
451
 
4398 rajveer 452
    public OrderAlert getAlert() {
4004 chandransh 453
        return alert;
454
    }
4172 rajveer 455
 
456
	public String getDealText() {
457
		return dealText;
458
	}
459
 
460
	public void setDealText(String dealText) {
461
		this.dealText = dealText;
462
	}
463
 
167 ashish 464
}