Subversion Repositories SmartDukaan

Rev

Rev 19022 | Rev 19172 | 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
 
19004 manish.sha 3
 
4004 chandransh 4
import java.util.Date;
13146 manish.sha 5
import java.util.Map;
4004 chandransh 6
 
167 ashish 7
import com.google.gwt.user.client.rpc.IsSerializable;
8
 
9
public class Order implements IsSerializable{
10
 
11
	private static final long serialVersionUID = 5804421607858217477L;
4004 chandransh 12
 
13
	private static final long MS_IN_HOUR  = 3600000;
167 ashish 14
 
484 rajveer 15
	private long orderId;
13146 manish.sha 16
	private long transactionId;
167 ashish 17
	private long customerId;
484 rajveer 18
	private String customerName;
19
	private String customerMobileNumber;
20
	private String customerPincode;
737 chandransh 21
	private String customerAddress1;
22
	private String customerAddress2;
671 chandransh 23
	private String customerCity;
24
	private String customerState;
484 rajveer 25
	private String customerEmail;
26
 
167 ashish 27
	private long createdOn;
4004 chandransh 28
	private long shippedAt;
29
	private long verifiedAt;
167 ashish 30
	private long expectedDeliveryTime;
3994 chandransh 31
	private long promisedDeliveryTime;
4004 chandransh 32
	private long expectedShippingTime;
4666 rajveer 33
	private long promisedShippingTime;
484 rajveer 34
 
35
	private long status;
167 ashish 36
	private String statusMessage;
37
 
5527 anupam.sin 38
	private String orderType;
706 chandransh 39
	private long itemId;
7190 amar.kumar 40
	private long freebieItemId;
966 chandransh 41
	private String productGroup;
42
	private String brand;
484 rajveer 43
	private String modelName;
44
	private String modelNumber;
914 chandransh 45
	private String color;
484 rajveer 46
	private String extraInfo;
4172 rajveer 47
	private String dealText;
5387 rajveer 48
	private double quantity;
167 ashish 49
 
484 rajveer 50
	private double totalAmount;
51
	private double totalWeight;
306 ashish 52
 
486 rajveer 53
	private String airwayBillNo;
54
	private String billedBy;
55
	private String invoiceNumber;
639 chandransh 56
	private long jacketNumber;
2781 chandransh 57
	private String itemNumber;
4658 mandeep.dh 58
	private String serialNumber;
1224 chandransh 59
	private long batchNo;
60
	private long serialNo;
306 ashish 61
 
2509 chandransh 62
	private boolean doaFlag;
63
	private String pickupRequestNo;
3065 chandransh 64
	private boolean cod;
5769 rajveer 65
	private long pickupStoreId;
2509 chandransh 66
 
3553 chandransh 67
	private String delayReason;
5110 mandeep.dh 68
	private String pickFromWarehouse;
5530 mandeep.dh 69
	private boolean hasItemNumber;
5110 mandeep.dh 70
	private long fulfilmentWarehouseId;
9263 amar.kumar 71
	private long warehouseId;
5110 mandeep.dh 72
	private boolean serialized;
4398 rajveer 73
	private OrderAlert alert;
8717 amar.kumar 74
	private long productCondition; 
7422 rajveer 75
	private String source;
13146 manish.sha 76
	private String logisticsTransactionId;
7422 rajveer 77
 
13146 manish.sha 78
	private Map<Long, Map<String, String>> acceptTogetherOrdersMap;
79
	private Map<Long, Map<String, String>> billTogetherOrdersMap;
80
 
167 ashish 81
	@SuppressWarnings("unused")
740 chandransh 82
	private Order(){}
484 rajveer 83
 
84
	public Order(long orderId, long customerId, String customerName,
85
			String customerMobileNumber, String customerPincode,
737 chandransh 86
			String customerAddress1, String customerAddress2, String customerCity, String customerState, String customerEmail, long createdOn,
4004 chandransh 87
			long shippedAt,
88
			long verifiedAt,
89
			long expectedDeliveryTime,
90
			long promisedDeliveryTime,
91
			long expectedShippingTime,
4666 rajveer 92
			long promisedShippingTime,
4004 chandransh 93
			long status, String statusMessage,
5527 anupam.sin 94
			String orderType, long itemId, String productGroup, String brand, String modelName,
5387 rajveer 95
			String modelNumber, String color, String extraInfo, String dealText, double quantity,
96
			double totalAmount,	double totalWeight, String airwayBillNo, String billedBy,
2781 chandransh 97
			String invoiceNumber, long jacketNumber, String itemNumber,
4658 mandeep.dh 98
			String serialNumber, long batchNo, long serialNo,
5110 mandeep.dh 99
			boolean doaFlag, String pickupRequestNo, boolean cod, String delayReason,
9263 amar.kumar 100
			String pickFromWarehouse, boolean serialized, boolean hasItemNumber, 
101
			long fulfilmentWarehouseId, long warehouseId, long pickupStoreId, long freebieItemId, 
13146 manish.sha 102
			String source, long productCondition, long transactionId) {
484 rajveer 103
		super();
104
		this.orderId = orderId;
167 ashish 105
		this.customerId = customerId;
484 rajveer 106
		this.customerName = customerName;
107
		this.customerMobileNumber = customerMobileNumber;
108
		this.customerPincode = customerPincode;
737 chandransh 109
		this.customerAddress1 = customerAddress1;
740 chandransh 110
		this.customerAddress2 = customerAddress2;
671 chandransh 111
		this.customerCity = customerCity;
112
		this.customerState = customerState;
484 rajveer 113
		this.customerEmail = customerEmail;
167 ashish 114
		this.createdOn = createdOn;
4004 chandransh 115
		this.shippedAt = shippedAt;
116
		this.verifiedAt = verifiedAt;
167 ashish 117
		this.expectedDeliveryTime = expectedDeliveryTime;
3994 chandransh 118
		this.promisedDeliveryTime = promisedDeliveryTime;
4004 chandransh 119
		this.expectedShippingTime = expectedShippingTime;
4666 rajveer 120
		this.promisedShippingTime = promisedShippingTime;
740 chandransh 121
		this.status = status;
484 rajveer 122
		this.statusMessage = statusMessage;
5527 anupam.sin 123
		this.orderType = orderType;
740 chandransh 124
		this.itemId = itemId;
966 chandransh 125
		this.productGroup = productGroup;
126
		this.brand = brand;
484 rajveer 127
		this.modelName = modelName;
128
		this.modelNumber = modelNumber;
914 chandransh 129
		this.color = color;
484 rajveer 130
		this.extraInfo = extraInfo;
4172 rajveer 131
		this.dealText = dealText;
5387 rajveer 132
		this.setQuantity(quantity);
484 rajveer 133
		this.totalAmount = totalAmount;
134
		this.totalWeight = totalWeight;
486 rajveer 135
		this.airwayBillNo = airwayBillNo;
136
		this.billedBy = billedBy;
639 chandransh 137
		this.invoiceNumber = invoiceNumber;
138
		this.jacketNumber = jacketNumber;
2781 chandransh 139
		this.itemNumber = itemNumber;
4658 mandeep.dh 140
		this.serialNumber = serialNumber;
1224 chandransh 141
		this.batchNo = batchNo;
142
		this.serialNo = serialNo;
2509 chandransh 143
		this.doaFlag = doaFlag;
144
		this.pickupRequestNo = pickupRequestNo;
3065 chandransh 145
		this.cod = cod;
3553 chandransh 146
		this.delayReason = delayReason;
5110 mandeep.dh 147
		this.pickFromWarehouse = pickFromWarehouse;
148
		this.serialized = serialized;
5530 mandeep.dh 149
		this.hasItemNumber = hasItemNumber;
5110 mandeep.dh 150
		this.fulfilmentWarehouseId = fulfilmentWarehouseId;
9263 amar.kumar 151
		this.warehouseId = warehouseId;
5769 rajveer 152
		this.setPickupStoreId(pickupStoreId);
7190 amar.kumar 153
		this.freebieItemId = freebieItemId;
7422 rajveer 154
		this.source = source;
8717 amar.kumar 155
		this.productCondition = productCondition;
13146 manish.sha 156
		this.transactionId = transactionId;
4004 chandransh 157
		checkForAlerts();
167 ashish 158
	}
159
 
4004 chandransh 160
	private void checkForAlerts(){
4398 rajveer 161
	    this.alert = OrderAlert.NONE;
19004 manish.sha 162
	    Date date = new Date(System.currentTimeMillis());
4004 chandransh 163
	    long currentTime = date.getTime();
19025 manish.sha 164
 
4004 chandransh 165
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
166
	        //Orders whose delivery dates have passed but which are not yet delivered
4398 rajveer 167
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
4004 chandransh 168
	        return;
169
	    }
170
 
19004 manish.sha 171
    	//Orders whose expected shipping dates have passed but which have not been shipped yet
19025 manish.sha 172
		if(this.expectedShippingTime <= currentTime && this.status < 9){
173
			this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
174
			return;
175
		}
19004 manish.sha 176
 
4004 chandransh 177
 
178
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
179
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
4398 rajveer 180
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
4004 chandransh 181
            return;
182
        }
