Subversion Repositories SmartDukaan

Rev

Rev 5428 | Rev 6791 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4801 anupam.sin 1
package in.shop2020.support.controllers;
2
 
3
import java.io.ByteArrayOutputStream;
4
import java.io.IOException;
5
import java.text.DateFormat;
6
import java.text.ParseException;
7
import java.text.SimpleDateFormat;
8
import java.util.ArrayList;
9
import java.util.Calendar;
10
import java.util.Date;
11
import java.util.HashMap;
12
import java.util.List;
13
import java.util.Map;
14
import java.util.TimeZone;
15
 
16
import javax.servlet.ServletOutputStream;
17
import javax.servlet.http.HttpServletRequest;
18
import javax.servlet.http.HttpServletResponse;
19
import javax.servlet.http.HttpSession;
20
 
21
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
22
import org.apache.poi.ss.usermodel.Cell;
23
import org.apache.poi.ss.usermodel.CellStyle;
24
import org.apache.poi.ss.usermodel.CreationHelper;
25
import org.apache.poi.ss.usermodel.Font;
26
import org.apache.poi.ss.usermodel.Row;
27
import org.apache.poi.ss.usermodel.Sheet;
28
import org.apache.poi.ss.usermodel.Workbook;
29
import org.apache.poi.ss.util.CellRangeAddress;
30
import org.apache.struts2.interceptor.ServletRequestAware;
31
import org.apache.struts2.interceptor.ServletResponseAware;
32
import org.apache.thrift.TException;
33
import org.apache.thrift.transport.TTransportException;
34
import org.slf4j.Logger;
35
import org.slf4j.LoggerFactory;
36
 
37
import in.shop2020.logistics.LogisticsServiceException;
38
import in.shop2020.logistics.Provider;
5354 anupam.sin 39
import in.shop2020.model.v1.order.LineItem;
4801 anupam.sin 40
import in.shop2020.model.v1.order.Order;
41
import in.shop2020.model.v1.order.OrderStatus;
42
import in.shop2020.model.v1.order.TransactionServiceException;
43
import in.shop2020.support.utils.ReportsUtils;
44
import in.shop2020.thrift.clients.LogisticsClient;
45
import in.shop2020.thrift.clients.TransactionClient;
46
 
