Subversion Repositories SmartDukaan

Rev

Rev 21574 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21574 Rev 21581
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.util.Arrays;
-
 
4
import java.util.List;
-
 
5
 
-
 
6
import javax.servlet.http.HttpServletRequest;
3
import javax.servlet.http.HttpServletRequest;
7
 
4
 
8
import org.slf4j.Logger;
5
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
6
import org.slf4j.LoggerFactory;
10
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Autowired;
Line 13... Line 10...
13
import org.springframework.web.bind.annotation.ModelAttribute;
10
import org.springframework.web.bind.annotation.ModelAttribute;
14
import org.springframework.web.bind.annotation.RequestMapping;
11
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RequestMethod;
12
import org.springframework.web.bind.annotation.RequestMethod;
16
import org.springframework.web.bind.annotation.RequestParam;
13
import org.springframework.web.bind.annotation.RequestParam;
17
 
14
 
18
import com.spice.profitmandi.common.model.CustomItem;
-
 
19
import com.spice.profitmandi.common.model.ProfitMandiConstants;
15
import com.spice.profitmandi.common.model.ProfitMandiConstants;
20
import com.spice.profitmandi.dao.repository.OrderRepository;
16
import com.spice.profitmandi.dao.repository.OrderRepository;
21
import com.spice.profitmandi.web.model.FofoDetails;
17
import com.spice.profitmandi.web.model.FofoDetails;
22
import com.spice.profitmandi.web.util.MVCResponseSender;
18
import com.spice.profitmandi.web.util.MVCResponseSender;
23
 
19
 
Line 31... Line 27...
31
	
27
	
32
	@Autowired
28
	@Autowired
33
	MVCResponseSender mvcResponseSender;
29
	MVCResponseSender mvcResponseSender;
34
	
30
	
35
	@RequestMapping(value = "/orders", method = RequestMethod.POST)
31
	@RequestMapping(value = "/orders", method = RequestMethod.POST)
36
	public String orderByAirwayBillOrInvoiceNumber(HttpServletRequest request, @RequestParam(name = "airwayBillOrInvoiceNumber") String airwayBillOrInvoiceNumber, @RequestParam(name = ProfitMandiConstants.TYPE) String type, @ModelAttribute Model model)  throws Exception{
32
	public String orderByAirwayBillOrInvoiceNumber(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.AIRWAY_BILL_OR_INVOICE_NUMBER) String airwayBillOrInvoiceNumber, @ModelAttribute Model model)  throws Exception{
37
		FofoDetails fofoDetails = null;
33
		FofoDetails fofoDetails = null;
38
		fofoDetails = (FofoDetails)request.getSession(false).getAttribute(ProfitMandiConstants.FOFO_DETAILS);
34
		fofoDetails = (FofoDetails)request.getSession(false).getAttribute(ProfitMandiConstants.FOFO_DETAILS);
39
		if(ProfitMandiConstants.AIRWAY_BILL_NUMBER.equals(type) || ProfitMandiConstants.INVOICE_NUMBER.equals(type)){
-
 
40
			List<CustomItem> customItems;
-
 
41
			if(ProfitMandiConstants.AIRWAY_BILL_NUMBER.equals(type)){
-
 
42
				customItems = orderRepository.selectByAirwayBillNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId());
35
		model.addAttribute("customItems", orderRepository.selectByAirwayBillOrInvoiceNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId()));
43
			}else{
-
 
44
				customItems = orderRepository.selectByInvoiceNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId());
-
 
45
			}
-
 
46
			model.addAttribute("customItems", customItems);
-
 
47
			return "orders";
36
		return "orders";
48
		}else{
-
 
49
			LOGGER.error("Given type is not valid, please choose any one {}", Arrays.asList(ProfitMandiConstants.AIRWAY_BILL_NUMBER, ProfitMandiConstants.INVOICE_NUMBER));
-
 
50
			return mvcResponseSender.createResponseString("RTLR_VE_1021", false, "/error");
-
 
51
		}
-
 
52
	}
37
	}
53
	
38
	
54
}
39
}