Subversion Repositories SmartDukaan

Rev

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