183
 
184
	    if(this.verifiedAt <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && this.cod){
185
	        //A COD order has neither been accepted nor marked out of stock after 2 hours of order verification
4398 rajveer 186
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
4004 chandransh 187
            return;
188
	    }
189
 
190
	    if(this.shippedAt <= currentTime - 27 * MS_IN_HOUR && this.status == 9){
191
            //A shipped order has not been picked up even after 6 hours of pickup mismatch being reported
4398 rajveer 192
            this.alert = OrderAlert.ORDER_NOT_CONNECTED_FOR_TOO_LONG;
4004 chandransh 193
            return;
194
        }
195
 
196
	    if(this.cod && this.status == 2 && this.createdOn <= currentTime - MS_IN_HOUR){
197
	        //A COD order has not been verified for an hour
4398 rajveer 198
	        this.alert = OrderAlert.VERIFICATION_DELAYED;
4004 chandransh 199
            return;
200
	    }
201
 
202
        if(this.createdOn <= currentTime - MS_IN_HOUR && this.status == 3 && !this.cod){
203
            //A prepaid order has neither been accepted nor marked out of stock after 1 hour of order creation
4398 rajveer 204
            this.alert = OrderAlert.ACCEPTANCE_DELAYED;
4004 chandransh 205
            return;
206
        }
