Subversion Repositories SmartDukaan

Rev

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