| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import javax.servlet.http.HttpServletRequest;
|
3 |
import javax.servlet.http.HttpServletRequest;
|
| 4 |
|
4 |
|
| 5 |
import org.slf4j.Logger;
|
5 |
import org.slf4j.Logger;
|
| 6 |
import org.slf4j.LoggerFactory;
|
6 |
import org.slf4j.LoggerFactory;
|
| - |
|
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 7 |
import org.springframework.stereotype.Controller;
|
8 |
import org.springframework.stereotype.Controller;
|
| - |
|
9 |
import org.springframework.transaction.annotation.Transactional;
|
| 8 |
import org.springframework.ui.Model;
|
10 |
import org.springframework.ui.Model;
|
| 9 |
import org.springframework.web.bind.annotation.RequestMapping;
|
11 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 10 |
import org.springframework.web.bind.annotation.RequestMethod;
|
12 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 11 |
|
13 |
|
| - |
|
14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
15 |
import com.spice.profitmandi.dao.entity.dtr.FofoStore;
|
| - |
|
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 |
|
| 12 |
@Controller
|
21 |
@Controller
|
| - |
|
22 |
@Transactional(rollbackFor = Throwable.class)
|
| 13 |
public class DashboardController {
|
23 |
public class DashboardController {
|
| 14 |
|
24 |
|
| - |
|
25 |
@Autowired
|
| - |
|
26 |
CookiesProcessor cookiesProcessor;
|
| - |
|
27 |
|
| - |
|
28 |
@Autowired
|
| - |
|
29 |
MVCResponseSender mvcResponseSender;
|
| - |
|
30 |
|
| - |
|
31 |
@Autowired
|
| - |
|
32 |
FofoStoreRepository fofoStoreRepository;
|
| - |
|
33 |
|
| 15 |
private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);
|
34 |
private static final Logger LOGGER = LoggerFactory.getLogger(DashboardController.class);
|
| 16 |
|
35 |
|
| 17 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
36 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 18 |
public String dashboard(HttpServletRequest request, Model model) throws Exception{
|
37 |
public String dashboard(HttpServletRequest request, Model model) throws Exception{
|
| - |
|
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);
|
| 19 |
model.addAttribute("appContextPath", request.getContextPath());
|
53 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 20 |
return "dashboard";
|
54 |
return "dashboard";
|
| 21 |
}
|
55 |
}
|
| 22 |
|
56 |
|
| 23 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
57 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|