Subversion Repositories SmartDukaan

Rev

Rev 7515 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7515 Rev 12315
Line 2... Line 2...
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
 
6
 
7
import in.shop2020.datalogger.EventType;
-
 
8
import in.shop2020.logistics.DeliveryType;
7
import in.shop2020.logistics.DeliveryType;
-
 
8
import in.shop2020.logistics.ItemText;
9
import in.shop2020.logistics.LogisticsService;
9
import in.shop2020.logistics.LogisticsService;
10
import in.shop2020.model.v1.catalog.Item;
10
import in.shop2020.model.v1.catalog.Item;
11
import in.shop2020.model.v1.order.HotspotStore;
11
import in.shop2020.model.v1.order.HotspotStore;
12
import in.shop2020.model.v1.user.UserContextService.Client;
-
 
13
import in.shop2020.serving.cache.EhcacheWrapper;
12
import in.shop2020.serving.cache.EhcacheWrapper;
14
import in.shop2020.serving.service.ContentServingService;
13
import in.shop2020.serving.service.ContentServingService;
15
import in.shop2020.serving.utils.SnippetType;
14
import in.shop2020.serving.utils.SnippetType;
16
import in.shop2020.thrift.clients.CatalogClient;
15
import in.shop2020.thrift.clients.CatalogClient;
17
import in.shop2020.thrift.clients.LogisticsClient;
16
import in.shop2020.thrift.clients.LogisticsClient;
18
import in.shop2020.thrift.clients.TransactionClient;
17
import in.shop2020.thrift.clients.TransactionClient;
19
import in.shop2020.thrift.clients.UserClient;
-
 
20
import in.shop2020.utils.DataLogger;
-
 
21
 
18
 
22
import java.io.IOException;
19
import java.io.IOException;
-
 
20
import java.util.ArrayList;
23
import java.util.HashMap;
21
import java.util.HashMap;
24
import java.util.List;
22
import java.util.List;
25
import java.util.Map;
23
import java.util.Map;
26
 
24
 
27
import net.sf.ehcache.CacheManager;
25
import net.sf.ehcache.CacheManager;
28
 
26
 
29
import org.apache.commons.lang.StringUtils;
-
 
30
import org.apache.log4j.Logger;
27
import org.apache.log4j.Logger;
31
import org.apache.struts2.convention.annotation.Action;
28
import org.apache.struts2.convention.annotation.Action;
32
import org.apache.struts2.convention.annotation.Actions;
29
import org.apache.struts2.convention.annotation.Actions;
33
import org.apache.struts2.convention.annotation.Result;
30
import org.apache.struts2.convention.annotation.Result;
34
import org.apache.struts2.convention.annotation.Results;
31
import org.apache.struts2.convention.annotation.Results;
-
 
32
import org.apache.struts2.views.xslt.ArrayAdapter;
35
import org.json.JSONException;
33
import org.json.JSONException;
36
import org.json.JSONObject;
34
import org.json.JSONObject;
37
 
35
 
38
import com.google.gson.Gson;
36
import com.google.gson.Gson;
39
 
37
 
Line 292... Line 290...
292
    public Map<String, Double> getDiscounts()	{
290
    public Map<String, Double> getDiscounts()	{
293
    	return discounts;
291
    	return discounts;
294
    }
292
    }
295
    
293
    
296
    public String getEntityLogisticsEstimation(){
294
    public String getEntityLogisticsEstimation(){
297
    	List<Long> items=null; 
295
    	List<ItemText> itemTexts=null; 
-
 
296
    	List<Long> items = new ArrayList<Long>();
298
    	try {
297
    	try {
299
    		LogisticsClient cl = new LogisticsClient();
298
    		LogisticsClient cl = new LogisticsClient();
300
            LogisticsService.Client client = cl.getClient();
299
            LogisticsService.Client client = cl.getClient();
301
            items = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
300
            itemTexts = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
-
 
301
            for(ItemText it : itemTexts){
-
 
302
            	items.add(it.getItemId());
-
 
303
            }
302
        } catch (Exception e1) {
304
        } catch (Exception e1) {
303
            log.error("Unable to get items by catalog item id", e1);
305
            log.error("Unable to get items by catalog item id", e1);
304
        }
306
        }
305
        return new Gson().toJson(items);
307
        return new Gson().toJson(items);
306
    }
308
    }