Subversion Repositories SmartDukaan

Rev

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