Subversion Repositories SmartDukaan

Rev

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

Rev 12616 Rev 12620
Line 8... Line 8...
8
import in.shop2020.logistics.DeliveryType;
8
import in.shop2020.logistics.DeliveryType;
9
import in.shop2020.logistics.ItemText;
9
import in.shop2020.logistics.ItemText;
10
import in.shop2020.logistics.LogisticsInfo;
10
import in.shop2020.logistics.LogisticsInfo;
11
import in.shop2020.logistics.LogisticsService;
11
import in.shop2020.logistics.LogisticsService;
12
import in.shop2020.logistics.LogisticsServiceException;
12
import in.shop2020.logistics.LogisticsServiceException;
-
 
13
import in.shop2020.model.v1.catalog.ExclusiveAffiliateItemInfo;
13
import in.shop2020.model.v1.catalog.Item;
14
import in.shop2020.model.v1.catalog.Item;
14
import in.shop2020.model.v1.user.UserContextService.Client;
15
import in.shop2020.model.v1.user.UserContextService.Client;
15
import in.shop2020.serving.cache.EhcacheWrapper;
16
import in.shop2020.serving.cache.EhcacheWrapper;
16
import in.shop2020.serving.services.ContentServingService;
17
import in.shop2020.serving.services.ContentServingService;
17
import in.shop2020.serving.utils.SnippetType;
18
import in.shop2020.serving.utils.SnippetType;
-
 
19
import in.shop2020.serving.utils.Utils;
18
import in.shop2020.thrift.clients.CatalogClient;
20
import in.shop2020.thrift.clients.CatalogClient;
19
import in.shop2020.thrift.clients.LogisticsClient;
21
import in.shop2020.thrift.clients.LogisticsClient;
20
import in.shop2020.thrift.clients.UserClient;
22
import in.shop2020.thrift.clients.UserClient;
21
import in.shop2020.utils.DataLogger;
23
import in.shop2020.utils.DataLogger;
22
 
24
 
Line 67... Line 69...
67
	private static final String DEFAULT_PINCODE = "110001";
69
	private static final String DEFAULT_PINCODE = "110001";
68
	private String id;
70
	private String id;
69
	private String redirectUrl;
71
	private String redirectUrl;
70
	private long productId;
72
	private long productId;
71
	private boolean isMobile = false;
73
	private boolean isMobile = false;
-
 
74
	private List<ExclusiveAffiliateItemInfo> entityItemsExclusiveInfo = new ArrayList<ExclusiveAffiliateItemInfo>();
72
	
75
	
-
 
76
	public List<ExclusiveAffiliateItemInfo> getEntityItemsExclusiveInfo() {
-
 
77
		return entityItemsExclusiveInfo;
-
 
78
	}
-
 
79
	
-
 
80
	public String getEntityItemsExclusiveInfoJson(){
-
 
81
		return new Gson().toJson(entityItemsExclusiveInfo);
-
 
82
	}
-
 
83
 
73
	private Map<String, Double> discounts = new HashMap<String, Double>();
84
	private Map<String, Double> discounts = new HashMap<String, Double>();
74
	private Map<String, String> snippets;
85
	private Map<String, String> snippets;
75
	private static Map<Long, String> label = new HashMap<Long, String>();
86
	private static Map<Long, String> label = new HashMap<Long, String>();
76
	
87
	
77
	public static Map<Integer, String> businessDayToActualDateMap = new HashMap<Integer, String>();
88
	public static Map<Integer, String> businessDayToActualDateMap = new HashMap<Integer, String>();
Line 186... Line 197...
186
		
197
		
187
//		DataLogger.logData(EventType.PRODUCT_VIEW, getSessionId(), userinfo.getUserId(), userinfo.getEmail(), userinfo.getPincode(), 
198
//		DataLogger.logData(EventType.PRODUCT_VIEW, getSessionId(), userinfo.getUserId(), userinfo.getEmail(), userinfo.getPincode(), 
188
//                productName, Long.toString(productId), StringUtils.substring(request.getHeader("referer"), 0, 500));			       
199
//                productName, Long.toString(productId), StringUtils.substring(request.getHeader("referer"), 0, 500));			       
189
        
200
        
190
        try {
201
        try {
191
            CatalogClient catalogClientService = new CatalogClient();
-
 
192
            in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
-
 
193
            
-
 
194
            setEntityLogisticsEstimation();
202
            setEntityLogisticsEstimation();
195
            getDeliveryEstimate( firstItem, userinfo.getPincode());
203
            getDeliveryEstimate(firstItem, userinfo.getPincode());
196
        } catch (Exception e1) {
204
        } catch (Exception e1) {
197
            log.warn("Unable to get delivery estimates for "+ id);
205
            log.warn("Unable to get delivery estimates for "+ id);
198
        }
206
        }
199
		return "show";
207
		return "show";
200
    }
208
    }
Line 399... Line 407...
399
            itemTexts = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
407
            itemTexts = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
400
            if(itemTexts!=null){
408
            if(itemTexts!=null){
401
            	List<Long> items = new ArrayList<Long>();
409
            	List<Long> items = new ArrayList<Long>();
402
            	for(ItemText itemText : itemTexts) {
410
            	for(ItemText itemText : itemTexts) {
403
            		items.add(itemText.getItemId());
411
            		items.add(itemText.getItemId());
-
 
412
            		entityItemsExclusiveInfo.add(Utils.getExclusiveAffiliateItems().get(itemText.getItemId()));
404
            	}
413
            	}
405
            	log.info("Items before: " + itemTexts);
414
            	log.info("Items before: " + itemTexts);
406
            	if(userinfo.isPrivateDealUser()){
415
            	if(userinfo.isPrivateDealUser()){
407
            		log.info("Private Deal user identified");
416
            		log.info("Private Deal user identified");
408
            		try {
417
            		try {