Rev 22481 | Rev 22927 | 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.transaction.annotation.Transactional;import org.springframework.ui.Model;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.entity.fofo.FofoStore;import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;import com.spice.profitmandi.web.model.LoginDetails;import com.spice.profitmandi.web.util.CookiesProcessor;import com.spice.profitmandi.web.util.MVCResponseSender;@Controller@Transactional(rollbackFor = Throwable.class)public class DashboardController {@AutowiredCookiesProcessor cookiesProcessor;@AutowiredMVCResponseSender mvcResponseSender;@AutowiredFofoStoreRepository fofoStoreRepository;private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);@RequestMapping(value = "/dashboard", method = RequestMethod.GET)public String dashboard(HttpServletRequest request, Model model) throws Exception{LoginDetails fofoDetails;try {fofoDetails = cookiesProcessor.getCookiesObject(request);} catch (ProfitMandiBusinessException e) {model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));return "response";}FofoStore fofoStore = null;try {fofoStore = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());} catch (ProfitMandiBusinessException e) {LOGGER.error("FofoStore Code not found of {}", fofoDetails);}model.addAttribute("fofoStoreCode", fofoStore != null ? fofoStore.getCode() : null);model.addAttribute("appContextPath", request.getContextPath());return "dashboard";}@RequestMapping(value = "/contactUs", method = RequestMethod.GET)public String contactUs(HttpServletRequest request, Model model) throws Exception{model.addAttribute("appContextPath", request.getContextPath());return "contact-us";}}