207
 
208
        if(this.verifiedAt <= currentTime - MS_IN_HOUR && this.status == 3 && this.cod){
209
            //A COD order has neither been accepted nor marked out of stock after an hour of order verification
4398 rajveer 210
            this.alert = OrderAlert.ACCEPTANCE_DELAYED;
4004 chandransh 211
            return;
212
        }
213
 
214
	    if(this.status == 9 && this.shippedAt <= currentTime - 20 * MS_IN_HOUR){
215
            //A shipped order has not been picked up
4398 rajveer 216
            this.alert = OrderAlert.ORDER_NOT_CONNECTED;
4004 chandransh 217
            return;
218
	    }
219
	}
220
 
167 ashish 221
	public long getCustomerId() {
222
		return customerId;
223
	}
224
 
225
	public long getCreatedOn() {
226
		return createdOn;
227
	}
228
 
229
	public long getExpectedDeliveryTime() {
230
		return expectedDeliveryTime;
231
	}
3994 chandransh 232
 
233
	public long getPromisedDeliveryTime() {
234
	    return promisedDeliveryTime;
235
	}
167 ashish 236
 
306 ashish 237
	public void setStatusMessage(String message){
238
		this.statusMessage = message;
239
	}
240
 
167 ashish 241
	public String getStatusMessage() {
242
		return statusMessage;
306 ashish 243
	}
