Subversion Repositories SmartDukaan

Rev

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