| 21615 |
kshitij.so |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 22086 |
amit.gupta |
3 |
import javax.servlet.http.HttpServletRequest;
|
|
|
4 |
|
| 21615 |
kshitij.so |
5 |
import org.slf4j.Logger;
|
|
|
6 |
import org.slf4j.LoggerFactory;
|
| 22481 |
ashik.ali |
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21615 |
kshitij.so |
8 |
import org.springframework.stereotype.Controller;
|
| 22481 |
ashik.ali |
9 |
import org.springframework.transaction.annotation.Transactional;
|
| 22073 |
ashik.ali |
10 |
import org.springframework.ui.Model;
|
| 21615 |
kshitij.so |
11 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
12 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
13 |
|
| 22481 |
ashik.ali |
14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 22654 |
ashik.ali |
15 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 22481 |
ashik.ali |
16 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
|
|
17 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
18 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
|
|
19 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
|
|
20 |
|
| 21615 |
kshitij.so |
21 |
@Controller
|
| 22481 |
ashik.ali |
22 |
@Transactional(rollbackFor = Throwable.class)
|
| 21615 |
kshitij.so |
23 |
public class DashboardController {
|
|
|
24 |
|
| 22481 |
ashik.ali |
25 |
@Autowired
|
|
|
26 |
CookiesProcessor cookiesProcessor;
|
|
|
27 |
|
|
|
28 |
@Autowired
|
|
|
29 |
MVCResponseSender mvcResponseSender;
|
|
|
30 |
|
|
|
31 |
@Autowired
|
|
|
32 |
FofoStoreRepository fofoStoreRepository;
|
|
|
33 |
|
| 21615 |
kshitij.so |
34 |
private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);
|
|
|
35 |
|
|
|
36 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 22086 |
amit.gupta |
37 |
public String dashboard(HttpServletRequest request, Model model) throws Exception{
|
| 22481 |
ashik.ali |
38 |
LoginDetails fofoDetails;
|
|
|
39 |
try {
|
|
|
40 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
41 |
} catch (ProfitMandiBusinessException e) {
|
|
|
42 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
|
|
43 |
return "response";
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
FofoStore fofoStore = null;
|
|
|
47 |
try {
|
|
|
48 |
fofoStore = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
|
|
|
49 |
} catch (ProfitMandiBusinessException e) {
|
|
|
50 |
LOGGER.error("FofoStore Code not found of {}", fofoDetails);
|
|
|
51 |
}
|
|
|
52 |
model.addAttribute("fofoStoreCode", fofoStore != null ? fofoStore.getCode() : null);
|
| 22086 |
amit.gupta |
53 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 21615 |
kshitij.so |
54 |
return "dashboard";
|
|
|
55 |
}
|
|
|
56 |
|
| 22354 |
ashik.ali |
57 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
|
|
58 |
public String contactUs(HttpServletRequest request, Model model) throws Exception{
|
|
|
59 |
model.addAttribute("appContextPath", request.getContextPath());
|
|
|
60 |
return "contact-us";
|
|
|
61 |
}
|
|
|
62 |
|
| 21615 |
kshitij.so |
63 |
}
|