Subversion Repositories SmartDukaan

Rev

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

Rev 7323 Rev 7386
Line 2... Line 2...
2
 
2
 
3
import java.text.SimpleDateFormat;
3
import java.text.SimpleDateFormat;
4
import java.util.Date;
4
import java.util.Date;
5
 
5
 
6
import in.shop2020.model.v1.catalog.Item;
6
import in.shop2020.model.v1.catalog.Item;
-
 
7
import in.shop2020.model.v1.order.HotspotStore;
7
import in.shop2020.thrift.clients.CatalogClient;
8
import in.shop2020.thrift.clients.CatalogClient;
-
 
9
import in.shop2020.thrift.clients.TransactionClient;
8
 
10
 
9
public class OrderDetailsController  extends BaseController {
11
public class OrderDetailsController  extends BaseController {
10
 
12
 
11
    /**
13
    /**
12
     * 
14
     * 
Line 22... Line 24...
22
    private String dealText;
24
    private String dealText;
23
    private String pin;
25
    private String pin;
24
    private String imageSource;
26
    private String imageSource;
25
    
27
    
26
    public String index() {
28
    public String index() {
-
 
29
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
-
 
30
        if(loginStatus == null || !loginStatus.equals("TRUE")){
-
 
31
            return "authfail";
-
 
32
        }
-
 
33
        
-
 
34
        storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
-
 
35
        if(!hotspotStores.containsKey(storeId)){
-
 
36
            try{
-
 
37
                HotspotStore hotSpotStore = (new TransactionClient()).getClient().getHotspotStore(storeId, "");
-
 
38
                hotspotStores.put(storeId, hotSpotStore);
-
 
39
            } catch (Exception e) {
-
 
40
                log.error("Unable to get store", e);
-
 
41
            }
-
 
42
        }
27
        
43
        
28
        /**
44
        /**
29
         * The following code should be in create method.*********************************************************************
45
         * The following code should be in create method.*********************************************************************
30
         */
46
         */
31
        try {
47
        try {
32
            CatalogClient csc = new CatalogClient();
48
            CatalogClient csc = new CatalogClient();
33
            setItem(csc.getClient().getItem(product_id));
49
            setItem(csc.getClient().getItem(product_id));
34
            
50
            
35
            //csc.getClient().getStorePricing(product_id).getBEstDEal
51
            //csc.getClient().getStorePricing(product_id).getBEstDEal
36
            
52
            
37
            setDealText("Get a house free with this product");
53
//            setDealText("Get a house free with this product");
38
            
54
            
39
       } catch (Exception e) {
55
       } catch (Exception e) {
40
           log.error("Unable to get item from catalog service", e);
56
           log.error("Unable to get item from catalog service", e);
41
       }
57
       }
42
       /**
58
       /**
Line 55... Line 71...
55
                + (item.getModelName() == null ? "" : " " + item.getModelName())
71
                + (item.getModelName() == null ? "" : " " + item.getModelName())
56
                + (item.getModelNumber() == null ? "" : " " + item.getModelNumber())
72
                + (item.getModelNumber() == null ? "" : " " + item.getModelNumber())
57
                + (item.getColor() == null || item.getColor() == "" ? "" : " (" + item.getColor() + ")");
73
                + (item.getColor() == null || item.getColor() == "" ? "" : " (" + item.getColor() + ")");
58
    }
74
    }
59
    
75
    
60
    public String getPricingDetails() {
76
//    public String getPricingDetails() {
61
 
77
//
62
        SimpleDateFormat sdf = new SimpleDateFormat("h:m a, d MMMM yyyy");
78
//        SimpleDateFormat sdf = new SimpleDateFormat("h:m a, d MMMM yyyy");
63
        /**
79
//        /**
64
         * TODO : Ask for advance to be paid, price and DeliveryDate from catalog Service
80
//         * TODO : Ask for advance to be paid, price and DeliveryDate from catalog Service
65
         */
81
//         */
66
        
82
//        
67
        
83
//        
68
        price = 10000.0;
84
//        price = 10000.0;
69
        advanceAmount = 6000.0;
85
//        advanceAmount = 6000.0;
70
        deliveryDate = 1367498907000L;
86
//        deliveryDate = 1367498907000L;
71
        
87
//        
72
        setDisplayDate(sdf.format(new Date(deliveryDate)));
88
//        setDisplayDate(sdf.format(new Date(deliveryDate)));
73
        return "pricing-details";
89
//        return "pricing-details";
74
    }
90
//    }
75
    
91
    
76
    public void setItemId(long itemId) {
92
    public void setItemId(long itemId) {
77
        this.itemId = itemId;
93
        this.itemId = itemId;
78
    }
94
    }
79
    public long getItemId() {
95
    public long getItemId() {