| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.controllers;
|
1 |
package in.shop2020.serving.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.order.Order;
|
3 |
import in.shop2020.model.v1.order.Order;
|
| 4 |
import in.shop2020.model.v1.order.OrderStatus;
|
4 |
import in.shop2020.model.v1.order.OrderStatus;
|
| - |
|
5 |
import in.shop2020.model.v1.order.OrderStatusGroups;
|
| 5 |
import in.shop2020.serving.utils.FormattingUtils;
|
6 |
import in.shop2020.serving.utils.FormattingUtils;
|
| 6 |
import in.shop2020.thrift.clients.TransactionClient;
|
7 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 7 |
|
8 |
|
| 8 |
import java.text.SimpleDateFormat;
|
9 |
import java.text.SimpleDateFormat;
|
| 9 |
import java.util.Arrays;
|
10 |
import java.util.Arrays;
|
| Line 27... |
Line 28... |
| 27 |
@Result(name="redirect", type="redirectAction",
|
28 |
@Result(name="redirect", type="redirectAction",
|
| 28 |
params = {"actionName" , "login"})
|
29 |
params = {"actionName" , "login"})
|
| 29 |
})
|
30 |
})
|
| 30 |
public class FailedOrdersController extends BaseController {
|
31 |
public class FailedOrdersController extends BaseController {
|
| 31 |
private static Logger logger = Logger.getLogger(FailedOrdersController.class);
|
32 |
private static Logger logger = Logger.getLogger(FailedOrdersController.class);
|
| 32 |
private static final List<OrderStatus> statuses = Arrays.asList(
|
33 |
private static final OrderStatusGroups statusGroup = new OrderStatusGroups();
|
| 33 |
new OrderStatus[] {
|
- |
|
| 34 |
OrderStatus.PAYMENT_FAILED,
|
- |
|
| 35 |
OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY,
|
34 |
private static final List<OrderStatus> failedOrderStatuses = statusGroup.getFailedOrders();
|
| 36 |
OrderStatus.REJECTED,
|
- |
|
| 37 |
OrderStatus.DOA_INVALID_REFUNDED,
|
- |
|
| 38 |
OrderStatus.DOA_INVALID_RESHIPPED,
|
- |
|
| 39 |
OrderStatus.DOA_VALID_REFUNDED,
|
- |
|
| 40 |
OrderStatus.DOA_VALID_RESHIPPED,
|
- |
|
| 41 |
OrderStatus.RTO_REFUNDED,
|
- |
|
| 42 |
OrderStatus.RTO_RESHIPPED
|
- |
|
| 43 |
}
|
- |
|
| 44 |
);
|
- |
|
| 45 |
|
35 |
|
| 46 |
private FormattingUtils formattingUtils = new FormattingUtils();
|
36 |
private FormattingUtils formattingUtils = new FormattingUtils();
|
| 47 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
37 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
| 48 |
List<Order> orders = null;
|
38 |
List<Order> orders = null;
|
| 49 |
|
39 |
|
| Line 52... |
Line 42... |
| 52 |
|
42 |
|
| 53 |
try {
|
43 |
try {
|
| 54 |
TransactionClient transactionServiceClient = new TransactionClient();
|
44 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 55 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
45 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| 56 |
|
46 |
|
| 57 |
orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), statuses);
|
47 |
orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), failedOrderStatuses);
|
| 58 |
//Reverse the list of order. Last come should be displayed first.
|
48 |
//Reverse the list of order. Last come should be displayed first.
|
| 59 |
Collections.reverse(orders);
|
49 |
Collections.reverse(orders);
|
| 60 |
} catch (Exception e) {
|
50 |
} catch (Exception e) {
|
| 61 |
logger.error("Unable to get the failed orders of the customer", e);
|
51 |
logger.error("Unable to get the failed orders of the customer", e);
|
| 62 |
}
|
52 |
}
|