Subversion Repositories SmartDukaan

Rev

Rev 7226 | Rev 7263 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7226 anupam.sin 1
package in.shop2020.serving.controllers;
2
 
3
import java.text.SimpleDateFormat;
4
import java.util.Date;
5
 
6
import in.shop2020.model.v1.catalog.Item;
7
import in.shop2020.thrift.clients.CatalogClient;
8
 
9
public class OrderDetailsController  extends BaseController {
10
 
11
    /**
12
     * 
13
     */
14
    private static final long serialVersionUID = 1L;
15
    private long itemId = 9161;
16
    private long product_id = 9161;
17
    private Item item;
18
    private Double price;
19
    private Double advanceAmount;
20
    private Long deliveryDate;
21
    private String displayDate;
22
    private String dealText;
23
    private String pin;
24
 
25
    public String index() {
26
 
27
        /**
28
         * The following code should be in create method.*********************************************************************
29
         */
30
        try {
31
            CatalogClient csc = new CatalogClient();
32
            setItem(csc.getClient().getItem(itemId));
33
 
34
            setDealText("Get a house free with this product");
35
 
36
       } catch (Exception e) {
37
           log.error("Unable to get item from catalog service", e);
38
       }
39
       /**
40
        * ****************END ************************************************************************************************
41
        */
42
 
43
       return INDEX;
44
    }
45
 
46
    public String create(){
47
        return index();
48
    }
49
 
50
    public String getProductName() {
51
        return item.getBrand() 
52
                + (item.getModelName() == null ? "" : " " + item.getModelName())
53
                + (item.getModelNumber() == null ? "" : " " + item.getModelNumber())
54
                + (item.getColor() == null ? "" : " (" + item.getColor() + ")");
55
    }
56
 
57
    public String getPricingDetails() {
58
 
7248 anupam.sin 59
        SimpleDateFormat sdf = new SimpleDateFormat("h:m a, d MMMM yyyy");
7226 anupam.sin 60
        /**
61
         * TODO : Ask for advance to be paid, price and DeliveryDate from catalog Service
62
         */
63
        price = 10000.0;
64
        advanceAmount = 6000.0;
65
        deliveryDate = 1367498907000L;
66
 
67
        setDisplayDate(sdf.format(new Date(deliveryDate)));
68
        return "pricing-details";
69
    }
70
 
71
    public void setItemId(long itemId) {
72
        this.itemId = itemId;
73
    }
74
    public long getItemId() {
75
        return itemId;
76
    }
77
 
78
    public void setItem(Item item) {
79
        this.item = item;
80
    }
81
 
82
    public Item getItem() {
83
        return item;
84
    }
85
 
86
    public Double getPrice() {
87
        return price;
88
    }
89
 
90
    public void setPrice(Double price) {
91
        this.price = price;
92
    }
93
 
94
    public Double getAdvanceAmount() {
95
        return advanceAmount;
96
    }
97
 
98
    public void setAdvanceAmount(Double advanceAmount) {
99
        this.advanceAmount = advanceAmount;
100
    }
101
 
102
    public Long getDeliveryDate() {
103
        return deliveryDate;
104
    }
105
 
106
    public void setDeliveryDate(Long deliveryDate) {
107
        this.deliveryDate = deliveryDate;
108
    }
109
 
110
    public void setDisplayDate(String displayDate) {
111
        this.displayDate = displayDate;
112
    }
113
 
114
    public String getDisplayDate() {
115
        return displayDate;
116
    }
117
 
118
    public void setDealText(String dealText) {
119
        this.dealText = dealText;
120
    }
121
 
122
    public String getDealText() {
123
        return dealText;
124
    }
125
 
126
    public void setPin(String pin) {
127
        this.pin = pin;
128
    }
129
 
130
    public String getPin() {
131
        return pin;
132
    }
133
 
134
    public void setProduct_id(long product_id) {
135
        this.itemId = product_id;
136
    }
137
 
138
}