| Line 14... |
Line 14... |
| 14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 15 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
15 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 16 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
16 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 17 |
import com.spice.profitmandi.web.model.LoginDetails;
|
17 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 18 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
18 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 19 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
- |
|
| 20 |
|
19 |
|
| 21 |
@Controller
|
20 |
@Controller
|
| 22 |
@Transactional(rollbackFor = Throwable.class)
|
21 |
@Transactional(rollbackFor = Throwable.class)
|
| 23 |
public class DashboardController {
|
22 |
public class DashboardController {
|
| 24 |
|
23 |
|
| 25 |
@Autowired
|
24 |
@Autowired
|
| 26 |
CookiesProcessor cookiesProcessor;
|
25 |
private CookiesProcessor cookiesProcessor;
|
| 27 |
|
26 |
|
| 28 |
@Autowired
|
27 |
@Autowired
|
| 29 |
MVCResponseSender mvcResponseSender;
|
- |
|
| 30 |
|
- |
|
| 31 |
@Autowired
|
- |
|
| 32 |
FofoStoreRepository fofoStoreRepository;
|
28 |
private FofoStoreRepository fofoStoreRepository;
|
| 33 |
|
29 |
|
| 34 |
private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);
|
30 |
private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);
|
| 35 |
|
31 |
|
| 36 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
32 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 37 |
public String dashboard(HttpServletRequest request, Model model) throws Exception{
|
33 |
public String dashboard(HttpServletRequest request, Model model) throws ProfitMandiBusinessException{
|
| 38 |
LoginDetails fofoDetails;
|
- |
|
| 39 |
try {
|
- |
|
| 40 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
34 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 41 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 42 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
- |
|
| 43 |
return "response";
|
- |
|
| 44 |
}
|
- |
|
| 45 |
|
35 |
|
| 46 |
FofoStore fofoStore = null;
|
36 |
FofoStore fofoStore = null;
|
| 47 |
try {
|
37 |
try {
|
| 48 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
|
38 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 49 |
} catch (ProfitMandiBusinessException e) {
|
39 |
} catch (ProfitMandiBusinessException e) {
|
| 50 |
LOGGER.error("FofoStore Code not found of {}", fofoDetails);
|
40 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 51 |
}
|
41 |
}
|
| 52 |
model.addAttribute("fofoStoreCode", fofoStore != null ? fofoStore.getCode() : null);
|
42 |
model.addAttribute("fofoStoreCode", fofoStore != null ? fofoStore.getCode() : null);
|
| 53 |
model.addAttribute("appContextPath", request.getContextPath());
|
43 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 54 |
model.addAttribute("roleTypes", fofoDetails.getRoleTypes());
|
44 |
model.addAttribute("roleTypes", loginDetails.getRoleTypes());
|
| 55 |
return "dashboard";
|
45 |
return "dashboard";
|
| 56 |
}
|
46 |
}
|
| 57 |
|
47 |
|
| 58 |
|
48 |
|
| 59 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
49 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
| 60 |
public String contactUs(HttpServletRequest request, Model model) throws Exception{
|
50 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable{
|
| 61 |
model.addAttribute("appContextPath", request.getContextPath());
|
51 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 62 |
return "contact-us";
|
52 |
return "contact-us";
|
| 63 |
}
|
53 |
}
|
| 64 |
|
54 |
|
| 65 |
}
|
55 |
}
|