Subversion Repositories SmartDukaan

Rev

Rev 2897 | Rev 3121 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2897 Rev 3014
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import java.text.SimpleDateFormat;
3
import java.text.SimpleDateFormat;
4
import java.util.ArrayList;
4
import java.util.ArrayList;
-
 
5
import java.util.Arrays;
5
import java.util.Collections;
6
import java.util.Collections;
6
import java.util.Date;
7
import java.util.Date;
7
import java.util.HashMap;
8
import java.util.HashMap;
8
import java.util.List;
9
import java.util.List;
9
import java.util.Map;
10
import java.util.Map;
10
 
11
 
11
import in.shop2020.logistics.Provider;
12
import in.shop2020.logistics.Provider;
12
import in.shop2020.model.v1.order.Order;
13
import in.shop2020.model.v1.order.Order;
-
 
14
import in.shop2020.model.v1.order.OrderStatus;
13
import in.shop2020.serving.utils.FormattingUtils;
15
import in.shop2020.serving.utils.FormattingUtils;
14
import in.shop2020.thrift.clients.LogisticsServiceClient;
16
import in.shop2020.thrift.clients.LogisticsServiceClient;
15
import in.shop2020.thrift.clients.TransactionServiceClient;
17
import in.shop2020.thrift.clients.TransactionServiceClient;
16
 
18
 
17
import org.apache.log4j.Logger;
19
import org.apache.log4j.Logger;
Line 23... Line 25...
23
/**
25
/**
24
 * @author rajveer
26
 * @author rajveer
25
 *
27
 *
26
 */
28
 */
27
 
29
 
-
 
30
@SuppressWarnings("serial")
28
@InterceptorRefs({
31
@InterceptorRefs({
29
    @InterceptorRef("myDefault"),
32
    @InterceptorRef("myDefault"),
30
    @InterceptorRef("login")
33
    @InterceptorRef("login")
31
})
34
})
32
 
35
 
Line 34... Line 37...
34
    @Result(name="redirect", type="redirectAction", 
37
    @Result(name="redirect", type="redirectAction", 
35
    		params = {"actionName" , "login"})
38
    		params = {"actionName" , "login"})
36
})
39
})
37
public class MyaccountController extends BaseController {
40
public class MyaccountController extends BaseController {
38
 
41
 
39
	private static final long serialVersionUID = 1L;
-
 
40
	private static Logger logger = Logger.getLogger(Class.class);
42
	private static Logger logger = Logger.getLogger(Class.class);
-
 
43
	private static final List<OrderStatus> statuses = Arrays.asList(new OrderStatus[] {});
41
    private FormattingUtils formattingUtils = new FormattingUtils();
44
    private FormattingUtils formattingUtils = new FormattingUtils();
42
 
45
 
43
    Map<Long, String> providerNames = new HashMap<Long, String>();
46
    Map<Long, String> providerNames = new HashMap<Long, String>();
44
    List<Order> orders = null;
47
    List<Order> orders = null;
45
    List<String> orderDate = new ArrayList<String>();
48
    List<String> orderDate = new ArrayList<String>();
Line 52... Line 55...
52
    	logger.info("this.request=" + this.request);
55
    	logger.info("this.request=" + this.request);
53
 
56
 
54
        try {
57
        try {
55
            TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
58
            TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
56
            in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
59
            in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
57
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), null);
60
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), statuses);
58
            //Reverse the list of order. Last come first displayed 
61
            //Reverse the list of order. Last come first displayed 
59
            Collections.reverse(orders);
62
            Collections.reverse(orders);
60
            LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
63
            LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
61
            in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
64
            in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
62
            List<Provider> providers = logisticsClient.getAllProviders();
65
            List<Provider> providers = logisticsClient.getAllProviders();