244
 
484 rajveer 245
	public void setOrderId(long orderId) {
246
		this.orderId = orderId;
306 ashish 247
	}
248
 
484 rajveer 249
	public long getOrderId() {
250
		return orderId;
306 ashish 251
	}
252
 
484 rajveer 253
	public void setCustomerName(String customerName) {
254
		this.customerName = customerName;
306 ashish 255
	}
256
 
484 rajveer 257
	public String getCustomerName() {
258
		return customerName;
259
	}
260
 
261
	public void setCustomerMobileNumber(String customerMobileNumber) {
262
		this.customerMobileNumber = customerMobileNumber;
263
	}
264
 
265
	public String getCustomerMobileNumber() {
266
		return customerMobileNumber;
267
	}
268
 
269
	public void setCustomerPincode(String customerPincode) {
270
		this.customerPincode = customerPincode;
271
	}
272
 
273
	public String getCustomerPincode() {
274
		return customerPincode;
275
	}
276
 
277
	public void setCustomerEmail(String customerEmail) {
278
		this.customerEmail = customerEmail;
279
	}
280
 
281
	public String getCustomerEmail() {
282
		return customerEmail;
283
	}
284
 
737 chandransh 285
	public void setCustomerAddress1(String customerAddress) {
286
		this.customerAddress1 = customerAddress;
484 rajveer 287
	}
288
 
737 chandransh 289
	public String getCustomerAddress1() {
290
		return customerAddress1;
484 rajveer 291
	}
737 chandransh 292
 
293
	public void setCustomerAddress2(String customerAddress2) {
294
		this.customerAddress2 = customerAddress2;
295
	}
484 rajveer 296
 
737 chandransh 297
	public String getCustomerAddress2() {
298
		return customerAddress2;
299
	}
300
 
671 chandransh 301
	public String getCustomerCity() {
302
		return customerCity;
303
	}
304
 
305
	public void setCustomerCity(String customerCity) {
306
		this.customerCity = customerCity;
307
	}
308
 
309
	public String getCustomerState() {
310
		return customerState;
311
	}
312
 
313
	public void setCustomerState(String customerState) {
314
		this.customerState = customerState;
315
	}
316
 
484 rajveer 317
	public void setModelName(String modelName) {
318
		this.modelName = modelName;
319
	}
320
 
321
	public String getModelName() {
322
		return modelName;
323
	}
324
 
325
	public void setTotalWeight(double totalWeight) {
326
		this.totalWeight = totalWeight;
327
	}
328
 
329
	public double getTotalWeight() {
330
		return totalWeight;
331
	}
332
 
333
	public void setTotalAmount(double totalAmount) {
334
		this.totalAmount = totalAmount;
335
	}
336
 
337
	public double getTotalAmount() {
338
		return totalAmount;
339
	}
340
 
706 chandransh 341
	public void setItemId(long itemId) {
342
		this.itemId = itemId;
343
	}
344
 
345
	public long getItemId() {
346
		return itemId;
347
	}
348
 
966 chandransh 349
	public void setProductGroup(String productGroup) {
350
		this.productGroup = productGroup;
484 rajveer 351
	}
352
 
966 chandransh 353
	public String getProductGroup() {
354
		return productGroup;
306 ashish 355
	}
356
 
966 chandransh 357
	public void setBrand(String brand) {
358
		this.brand = brand;
359
	}
360
 
361
	public String getBrand() {
362
		return brand;
363
	}
364
 
365
	public void setModelNumber(String modelNumber) {
366
		this.modelNumber = modelNumber;
367
	}
368
 
369
	public String getModelNumber() {
370
		return modelNumber;
371
	}
372
 
373
	public String getColor() {
374
		return color;
375
	}
376
 
377
	public void setColor(String color) {
378
		this.color = color;
379
	}
380
 
381
	public void setExtraInfo(String extraInfo) {
382
		this.extraInfo = extraInfo;
383
	}
