Subversion Repositories SmartDukaan

Rev

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