Rev 7386 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import java.text.SimpleDateFormat;import java.util.Date;import in.shop2020.model.v1.catalog.Item;import in.shop2020.model.v1.order.HotspotStore;import in.shop2020.thrift.clients.CatalogClient;import in.shop2020.thrift.clients.TransactionClient;public class OrderDetailsController extends BaseController {/****/private static final long serialVersionUID = 1L;private long itemId = 9161;private long product_id = 9161;private Item item;private Double price;private Double advanceAmount;private Long deliveryDate;private String displayDate;private String dealText;private String pin;private String imageSource;public String index() {String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");if(loginStatus == null || !loginStatus.equals("TRUE")){return "authfail";}storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));if(!hotspotStores.containsKey(storeId)){try{HotspotStore hotSpotStore = (new TransactionClient()).getClient().getHotspotStore(storeId, "");hotspotStores.put(storeId, hotSpotStore);} catch (Exception e) {log.error("Unable to get store", e);}}/*** The following code should be in create method.**********************************************************************/try {CatalogClient csc = new CatalogClient();setItem(csc.getClient().getItem(product_id));if(!isOCRSession()) {setPrice(getItem().getSellingPrice());}} catch (Exception e) {log.error("Unable to get item from catalog service", e);}/*** ****************END *************************************************************************************************/return INDEX;}public String create(){return index();}public String getProductName() {return item.getBrand()+ (item.getModelName() == null ? "" : " " + item.getModelName())+ (item.getModelNumber() == null ? "" : " " + item.getModelNumber())+ (item.getColor() == null || item.getColor() == "" ? "" : " (" + item.getColor() + ")");}// public String getPricingDetails() {//// SimpleDateFormat sdf = new SimpleDateFormat("h:m a, d MMMM yyyy");// /**// * TODO : Ask for advance to be paid, price and DeliveryDate from catalog Service// */////// price = 10000.0;// advanceAmount = 6000.0;// deliveryDate = 1367498907000L;//// setDisplayDate(sdf.format(new Date(deliveryDate)));// return "pricing-details";// }public void setItemId(long itemId) {this.itemId = itemId;}public long getItemId() {return itemId;}public void setItem(Item item) {this.item = item;}public Item getItem() {return item;}public Double getPrice() {return price;}public void setPrice(Double price) {this.price = price;}public Double getAdvanceAmount() {return advanceAmount;}public void setAdvanceAmount(Double advanceAmount) {this.advanceAmount = advanceAmount;}public Long getDeliveryDate() {return deliveryDate;}public void setDeliveryDate(Long deliveryDate) {this.deliveryDate = deliveryDate;}public void setDisplayDate(String displayDate) {this.displayDate = displayDate;}public String getDisplayDate() {return displayDate;}public void setDealText(String dealText) {this.dealText = dealText;}public String getDealText() {return dealText;}public void setPin(String pin) {this.pin = pin;}public String getPin() {return pin;}public void setProduct_id(long product_id) {this.itemId = product_id;this.product_id = product_id;}public long getProduct_id() {return product_id;}public String getImageSource() {return "/storewebsite/images/website/" + Long.toString(item.getCatalogItemId()) + "/default.jpg";}public void setImageSource(String imageSource) {this.imageSource = imageSource;}}