Subversion Repositories SmartDukaan

Rev

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