Subversion Repositories SmartDukaan

Rev

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