384
 
385
	public String getExtraInfo() {
386
		return extraInfo;
387
	}
388
 
484 rajveer 389
	public void setStatus(long status) {
390
		this.status = status;
306 ashish 391
	}
392
 
484 rajveer 393
	public long getStatus() {
394
		return status;
395
	}
396
 
486 rajveer 397
	public void setAirwayBillNo(String airwayBillNo) {
398
		this.airwayBillNo = airwayBillNo;
399
	}
400
 
401
	public String getAirwayBillNo() {
402
		return airwayBillNo;
403
	}
404
 
405
	public void setBilledBy(String billedBy) {
406
		this.billedBy = billedBy;
407
	}
408
 
409
	public String getBilledBy() {
410
		return billedBy;
411
	}
412
 
413
	public void setInvoiceNumber(String invoiceNumber) {
414
		this.invoiceNumber = invoiceNumber;
415
	}
416
 
417
	public String getInvoiceNumber() {
418
		return invoiceNumber;
419
	}
420
 
639 chandransh 421
	public long getJacketNumber() {
422
		return jacketNumber;
423
	}
424
 
425
	public void setJacketNumber(long jacketNumber) {
426
		this.jacketNumber = jacketNumber;
427
	}
1224 chandransh 428
 
2781 chandransh 429
	public void setItemNumber(String itemNumber) {
430
		this.itemNumber = itemNumber;
431
	}
432
 
433
	public String getItemNumber() {
434
		return itemNumber;
435
	}
436
 
4658 mandeep.dh 437
	public void setImeiNumber(String imeiNumber) {
438
		this.serialNumber = imeiNumber;
2352 chandransh 439
	}
440
 
4658 mandeep.dh 441
	public String getImeiNumber() {
442
		return serialNumber;
2352 chandransh 443
	}
444
 
1224 chandransh 445
	public long getBatchNo() {
446
		return batchNo;
447
	}
448
 
449
	public void setBatchNo(long batchNo) {
450
		this.batchNo = batchNo;
451
	}
452
 
453
	public long getSerialNo() {
454
		return serialNo;
455
	}
456
 
457
	public void setSerialNo(long serialNo) {
458
		this.serialNo = serialNo;
459
	}
2509 chandransh 460
 
461
	public void setDoaFlag(boolean doaFlag) {
462
		this.doaFlag = doaFlag;
463
	}
464
 
465
	public boolean isDoaFlag() {
466
		return doaFlag;
467
	}
468
 
469
	public void setPickupRequestNo(String pickupRequestNo) {
470
		this.pickupRequestNo = pickupRequestNo;
471
	}
472
 
473
	public String getPickupRequestNo() {
474
		return pickupRequestNo;
475
	}
3065 chandransh 476
 
477
    public boolean isCod() {
478
        return cod;
479
    }
3553 chandransh 480
 
481
    public String getDelayReason() {
482
        return delayReason;
483
    }
4004 chandransh 484
 
4398 rajveer 485
    public void setAlert(OrderAlert alert) {
4004 chandransh 486
        this.alert = alert;
487
    }
488
 
4398 rajveer 489
    public OrderAlert getAlert() {
4004 chandransh 490
        return alert;
491
    }
4172 rajveer 492
 
493
	public String getDealText() {
494
		return dealText;
495
	}
496
 
497
	public void setDealText(String dealText) {
498
		this.dealText = dealText;
499
	}
500
 
4666 rajveer 501
	public void setPromisedShippingTime(long promisedShippingTime) {
502
		this.promisedShippingTime = promisedShippingTime;
503
	}
504
 
505
	public long getPromisedShippingTime() {
506
		return promisedShippingTime;
507
	}
508
 
5110 mandeep.dh 509
    public String getPickFromWarehouse() {
510
        return pickFromWarehouse;
511
    }
512
 
513
    public void setPickFromWarehouse(String pickFromWarehouse) {
514
        this.pickFromWarehouse = pickFromWarehouse;
515
    }