47
public class CourierPerformanceController implements ServletRequestAware, ServletResponseAware {
48
 
49
    private List<OrderStatus> rtoStatuses;
50
    private List<Order> orders;
51
 
52
    private static Logger log = LoggerFactory.getLogger(CourierPerformanceController.class);
53
 
54
    private HttpServletResponse response;
55
    private HttpServletRequest request;
56
    private HttpSession session;
57
    private String errorMsg;
58
    private Date startDate;
59
    private Date endDate;
60
    private Map<Long, String> logisticProviderMap;
61
 
62
    public CourierPerformanceController() {
63
        rtoStatuses = new ArrayList<OrderStatus>();
64
        rtoStatuses.add(OrderStatus.RTO_IN_TRANSIT);
65
        rtoStatuses.add(OrderStatus.RTO_RECEIVED_PRESTINE);
66
        rtoStatuses.add(OrderStatus.RTO_RESHIPPED);
67
        rtoStatuses.add(OrderStatus.RTO_REFUNDED);
68
        rtoStatuses.add(OrderStatus.RTO_RECEIVED_DAMAGED);
69
        rtoStatuses.add(OrderStatus.RTO_LOST_IN_TRANSIT);
70
        rtoStatuses.add(OrderStatus.RTO_DAMAGED_RESHIPPED);
71
        rtoStatuses.add(OrderStatus.RTO_DAMAGED_REFUNDED);
72
        rtoStatuses.add(OrderStatus.RTO_LOST_IN_TRANSIT_RESHIPPED);
73
        rtoStatuses.add(OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED);
74
        rtoStatuses.add(OrderStatus.RTO_INVENTORY_REVERSED);
75
    }
76
 
77
    public String index() {
78
        log.info(request.getServletPath());
79
        if (!ReportsUtils.canAccessReport(
80
                (Long) session.getAttribute(ReportsUtils.ROLE),
81
                request.getServletPath())) 
82
        {
83
            return "authfail";
84
        }
85
        return "index";
86
    }
87
 
88
    public String create() {
89
        try {
90
            logisticProviderMap = new HashMap<Long, String>();
91
            LogisticsClient lc = new LogisticsClient();
92
            List<Provider> providers = lc.getClient().getAllProviders();    
93
            for (Provider provider : providers) {
94
                logisticProviderMap.put(provider.getId(), provider.getName());
95
            }
96
 
97
            String startDateStr = request.getParameter("startDate");
98
            String endDateStr = request.getParameter("endDate");
99
 
100
            DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
101
            df.setTimeZone(TimeZone.getTimeZone("IST"));
102
            try {
103
                startDate = df.parse(startDateStr);
104
                endDate = df.parse(endDateStr);
105
                //Calendar cal = Calendar.getInstance();
106
                //cal.setTime(endDate);
107
                //endDate.setTime(cal.getTimeInMillis());
108
            } catch (ParseException pe) {
109
                errorMsg = "Please enter start and end dates in format MM/dd/yyyy";
110
                return "index";
111
            }
112
 
113
            response.setContentType("application/vnd.ms-excel");
114
 
115
            response.setHeader("Content-disposition", "inline; filename=" + "courier-performance-report" + ".xls");
116
 
117
            ServletOutputStream sos;
118
            try {
119
                ByteArrayOutputStream baos = getSpreadSheetData();
120
                sos = response.getOutputStream();
121
                baos.writeTo(sos);
122
                sos.flush();
123
            } catch (IOException e) {
124
                log.error("Unable to stream the courier performance report", e);
125
                errorMsg = "Failed to write to response.";
126
            }
127
        } catch (TTransportException e) {
128
            // TODO Auto-generated catch block
129
            e.printStackTrace();
130
        } catch (TException e) {
131
            // TODO Auto-generated catch block
132
            e.printStackTrace();
133
        } catch (LogisticsServiceException e) {
134
            // TODO Auto-generated catch block
135
            e.printStackTrace();
136
        }
137
        return "index";
138
    }
139
 
140
    private ByteArrayOutputStream getSpreadSheetData() {
141
        ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
142
 
143
        Workbook wb = new HSSFWorkbook();
144
 
145
        Font font = wb.createFont();
146
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
147
        CellStyle style = wb.createCellStyle();
148
        style.setFont(font);
149
 
150
        CreationHelper createHelper = wb.getCreationHelper();
151
        CellStyle dateCellStyle = wb.createCellStyle();
152
        dateCellStyle.setDataFormat(createHelper.createDataFormat().getFormat("DD/MM/YYYY"));
153
 
154
        createRtoSheet(wb, style, dateCellStyle);
155
        createDeliveredSheet(wb, style, dateCellStyle);
156
 
157
        // Write the workbook to the output stream
158
        try {
159
            wb.write(baosXLS);
160
            baosXLS.close();
161
        } catch (IOException e) {
162
            log.error("Unable to get the byte array for the affiliate report", e);
163
        }       
164
        return baosXLS;
165
    }
166
 
167
    private void createRtoSheet(Workbook wb, 
168
                                       CellStyle style,
169
                                       CellStyle dateCellStyle) {
170
        // Summary SHEET
171
        Sheet sheet1 = wb.createSheet("RTO");
172
        short affSerialNo = 0;
173
 
174
        DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
175
 
176
        Row affTitleRow = sheet1.createRow(affSerialNo ++);
177
        Cell affTitleCell = affTitleRow.createCell(0);
178
        affTitleCell.setCellValue("Courier Performance Report : RTO Orders");
179
        affTitleCell.setCellStyle(style);
180
        sheet1.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
181
 
182
        sheet1.createRow(affSerialNo ++);
183
 
184
        Row affDateRangeRow = sheet1.createRow(affSerialNo ++);
185
        Cell affDateRangeCell = affDateRangeRow.createCell(0);
186
        affDateRangeCell.setCellValue("Date Range : " + df.format(startDate) + " - " + df.format(endDate));
187
        affDateRangeCell.setCellStyle(style);
188
        sheet1.addMergedRegion(new CellRangeAddress(3, 3, 0, 6));
189
 
190
        sheet1.createRow(affSerialNo ++);sheet1.createRow(affSerialNo ++);
191
 
192
        Row affHeaderRow = sheet1.createRow(affSerialNo++);
5428 anupam.sin 193
 
4801 anupam.sin 194
        affHeaderRow.createCell(0).setCellValue("Order Id");
195
        affHeaderRow.createCell(1).setCellValue("Payment Type");
5428 anupam.sin 196
        affHeaderRow.createCell(2).setCellValue("Product Name");
197
        affHeaderRow.createCell(3).setCellValue("AWB");
198
        affHeaderRow.createCell(4).setCellValue("Pincode");
199
        affHeaderRow.createCell(5).setCellValue("City");
200
        affHeaderRow.createCell(6).setCellValue("Logistics Provider");
201
        affHeaderRow.createCell(7).setCellValue("Order Created Date");
202
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
203
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
204
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
5354 anupam.sin 205
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
5428 anupam.sin 206
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
207
        affHeaderRow.createCell(13).setCellValue("RTO Declare date");
5354 anupam.sin 208
        affHeaderRow.createCell(14).setCellValue("Return Receive Date");
5428 anupam.sin 209
        affHeaderRow.createCell(15).setCellValue("RTO Refund Date");
210
        affHeaderRow.createCell(16).setCellValue("RTO Reship Date");
5354 anupam.sin 211
 
5428 anupam.sin 212
        affHeaderRow.createCell(17).setCellValue("Shipping to Return Time");
213
        affHeaderRow.createCell(18).setCellValue("First Attempt Delay");
214
 
215
        for (int i=0; i<19 ;i++) {
4801 anupam.sin 216
            affHeaderRow.getCell(i).setCellStyle(style);
217
        }
218
 
219
        try {
220
            TransactionClient tc = new TransactionClient();
221
            orders = tc.getClient().getAllOrders(rtoStatuses, startDate.getTime(), endDate.getTime(), 0);
222
        } catch (TransactionServiceException e) {
223
            // TODO Auto-generated catch block
224
            e.printStackTrace();
225
        } catch (TException e) {
226
            // TODO Auto-generated catch block
227
            e.printStackTrace();
228
        }
229
 
230
        for(Order order : orders) {
231
            long diffDays = -99;
232
            affSerialNo++;
233
            Row commContentRow = sheet1.createRow(affSerialNo);
5428 anupam.sin 234
 
4801 anupam.sin 235
            commContentRow.createCell(0).setCellValue(order.getId());
5554 rajveer 236
            commContentRow.createCell(1).setCellValue(order.isLogisticsCod() ? "COD" : "PREPAID");
5428 anupam.sin 237
 
238
            List<LineItem> items = order.getLineitems();
239
            String product = items.get(0).getBrand() + " " + items.get(0).getModel_name() + " " + items.get(0).getModel_number();
240
            commContentRow.createCell(2).setCellValue(product);
241
 
242
            commContentRow.createCell(3).setCellValue(order.getAirwaybill_no());
243
            commContentRow.createCell(4).setCellValue(order.getCustomer_pincode());
244
            commContentRow.createCell(5).setCellValue(order.getCustomer_city());
245
            commContentRow.createCell(6).setCellValue(logisticProviderMap.get(order.getLogistics_provider_id()));
246
 
247
            commContentRow.createCell(7).setCellValue(new Date(order.getCreated_timestamp()));
4801 anupam.sin 248
            commContentRow.getCell(7).setCellStyle(dateCellStyle);
5354 anupam.sin 249
 
5428 anupam.sin 250
            commContentRow.createCell(8).setCellValue(new Date(order.getPromised_shipping_time()));
251
            commContentRow.getCell(8).setCellStyle(dateCellStyle);
252
 
253
            commContentRow.createCell(9).setCellValue(new Date(order.getShipping_timestamp()));
4801 anupam.sin 254
            commContentRow.getCell(9).setCellStyle(dateCellStyle);
5354 anupam.sin 255
 
256
            if (order.getFirst_attempt_timestamp() != 0) {
5428 anupam.sin 257
                commContentRow.createCell(10).setCellValue(new Date(order.getFirst_attempt_timestamp()));
258
                commContentRow.getCell(10).setCellStyle(dateCellStyle);
5354 anupam.sin 259
            } else {
260
                commContentRow.createCell(10).setCellValue("N/A");
261
            }
262
 
263
            commContentRow.createCell(11).setCellValue(new Date(order.getPromised_delivery_time()));
4801 anupam.sin 264
            commContentRow.getCell(11).setCellStyle(dateCellStyle);
5428 anupam.sin 265
 
266
            commContentRow.createCell(12).setCellValue(new Date(order.getExpected_delivery_time()));
5354 anupam.sin 267
            commContentRow.getCell(12).setCellStyle(dateCellStyle);
268
 
5428 anupam.sin 269
            if (order.getDelivery_timestamp() != 0) {
270
                //When our courier partners declare a shipment as RTO we mark that time as delivered timestamp in our DB.
271
                commContentRow.createCell(13).setCellValue(new Date(order.getDelivery_timestamp()));//This is actually RTO Declare date.
272
                commContentRow.getCell(13).setCellStyle(dateCellStyle);
273
            } else {
274
                commContentRow.createCell(13).setCellValue("N/A");
275
            }
276
 
277
            if (order.getReceived_return_timestamp() != 0) {
278
                commContentRow.createCell(14).setCellValue(new Date(order.getReceived_return_timestamp()));
279
                commContentRow.getCell(14).setCellStyle(dateCellStyle);
280
            } else {
281
                commContentRow.createCell(14).setCellValue("N/A");
282
            }
283
 
284
            if (order.getRefund_timestamp() != 0) {
285
                commContentRow.createCell(15).setCellValue(new Date(order.getRefund_timestamp()));
286
                commContentRow.getCell(15).setCellStyle(dateCellStyle);
287
            } else {
288
                commContentRow.createCell(15).setCellValue("N/A");
289
            }
290
 
291
            if (order.getReship_timestamp() != 0) {
292
                commContentRow.createCell(16).setCellValue(new Date(order.getReship_timestamp()));
293
                commContentRow.getCell(16).setCellStyle(dateCellStyle);
294
            } else {
295
                commContentRow.createCell(16).setCellValue("N/A");
296
            }
297
 
298
            long delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
299
 
300
            if (order.getReceived_return_timestamp() != 0) {
301
                diffDays = GetDelayinDays(order.getReceived_return_timestamp(), order.getShipping_timestamp());
302
                commContentRow.createCell(17).setCellValue(diffDays);
303
            } else {
304
                commContentRow.createCell(17).setCellValue("N/A");
305
            }
306
 
307
            if (order.getFirst_attempt_timestamp() != 0) {
308
                diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getExpected_delivery_time());
309
                commContentRow.createCell(18).setCellValue(diffDays - delayInShipping);
310
            } else {
311
                commContentRow.createCell(18).setCellValue("N/A");
312
            }
4801 anupam.sin 313
        }
5428 anupam.sin 314
        for (int i = 0; i<19; i++) {
4801 anupam.sin 315
            sheet1.autoSizeColumn(i);
316
        }
317
    }
