Subversion Repositories SmartDukaan

Rev

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

Rev 8315 Rev 9840
Line 4... Line 4...
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
 
6
 
7
import in.shop2020.datalogger.EventType;
7
import in.shop2020.datalogger.EventType;
8
import in.shop2020.logistics.DeliveryType;
8
import in.shop2020.logistics.DeliveryType;
-
 
9
import in.shop2020.logistics.ItemText;
9
import in.shop2020.logistics.LogisticsService;
10
import in.shop2020.logistics.LogisticsService;
10
import in.shop2020.model.v1.catalog.Item;
11
import in.shop2020.model.v1.catalog.Item;
11
import in.shop2020.model.v1.user.UserContextService.Client;
12
import in.shop2020.model.v1.user.UserContextService.Client;
12
import in.shop2020.serving.cache.EhcacheWrapper;
13
import in.shop2020.serving.cache.EhcacheWrapper;
13
import in.shop2020.serving.services.ContentServingService;
14
import in.shop2020.serving.services.ContentServingService;
Line 16... Line 17...
16
import in.shop2020.thrift.clients.LogisticsClient;
17
import in.shop2020.thrift.clients.LogisticsClient;
17
import in.shop2020.thrift.clients.UserClient;
18
import in.shop2020.thrift.clients.UserClient;
18
import in.shop2020.utils.DataLogger;
19
import in.shop2020.utils.DataLogger;
19
 
20
 
20
import java.io.IOException;
21
import java.io.IOException;
-
 
22
import java.util.ArrayList;
21
import java.util.HashMap;
23
import java.util.HashMap;
22
import java.util.List;
24
import java.util.List;
23
import java.util.Map;
25
import java.util.Map;
24
 
26
 
25
import net.sf.ehcache.CacheManager;
27
import net.sf.ehcache.CacheManager;
Line 285... Line 287...
285
    public Map<String, Double> getDiscounts()	{
287
    public Map<String, Double> getDiscounts()	{
286
    	return discounts;
288
    	return discounts;
287
    }
289
    }
288
    
290
    
289
    public String getEntityLogisticsEstimation(){
291
    public String getEntityLogisticsEstimation(){
290
    	List<Long> items=null; 
292
    	List<ItemText> itemTexts = null; 
291
    	try {
293
    	try {
292
    		LogisticsClient cl = new LogisticsClient();
294
    		LogisticsClient cl = new LogisticsClient();
293
            LogisticsService.Client client = cl.getClient();
295
            LogisticsService.Client client = cl.getClient();
294
            items = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
296
            itemTexts = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
295
        } catch (Exception e1) {
297
        } catch (Exception e1) {
296
            log.error("Unable to get items by catalog item id", e1);
298
            log.error("Unable to get items by catalog item id", e1);
297
        }
299
        }
-
 
300
        List<Long> items = new ArrayList<Long>();
-
 
301
        for(ItemText itemText : itemTexts) {
-
 
302
        	items.add(itemText.getItemId());
-
 
303
        }
298
        return new Gson().toJson(items);
304
        return new Gson().toJson(items);
299
    }
305
    }
300
    
306
    
301
    private static void setRetargettingLabel() {
307
    private static void setRetargettingLabel() {
302
    	label.put((long) 1002160, "6EIBCKjf1wMQ6Pua0wM"); //Samsung Galaxy Y S5360
308
    	label.put((long) 1002160, "6EIBCKjf1wMQ6Pua0wM"); //Samsung Galaxy Y S5360