Subversion Repositories SmartDukaan

Rev

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