Subversion Repositories SmartDukaan

Rev

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