Subversion Repositories SmartDukaan

Rev

Rev 21577 | Rev 21612 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21577 Rev 21581
Line 7... Line 7...
7
import org.slf4j.Logger;
7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
8
import org.slf4j.LoggerFactory;
9
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.stereotype.Controller;
10
import org.springframework.stereotype.Controller;
11
import org.springframework.ui.Model;
11
import org.springframework.ui.Model;
-
 
12
import org.springframework.ui.ModelMap;
12
import org.springframework.web.bind.annotation.ModelAttribute;
13
import org.springframework.web.bind.annotation.ModelAttribute;
13
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.RequestParam;
15
import org.springframework.web.bind.annotation.RequestParam;
15
 
16
 
16
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
17
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
Line 35... Line 36...
35
	
36
	
36
	@Autowired
37
	@Autowired
37
	CookiesFetcher cookiesFetcher;
38
	CookiesFetcher cookiesFetcher;
38
	
39
	
39
	@RequestMapping(value = "/checkCurrentAvailability")
40
	@RequestMapping(value = "/checkCurrentAvailability")
40
	public String getCurrentAvailability(HttpServletRequest request, @ModelAttribute Model model) throws Exception{
41
	public String getCurrentAvailability(HttpServletRequest request, @ModelAttribute ModelMap model) throws Exception{
41
		FofoDetails fofoDetails;
42
		FofoDetails fofoDetails;
42
		try {
43
		try {
43
			fofoDetails = cookiesFetcher.getCookiesObject(request);
44
			fofoDetails = cookiesFetcher.getCookiesObject(request);
44
		} catch (ProfitMandiBusinessException e) {
45
		} catch (ProfitMandiBusinessException e) {
45
			return mvcResponseSender.createResponseString("RTLR_1009", false, "/login");
46
			model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
-
 
47
			return "response";
46
		}
48
		}
47
		try{
49
		try{
48
			List<CurrentInventorySnapshot> currentInventorySnapshots = currentInventorySnapshotRepository.getByFofoId(fofoDetails.getFofoId());
50
			List<CurrentInventorySnapshot> currentInventorySnapshots = currentInventorySnapshotRepository.getByFofoId(fofoDetails.getFofoId());
49
			model.addAttribute("currentInventorySnapshots", currentInventorySnapshots);
51
			model.addAttribute("currentInventorySnapshots", currentInventorySnapshots);
50
			return "dashboard";
52
			return "dashboard";
51
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
53
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
52
			return mvcResponseSender.createResponseString("INVNTRY_SNPSHT", false, "/dashboard");
54
			model.addAttribute("loginResponse", mvcResponseSender.createResponseString("INVNTRY_SNPSHT", false, "/dashboard"));
-
 
55
			return "response";
53
		}
56
		}
54
	}
57
	}
55
	
58
	
56
	@RequestMapping(value = "/checkItemAvailability")
59
	@RequestMapping(value = "/checkItemAvailability")
57
	public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, @ModelAttribute Model model) throws Exception{
60
	public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, @ModelAttribute Model model) throws Exception{
58
		FofoDetails fofoDetails;
61
		FofoDetails fofoDetails;
59
		try {
62
		try {
60
			fofoDetails = cookiesFetcher.getCookiesObject(request);
63
			fofoDetails = cookiesFetcher.getCookiesObject(request);
61
		} catch (ProfitMandiBusinessException e) {
64
		} catch (ProfitMandiBusinessException e) {
62
			return mvcResponseSender.createResponseString("RTLR_1009", false, "/login");
65
			model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
-
 
66
			return "response";
63
		}
67
		}
64
		try{
68
		try{
65
			FofoItemId fofoItemId = new FofoItemId();
69
			FofoItemId fofoItemId = new FofoItemId();
66
			fofoItemId.setFofoId(fofoDetails.getFofoId());
70
			fofoItemId.setFofoId(fofoDetails.getFofoId());
67
			fofoItemId.setItemId(itemId);
71
			fofoItemId.setItemId(itemId);
68
			CurrentInventorySnapshot currentInventorySnapshot = currentInventorySnapshotRepository.selectByFofoItemId(fofoItemId);
72
			CurrentInventorySnapshot currentInventorySnapshot = currentInventorySnapshotRepository.selectByFofoItemId(fofoItemId);
69
			model.addAttribute("currentInventorySnapshots", currentInventorySnapshot);
73
			model.addAttribute("currentInventorySnapshots", currentInventorySnapshot);
70
			return "dashboard";
74
			return "dashboard";
71
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
75
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
72
			return mvcResponseSender.createResponseString("INVNTRY_SNPSHT", false, "/dashboard");
76
			model.addAttribute("loginResponse", mvcResponseSender.createResponseString("INVNTRY_SNPSHT", false, "/dashboard"));
-
 
77
			return "response";
73
		}
78
		}
74
	}
79
	}
75
	
80
	
76
}
81
}