Subversion Repositories SmartDukaan

Rev

Rev 21574 | Rev 21583 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.dao.repository.OrderRepository;
import com.spice.profitmandi.web.model.FofoDetails;
import com.spice.profitmandi.web.util.CookiesFetcher;
import com.spice.profitmandi.web.util.MVCResponseSender;

@Controller
public class PurchaseController {

        private static final Logger LOGGER = LoggerFactory.getLogger(PurchaseController.class);
        
        @Autowired
        OrderRepository orderRepository;
        
        @Autowired
        CookiesFetcher cookiesFetcher;
        
        @Autowired
        MVCResponseSender mvcResponseSender;
        
        @RequestMapping(value = "/purchase", method = RequestMethod.POST)
        public String orderByAirwayBillOrInvoiceNumber(HttpServletRequest request, Model model)  throws Exception, ProfitMandiBusinessException{
                FofoDetails fofoDetails = cookiesFetcher.getCookiesObject(request);
                String airwayBillOrInvoiceNumber = (String) request.getAttribute("airwayBillOrInvoiceNumber");
                model.addAttribute("customItems", orderRepository.selectByAirwayBillOrInvoiceNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId()));
                return "purchase";
        }
        
        @RequestMapping(value = "/purchase", method = RequestMethod.GET)
        public String orderByAirwayBillOrInvoiceNumber(HttpServletRequest request)  throws Exception{
                return "purchase";
        }
        
}