516
 
517
    public boolean isSerialized() {
518
        return serialized;
519
    }
520
 
521
    public void setSerialized(boolean serialized) {
522
        this.serialized = serialized;
523
    }
524
 
525
    public long getFulfilmentWarehouseId() {
526
        return fulfilmentWarehouseId;
527
    }
528
 
529
    public void setFulfilmentWarehouseId(long fulfilmentWarehouseId) {
530
        this.fulfilmentWarehouseId = fulfilmentWarehouseId;
531
    }
9263 amar.kumar 532
 
533
	public long getWarehouseId() {
534
		return warehouseId;
535
	}
5110 mandeep.dh 536
 
9263 amar.kumar 537
	public void setWarehouseId(long warehouseId) {
538
		this.warehouseId = warehouseId;
539
	}
540
 
5387 rajveer 541
	public void setQuantity(double quantity) {
542
		this.quantity = quantity;
543
	}
544
 
545
	public double getQuantity() {
546
		return quantity;
547
	}
548
 
5530 mandeep.dh 549
    public boolean isHasItemNumber() {
550
        return hasItemNumber;
551
    }
552
 
553
    public void setHasItemNumber(boolean hasItemNumber) {
554
        this.hasItemNumber = hasItemNumber;
555
    }
556
 
5527 anupam.sin 557
    public String getOrderType() {
558
        return orderType;
559
    }
560
 
561
    public void setOrderType(String orderType) {
562
        this.orderType = orderType;
563
    }
564
 
5769 rajveer 565
	public void setPickupStoreId(long pickupStoreId) {
566
		this.pickupStoreId = pickupStoreId;
567
	}
568
 
569
	public long getPickupStoreId() {
570
		return pickupStoreId;
571
	}
572
 
7190 amar.kumar 573
	public long getFreebieItemId() {
574
		return freebieItemId;
575
	}
576
 
577
	public void setFreebieItemId(long freebieItemId) {
578
		this.freebieItemId = freebieItemId;
579
	}
580
 
7422 rajveer 581
	public String getSource(){
582
		return this.source;
583
	}
8717 amar.kumar 584
 
585
	public long getProductCondition() {
586
		return productCondition;
587
	}
588
 
589
	public void setProductCondition(long productCondition) {
590
		this.productCondition = productCondition;
591
	}
13146 manish.sha 592
 
593
	public long getTransactionId() {
594
		return transactionId;
595
	}
596
 
597
	public void setTransactionId(long transactionId) {
598
		this.transactionId = transactionId;
599
	}
600
 
601
	public Map<Long, Map<String, String>> getBillTogetherOrdersMap() {
602
		return billTogetherOrdersMap;
603
	}
604
 
605
	public void setBillTogetherOrdersMap(
606
			Map<Long, Map<String, String>> billTogetherOrdersMap) {
607
		this.billTogetherOrdersMap = billTogetherOrdersMap;
608
	}
609
 
610
	public String getLogisticsTransactionId() {
611
		return logisticsTransactionId;
612
	}
613
 
614
	public void setLogisticsTransactionId(String logisticsTransactionId) {
615
		this.logisticsTransactionId = logisticsTransactionId;
616
	}
617
 
618
	public Map<Long, Map<String, String>> getAcceptTogetherOrdersMap() {
619
		return acceptTogetherOrdersMap;
620
	}
621
 
622
	public void setAcceptTogetherOrdersMap(
623
			Map<Long, Map<String, String>> acceptTogetherOrdersMap) {
624
		this.acceptTogetherOrdersMap = acceptTogetherOrdersMap;
625
	}
19004 manish.sha 626
 
19025 manish.sha 627
	public long getExpectedShippingTime() {
628
		return expectedShippingTime;
629
	}
630
 
631
	public void setExpectedShippingTime(long expectedShippingTime) {
632
		this.expectedShippingTime = expectedShippingTime;
633
	}
634
 
167 ashish 635
}