| 6111 |
anupam.sin |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import java.text.SimpleDateFormat;
|
|
|
4 |
import java.util.ArrayList;
|
|
|
5 |
import java.util.Arrays;
|
|
|
6 |
import java.util.Collections;
|
|
|
7 |
import java.util.Date;
|
|
|
8 |
import java.util.HashMap;
|
|
|
9 |
import java.util.List;
|
|
|
10 |
import java.util.Map;
|
|
|
11 |
|
|
|
12 |
import in.shop2020.logistics.Provider;
|
|
|
13 |
import in.shop2020.model.v1.order.Order;
|
|
|
14 |
import in.shop2020.model.v1.order.OrderStatus;
|
|
|
15 |
import in.shop2020.model.v1.order.OrderStatusGroups;
|
|
|
16 |
import in.shop2020.model.v1.order.RechargeOrder;
|
|
|
17 |
import in.shop2020.model.v1.order.UserWallet;
|
|
|
18 |
import in.shop2020.serving.utils.FormattingUtils;
|
|
|
19 |
import in.shop2020.thrift.clients.LogisticsClient;
|
|
|
20 |
import in.shop2020.thrift.clients.TransactionClient;
|
|
|
21 |
|
|
|
22 |
import org.apache.log4j.Logger;
|
|
|
23 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
|
|
24 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
|
|
25 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
26 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* @author rajveer
|
|
|
30 |
*
|
|
|
31 |
*/
|
|
|
32 |
|
|
|
33 |
@SuppressWarnings("serial")
|
|
|
34 |
@InterceptorRefs({
|
|
|
35 |
@InterceptorRef("myDefault"),
|
|
|
36 |
@InterceptorRef("login")
|
|
|
37 |
})
|
|
|
38 |
|
|
|
39 |
@Results({
|
|
|
40 |
@Result(name="redirect", type="redirectAction",
|
|
|
41 |
params = {"actionName" , "login"})
|
|
|
42 |
})
|
|
|
43 |
public class MyWalletController extends BaseController {
|
|
|
44 |
|
|
|
45 |
private static Logger logger = Logger.getLogger(Class.class);
|
|
|
46 |
|
|
|
47 |
private FormattingUtils formattingUtils = new FormattingUtils();
|
|
|
48 |
|
|
|
49 |
Map<Long, String> providerNames = new HashMap<Long, String>();
|
|
|
50 |
UserWallet userWallet = null;
|
|
|
51 |
//List<String> orderDate = new ArrayList<String>();
|
|
|
52 |
|
|
|
53 |
// private static final OrderStatusGroups statusGroup = new OrderStatusGroups();
|
|
|
54 |
//private static final List<OrderStatus> openOrderStatuses = statusGroup.getOpenOrders();
|
|
|
55 |
//private static final List<OrderStatus> shippedOrderStatuses = statusGroup.getShippedOrders();
|
|
|
56 |
|
|
|
57 |
public MyWalletController() {
|
|
|
58 |
super();
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
public String index(){
|
|
|
62 |
logger.info("this.request=" + this.request);
|
|
|
63 |
|
|
|
64 |
try {
|
|
|
65 |
TransactionClient transactionServiceClient = new TransactionClient();
|
|
|
66 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
|
|
67 |
userWallet = orderClient.getUserWallet(userinfo.getUserId());
|
|
|
68 |
//Reverse the list of order. Last come first displayed
|
|
|
69 |
//Collections.reverse(userWallet);
|
|
|
70 |
//LogisticsClient logisticsServiceClient = new LogisticsClient();
|
|
|
71 |
//in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
|
|
72 |
//List<Provider> providers = logisticsClient.getAllProviders();
|
|
|
73 |
|
|
|
74 |
//for(Provider provider: providers)
|
|
|
75 |
// providerNames.put(provider.getId(), provider.getName());
|
|
|
76 |
|
|
|
77 |
} catch (Exception e) {
|
|
|
78 |
logger.error("Error while getting the recharge orders for the user", e);
|
|
|
79 |
}
|
|
|
80 |
return "index";
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public String formatDate(long timestamp){
|
|
|
84 |
Date date = new Date(timestamp);
|
|
|
85 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
|
|
86 |
return dateformat.format(date);
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public UserWallet getUserWallet() {
|
|
|
90 |
return userWallet;
|
|
|
91 |
}
|
|
|
92 |
}
|