Subversion Repositories SmartDukaan

Rev

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

Rev 7081 Rev 8274
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import in.shop2020.model.v1.catalog.BrandInfo;
-
 
4
import in.shop2020.model.v1.catalog.CatalogService.Client;
-
 
5
import in.shop2020.model.v1.catalog.CatalogServiceException;
-
 
6
import in.shop2020.model.v1.order.Order;
-
 
7
import in.shop2020.model.v1.order.OrderStatus;
-
 
8
import in.shop2020.model.v1.order.TransactionService;
-
 
9
import in.shop2020.serving.utils.FormattingUtils;
-
 
10
import in.shop2020.thrift.clients.CatalogClient;
-
 
11
import in.shop2020.thrift.clients.TransactionClient;
-
 
12
 
3
import java.nio.ByteBuffer;
13
import java.nio.ByteBuffer;
4
import java.text.SimpleDateFormat;
14
import java.text.SimpleDateFormat;
5
import java.util.ArrayList;
15
import java.util.ArrayList;
6
import java.util.Arrays;
16
import java.util.Arrays;
7
import java.util.Calendar;
17
import java.util.Calendar;
Line 52... Line 62...
52
	
62
	
53
    private FormattingUtils formattingUtils = new FormattingUtils();
63
    private FormattingUtils formattingUtils = new FormattingUtils();
54
 
64
 
55
    Map<Long, String> providerNames = new HashMap<Long, String>();
65
    Map<Long, String> providerNames = new HashMap<Long, String>();
56
    List<Order> orders = null;
66
    List<Order> orders = null;
-
 
67
    Map<String, BrandInfo> brandInfo = null;
57
    List<String> orderDate = new ArrayList<String>();
68
    List<String> orderDate = new ArrayList<String>();
58
    
69
    
59
    private String orderId;
70
    private String orderId;
60
	
71
	
61
    CatalogClient csc = null;
72
    CatalogClient csc = null;
Line 75... Line 86...
75
        in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
86
        in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
76
        try{
87
        try{
77
            transactionServiceClient = new TransactionClient();
88
            transactionServiceClient = new TransactionClient();
78
            orderClient = transactionServiceClient.getClient();
89
            orderClient = transactionServiceClient.getClient();
79
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), statuses);
90
            orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), statuses);
-
 
91
            brandInfo = client.getBrandInfo();
80
            Collections.reverse(orders);
92
            Collections.reverse(orders);
81
        } catch (Exception e)   {
93
        } catch (Exception e)   {
82
        	logger.error("Not able to get order information from service.");
94
        	logger.error("Not able to get order information from service.");
83
        }
95
        }
84
		return "index";
96
		return "index";
Line 201... Line 213...
201
    }
213
    }
202
 
214
 
203
    public void setOrderId(String orderId) {
215
    public void setOrderId(String orderId) {
204
        this.orderId = orderId;
216
        this.orderId = orderId;
205
    }
217
    }
-
 
218
    
-
 
219
    public String getSupportUrl(String brand){
-
 
220
    	if (brandInfo.get(brand) != null){
-
 
221
    		return brandInfo.get(brand).getServiceCenterLocatorUrl(); 
-
 
222
    	}else {
-
 
223
    		return null;
-
 
224
    	}
-
 
225
    }
206
}
226
}
207
227