Subversion Repositories SmartDukaan

Rev

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

Rev 7358 Rev 7424
Line 4... Line 4...
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
import in.shop2020.logistics.DeliveryType;
6
import in.shop2020.logistics.DeliveryType;
7
import in.shop2020.logistics.LogisticsInfo;
7
import in.shop2020.logistics.LogisticsInfo;
8
import in.shop2020.logistics.LogisticsService.Client;
8
import in.shop2020.logistics.LogisticsService.Client;
-
 
9
import in.shop2020.model.v1.catalog.Item;
-
 
10
import in.shop2020.model.v1.catalog.ItemShippingInfo;
9
import in.shop2020.model.v1.catalog.StorePricing;
11
import in.shop2020.model.v1.catalog.StorePricing;
10
import in.shop2020.thrift.clients.CatalogClient;
12
import in.shop2020.thrift.clients.CatalogClient;
11
import in.shop2020.thrift.clients.LogisticsClient;
13
import in.shop2020.thrift.clients.LogisticsClient;
12
 
14
 
13
import java.text.SimpleDateFormat;
15
import java.text.SimpleDateFormat;
Line 41... Line 43...
41
    private Map<String, String> response = new HashMap<String, String>();
43
    private Map<String, String> response = new HashMap<String, String>();
42
 
44
 
43
    private double maxSellingPrice;
45
    private double maxSellingPrice;
44
 
46
 
45
    private double minSellingPrice;
47
    private double minSellingPrice;
-
 
48
    private boolean isActive;
-
 
49
    private boolean activeOnStore;
46
    
50
    
47
    public EstimateController() {
51
    public EstimateController() {
48
        super();
52
        super();
49
    }
53
    }
50
    
54
    
Line 59... Line 63...
59
            LogisticsInfo logistincInfo = logisticsClient.getLogisticsEstimationForStore(itemId, pin, DeliveryType.COD);
63
            LogisticsInfo logistincInfo = logisticsClient.getLogisticsEstimationForStore(itemId, pin, DeliveryType.COD);
60
            date = logistincInfo.getDeliveryTime();
64
            date = logistincInfo.getDeliveryTime();
61
            isCODAvailable = logistincInfo.isCodAllowed();
65
            isCODAvailable = logistincInfo.isCodAllowed();
62
            isOTGAvailable = logistincInfo.isOtgAvailable();
66
            isOTGAvailable = logistincInfo.isOtgAvailable();
63
            catalogServiceClient = new CatalogClient();
67
            catalogServiceClient = new CatalogClient();
-
 
68
            ItemShippingInfo info = catalogServiceClient.getClient().isActive(itemId);
-
 
69
            isActive = info.isIsActive();
-
 
70
            activeOnStore = catalogServiceClient.getClient().getItem(itemId).isActiveOnStore();
64
            sp = catalogServiceClient.getClient().getStorePricing(itemId);
71
            sp = catalogServiceClient.getClient().getStorePricing(itemId);
65
            sellingPrice = sp.getRecommendedPrice();
72
            sellingPrice = sp.getRecommendedPrice();
66
            minAdvanceAmount = logistincInfo.getProviderId();
73
            minAdvanceAmount = logistincInfo.getProviderId();
67
            maxSellingPrice = sp.getMaxPrice();
74
            maxSellingPrice = sp.getMaxPrice();
68
            minSellingPrice = sp.getMinPrice();
75
            minSellingPrice = sp.getMinPrice();
Line 82... Line 89...
82
        response.put("min_selling_price", Double.toString(minSellingPrice));
89
        response.put("min_selling_price", Double.toString(minSellingPrice));
83
        response.put("max_selling_price", Double.toString(maxSellingPrice));
90
        response.put("max_selling_price", Double.toString(maxSellingPrice));
84
        response.put("best_deal_text", sp.getBestDealText() == null ? " " : sp.getBestDealText());
91
        response.put("best_deal_text", sp.getBestDealText() == null ? " " : sp.getBestDealText());
85
        response.put("freebie_item_id", Long.toString(sp.getFreebieItemId()));
92
        response.put("freebie_item_id", Long.toString(sp.getFreebieItemId()));
86
        response.put("absolute_min_price", Double.toString(sp.getAbsoluteMinPrice()));
93
        response.put("absolute_min_price", Double.toString(sp.getAbsoluteMinPrice()));
-
 
94
        response.put("is_active", Boolean.toString(isActive));
-
 
95
        response.put("active_on_store", Boolean.toString(activeOnStore));
87
        return "index";
96
        return "index";
88
    }
97
    }
89
    
98
    
90
    public String show(){
99
    public String show(){
91
        StringTokenizer tokenizer = new StringTokenizer(this.id, "_");
100
        StringTokenizer tokenizer = new StringTokenizer(this.id, "_");