Subversion Repositories SmartDukaan

Rev

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

Rev 25179 Rev 25180
Line 118... Line 118...
118
	public String dashboard1(HttpServletRequest request, Model model) throws Exception {
118
	public String dashboard1(HttpServletRequest request, Model model) throws Exception {
119
		LOGGER.info("In Dashboard1");
119
		LOGGER.info("In Dashboard1");
120
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
120
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
121
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
121
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
122
		model.addAttribute("isAdmin", isAdmin);
122
		model.addAttribute("isAdmin", isAdmin);
123
		if(!isAdmin) {
123
		if (!isAdmin) {
124
			model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
124
			model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
125
			model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
125
			model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
126
			model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
126
			model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
127
			return "dashboard1";
127
			return "dashboard1";
128
		}
128
		}
Line 191... Line 191...
191
 
191
 
192
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
192
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
193
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
193
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
194
 
194
 
195
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
195
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
196
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
-
 
197
		model.addAttribute("isAdmin", isAdmin);
196
 
198
 
197
		FofoStore fofoStore = null;
199
		FofoStore fofoStore = null;
-
 
200
		if (isAdmin) {
-
 
201
			return "dashboard1";
-
 
202
		} else {
198
		try {
203
			try {
199
			fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
204
				fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
-
 
205
				model.addAttribute("fofoStore", fofoStore);
-
 
206
				model.addAttribute("webApiHost", webApiHost);
-
 
207
				model.addAttribute("webApiPort", webApiPort);
-
 
208
				model.addAttribute("webApiScheme", webApiScheme);
-
 
209
				model.addAttribute("webApiRoot", webApiRoot);
-
 
210
				model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
-
 
211
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
-
 
212
 
-
 
213
				model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
-
 
214
				model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
-
 
215
				model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
-
 
216
				model.addAttribute("isInvestmentOk",
-
 
217
						partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30));
200
		} catch (ProfitMandiBusinessException e) {
218
			} catch (ProfitMandiBusinessException e) {
201
			LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
219
				LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
-
 
220
 
-
 
221
			}
202
		}
222
		}
203
		model.addAttribute("fofoStore", fofoStore);
-
 
204
		model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
-
 
205
		model.addAttribute("webApiHost", webApiHost);
-
 
206
		model.addAttribute("webApiPort", webApiPort);
-
 
207
		model.addAttribute("webApiScheme", webApiScheme);
-
 
208
		model.addAttribute("webApiRoot", webApiRoot);
-
 
209
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
-
 
210
		model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
-
 
211
 
-
 
212
		model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
-
 
213
		model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
-
 
214
		model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
-
 
215
		model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30));
-
 
216
		return "dashboard1";
223
		return "dashboard1";
217
	}
224
	}
218
 
225
 
219
	// This method is currently hardcoded to faciliate watches sold as gift.
226
	// This method is currently hardcoded to faciliate watches sold as gift.
220
	private boolean hasGift(int fofoId) {
227
	private boolean hasGift(int fofoId) {