Subversion Repositories SmartDukaan

Rev

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