318
 
319
    private void createDeliveredSheet(Workbook wb, 
320
            CellStyle style,
321
            CellStyle dateCellStyle) {
322
        // Summary SHEET
323
        Sheet sheet2 = wb.createSheet("Delivered");
324
        short affSerialNo = 0;
325
 
326
        DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
327
 
328
        Row affTitleRow = sheet2.createRow(affSerialNo ++);
329
        Cell affTitleCell = affTitleRow.createCell(0);
330
        affTitleCell.setCellValue("Courier Performance Report : Delivered Orders");
331
        affTitleCell.setCellStyle(style);
332
        sheet2.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
333
 
334
        sheet2.createRow(affSerialNo ++);
335
 
336
        Row affDateRangeRow = sheet2.createRow(affSerialNo ++);
337
        Cell affDateRangeCell = affDateRangeRow.createCell(0);
338
        affDateRangeCell.setCellValue("Date Range : " + df.format(startDate) + " - " + df.format(endDate));
339
        affDateRangeCell.setCellStyle(style);
340
        sheet2.addMergedRegion(new CellRangeAddress(3, 3, 0, 6));
341
 
342
        sheet2.createRow(affSerialNo ++);sheet2.createRow(affSerialNo ++);
343
 
344
        Row affHeaderRow = sheet2.createRow(affSerialNo++);
345
        affHeaderRow.createCell(0).setCellValue("Order Id");
346
        affHeaderRow.createCell(1).setCellValue("Payment Type");
5428 anupam.sin 347
        affHeaderRow.createCell(2).setCellValue("Product Name");
348
        affHeaderRow.createCell(3).setCellValue("AWB");
349
        affHeaderRow.createCell(4).setCellValue("Pincode");
350
        affHeaderRow.createCell(5).setCellValue("City");
351
        affHeaderRow.createCell(6).setCellValue("Logistics Provider");
352
        affHeaderRow.createCell(7).setCellValue("Order Created Date");
353
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
354
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
355
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
356
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
357
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
358
        affHeaderRow.createCell(13).setCellValue("Delivery Date");
5354 anupam.sin 359
 
5428 anupam.sin 360
        affHeaderRow.createCell(14).setCellValue("Delay");
361
        affHeaderRow.createCell(15).setCellValue("First Attempt Delay");
4801 anupam.sin 362
 
5354 anupam.sin 363
        for (int i=0; i<16 ;i++) {
4801 anupam.sin 364
            affHeaderRow.getCell(i).setCellStyle(style);
365
        }
366
 
367
        try {
368
            TransactionClient tc = new TransactionClient();
369
            List<OrderStatus> deliveredStatuses = new ArrayList<OrderStatus>();
370
            deliveredStatuses.add(OrderStatus.DELIVERY_SUCCESS);
371
            orders = tc.getClient().getAllOrders(deliveredStatuses, startDate.getTime(), endDate.getTime(), 0);
372
        } catch (TransactionServiceException e) {
373
            // TODO Auto-generated catch block
374
            e.printStackTrace();
375
        } catch (TException e) {
376
            // TODO Auto-generated catch block
377
            e.printStackTrace();
378
        }
379
 
380
        for(Order order : orders) {
381
            affSerialNo++;
382
            Row commContentRow = sheet2.createRow(affSerialNo);
5428 anupam.sin 383
 
4801 anupam.sin 384
            commContentRow.createCell(0).setCellValue(order.getId());
5554 rajveer 385
            commContentRow.createCell(1).setCellValue(order.isLogisticsCod() ? "COD" : "PREPAID");
5428 anupam.sin 386
 
387
            List<LineItem> items = order.getLineitems();
388
            String product = items.get(0).getBrand() + " " + items.get(0).getModel_name() + " " + items.get(0).getModel_number();
389
            commContentRow.createCell(2).setCellValue(product);
390
 
391
            commContentRow.createCell(3).setCellValue(order.getAirwaybill_no());
392
            commContentRow.createCell(4).setCellValue(order.getCustomer_pincode());
393
            commContentRow.createCell(5).setCellValue(order.getCustomer_city());
394
            commContentRow.createCell(6).setCellValue(logisticProviderMap.get(order.getLogistics_provider_id()));
395
 
396
            commContentRow.createCell(7).setCellValue(new Date(order.getCreated_timestamp()));
4801 anupam.sin 397
            commContentRow.getCell(7).setCellStyle(dateCellStyle);
5354 anupam.sin 398
 
5428 anupam.sin 399
            if (order.getPromised_shipping_time() != 0) {
400
                commContentRow.createCell(8).setCellValue(new Date(order.getPromised_shipping_time()));
401
                commContentRow.getCell(8).setCellStyle(dateCellStyle);
402
            } else {
403
                commContentRow.createCell(8).setCellValue("N/A");
404
            }
405
 
406
            commContentRow.createCell(9).setCellValue(new Date(order.getShipping_timestamp()));
4801 anupam.sin 407
            commContentRow.getCell(9).setCellStyle(dateCellStyle);
5354 anupam.sin 408
 
5428 anupam.sin 409
            if (order.getFirst_attempt_timestamp() != 0) {
410
                commContentRow.createCell(10).setCellValue(new Date(order.getFirst_attempt_timestamp()));
411
                commContentRow.getCell(10).setCellStyle(dateCellStyle);
412
            } else {
413
                commContentRow.createCell(10).setCellValue("N/A");
414
            }
5354 anupam.sin 415
 
416
            commContentRow.createCell(11).setCellValue(new Date(order.getPromised_delivery_time()));
4801 anupam.sin 417
            commContentRow.getCell(11).setCellStyle(dateCellStyle);
5354 anupam.sin 418
 
5428 anupam.sin 419
            if (order.getDelivery_timestamp() != 0) { 
420
                commContentRow.createCell(12).setCellValue(new Date(order.getExpected_delivery_time()));
421
                commContentRow.getCell(12).setCellStyle(dateCellStyle);
422
            } else {
423
                commContentRow.createCell(12).setCellValue("N/A");
424
            }
5354 anupam.sin 425
 
5428 anupam.sin 426
            if (order.getDelivery_timestamp() != 0) {    
427
                commContentRow.createCell(13).setCellValue(new Date(order.getDelivery_timestamp()));
428
                commContentRow.getCell(13).setCellStyle(dateCellStyle);
429
            } else {
430
                commContentRow.createCell(13).setCellValue("N/A");
431
            }
432
 
433
 
434
            //We are subtracting delay due to shipping from delay in delivery as it was not courier's
435
            //fault that the shipment was delayed
436
 
437
            long delayInShipping = 0;
438
            long diffDays = GetDelayinDays(order.getDelivery_timestamp(), order.getExpected_delivery_time());
439
 
440
            if (order.getPromised_shipping_time() != 0) {
441
                delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
442
                commContentRow.createCell(14).setCellValue(diffDays - delayInShipping);
443
            } else {
444
                commContentRow.createCell(14).setCellValue(diffDays);
445
            }
446
 
447
            diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getExpected_delivery_time());
448
 
449
            if (order.getFirst_attempt_timestamp() != 0) { 
450
                if (order.getPromised_shipping_time() != 0) {
451
                    delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
452
                    commContentRow.createCell(15).setCellValue(diffDays - delayInShipping);
453
                }
454
            } else { 
455
                commContentRow.createCell(15).setCellValue("N/A");
456
            }
4801 anupam.sin 457
        }
