| 21615 |
kshitij.so |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 23568 |
govind |
3 |
import java.io.IOException;
|
|
|
4 |
import java.net.URISyntaxException;
|
|
|
5 |
|
| 22086 |
amit.gupta |
6 |
import javax.servlet.http.HttpServletRequest;
|
|
|
7 |
|
| 23786 |
amit.gupta |
8 |
import org.apache.logging.log4j.LogManager;
|
| 23568 |
govind |
9 |
import org.apache.logging.log4j.Logger;
|
| 22481 |
ashik.ali |
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23379 |
ashik.ali |
11 |
import org.springframework.beans.factory.annotation.Value;
|
| 21615 |
kshitij.so |
12 |
import org.springframework.stereotype.Controller;
|
| 22481 |
ashik.ali |
13 |
import org.springframework.transaction.annotation.Transactional;
|
| 22073 |
ashik.ali |
14 |
import org.springframework.ui.Model;
|
| 21615 |
kshitij.so |
15 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
16 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
17 |
|
| 22481 |
ashik.ali |
18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 22654 |
ashik.ali |
19 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 22481 |
ashik.ali |
20 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23844 |
amit.gupta |
21 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 22481 |
ashik.ali |
22 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
23 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
|
|
24 |
|
| 21615 |
kshitij.so |
25 |
@Controller
|
| 22481 |
ashik.ali |
26 |
@Transactional(rollbackFor = Throwable.class)
|
| 21615 |
kshitij.so |
27 |
public class DashboardController {
|
| 23379 |
ashik.ali |
28 |
|
|
|
29 |
@Value("${web.api.host}")
|
|
|
30 |
private String webApiHost;
|
|
|
31 |
|
|
|
32 |
@Value("${web.api.port}")
|
|
|
33 |
private int webApiPort;
|
| 21615 |
kshitij.so |
34 |
|
| 22481 |
ashik.ali |
35 |
@Autowired
|
| 22927 |
ashik.ali |
36 |
private CookiesProcessor cookiesProcessor;
|
| 23784 |
ashik.ali |
37 |
|
| 23568 |
govind |
38 |
@Autowired
|
| 23786 |
amit.gupta |
39 |
private RoleManager roleManager;
|
| 23784 |
ashik.ali |
40 |
|
| 23838 |
ashik.ali |
41 |
@Autowired
|
|
|
42 |
private FofoStoreRepository fofoStoreRepository;
|
|
|
43 |
|
| 23568 |
govind |
44 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 21615 |
kshitij.so |
45 |
|
|
|
46 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 23568 |
govind |
47 |
public String dashboard(HttpServletRequest request, Model model) throws ProfitMandiBusinessException, URISyntaxException, IOException{
|
| 22927 |
ashik.ali |
48 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 22481 |
ashik.ali |
49 |
|
|
|
50 |
FofoStore fofoStore = null;
|
|
|
51 |
try {
|
| 22927 |
ashik.ali |
52 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 22481 |
ashik.ali |
53 |
} catch (ProfitMandiBusinessException e) {
|
| 22927 |
ashik.ali |
54 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 22481 |
ashik.ali |
55 |
}
|
| 23848 |
ashik.ali |
56 |
model.addAttribute("fofoStore", fofoStore);
|
| 22086 |
amit.gupta |
57 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 23796 |
amit.gupta |
58 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 23379 |
ashik.ali |
59 |
model.addAttribute("webApiHost", webApiHost);
|
|
|
60 |
model.addAttribute("webApiPort", webApiPort);
|
| 23568 |
govind |
61 |
//LOGGER.info("loginDetails.getFofoId()"+loginDetails.getFofoId());
|
|
|
62 |
//inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
|
| 21615 |
kshitij.so |
63 |
return "dashboard";
|
|
|
64 |
}
|
|
|
65 |
|
| 22860 |
ashik.ali |
66 |
|
| 22354 |
ashik.ali |
67 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
68 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable{
|
| 22354 |
ashik.ali |
69 |
model.addAttribute("appContextPath", request.getContextPath());
|
|
|
70 |
return "contact-us";
|
|
|
71 |
}
|
|
|
72 |
|
| 23366 |
ashik.ali |
73 |
/*private List<PaymentOption> getPaymentOptions(int fofoId){
|
|
|
74 |
List<Integer> paymentOptionIds = fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(fofoId);
|
|
|
75 |
if(paymentOptionIds.isEmpty()){
|
|
|
76 |
return new ArrayList<>();
|
|
|
77 |
}
|
|
|
78 |
return paymentOptionRepository.selectByIds(new HashSet<>(paymentOptionIds));
|
|
|
79 |
}*/
|
|
|
80 |
|
|
|
81 |
|
| 21615 |
kshitij.so |
82 |
}
|