Subversion Repositories SmartDukaan

Rev

Rev 21574 | View as "text/plain" | Blame | 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 org.springframework.web.bind.annotation.RequestParam;

import com.spice.profitmandi.common.model.ProfitMandiConstants;
import com.spice.profitmandi.dao.repository.OrderRepository;
import com.spice.profitmandi.web.model.FofoDetails;
import com.spice.profitmandi.web.util.MVCResponseSender;

@Controller
public class OrderController {

        private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);
        
        @Autowired
        OrderRepository orderRepository;
        
        @Autowired
        MVCResponseSender mvcResponseSender;
        
        @RequestMapping(value = "/orders", method = RequestMethod.POST)
        public String orderByAirwayBillOrInvoiceNumber(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.AIRWAY_BILL_OR_INVOICE_NUMBER) String airwayBillOrInvoiceNumber, @ModelAttribute Model model)  throws Exception{
                FofoDetails fofoDetails = null;
                fofoDetails = (FofoDetails)request.getSession(false).getAttribute(ProfitMandiConstants.FOFO_DETAILS);
                model.addAttribute("customItems", orderRepository.selectByAirwayBillOrInvoiceNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId()));
                return "orders";
        }
        
}