5354 anupam.sin 458
        for (int i = 0; i<16; i++) {
4801 anupam.sin 459
            sheet2.autoSizeColumn(i);
460
        }
461
    }
5354 anupam.sin 462
 
463
    long GetDelayinDays(long actualDate, long expectedDate) {
464
 
465
        Calendar actualTime = Calendar.getInstance();
466
        Calendar expectedTime = Calendar.getInstance();
467
        long millisInDays = 24 * 60 * 60 * 1000;
468
 
469
        actualTime.setTimeInMillis(actualDate);
470
        expectedTime.setTimeInMillis(expectedDate);
471
 
472
        long actualTimeInMillis = actualTime.getTimeInMillis();
473
        long expectedTimeInMillis = expectedTime.getTimeInMillis();
474
        long diff = actualTimeInMillis - expectedTimeInMillis;
475
        long diffDays = diff / millisInDays;
476
 
477
        return diffDays;
478
    }
4801 anupam.sin 479
 
480
    public List<OrderStatus> getRtoStatuses() {
481
        return rtoStatuses;
482
    }
483
 
484
    public void setRtoStatuses(List<OrderStatus> rtoStatuses) {
485
        this.rtoStatuses = rtoStatuses;
486
    }
487
 
488
    public void setOrders(List<Order> orders) {
489
        this.orders = orders;
490
    }
491
 
492
    public List<Order> getOrders() {
493
        return orders;
494
    }
495
 
496
    @Override
497
    public void setServletResponse(HttpServletResponse res) {
498
        this.response = res;
499
    }
500
 
501
    @Override
502
    public void setServletRequest(HttpServletRequest req) {
503
        this.request = req;
504
        this.session = req.getSession();
505
    }
506
 
507
    public String getErrorMsg() {
508
        return errorMsg;
509
    }
510
 
511
    public void setErrorMsg(String errorMsg) {
512
        this.errorMsg = errorMsg;
513
    }
514
 
515
    public Date getStartDate() {
516
        return startDate;
517
    }
518
 
519
    public void setStartDate(Date startDate) {
520
        this.startDate = startDate;
521
    }
522
 
523
    public Date getEndDate() {
524
        return endDate;
525
    }
526
 
527
    public void setEndDate(Date endDate) {
528
        this.endDate = endDate;
529
    }
530
}