| 22981 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import java.util.Map;
|
|
|
4 |
|
|
|
5 |
import javax.servlet.http.HttpServletRequest;
|
|
|
6 |
|
|
|
7 |
import org.slf4j.Logger;
|
|
|
8 |
import org.slf4j.LoggerFactory;
|
|
|
9 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
10 |
import org.springframework.stereotype.Controller;
|
|
|
11 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
12 |
import org.springframework.ui.Model;
|
| 23026 |
ashik.ali |
13 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 22981 |
ashik.ali |
14 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
15 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
16 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
17 |
|
|
|
18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
|
|
19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 23026 |
ashik.ali |
20 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
| 22981 |
ashik.ali |
21 |
import com.spice.profitmandi.service.user.RetailerService;
|
|
|
22 |
|
|
|
23 |
@Controller
|
|
|
24 |
@Transactional(rollbackFor=Throwable.class)
|
|
|
25 |
public class RetailerController {
|
|
|
26 |
|
|
|
27 |
private static final Logger LOGGER = LoggerFactory.getLogger(RetailerController.class);
|
|
|
28 |
|
|
|
29 |
@Autowired
|
|
|
30 |
private RetailerService retailerService;
|
|
|
31 |
|
|
|
32 |
@RequestMapping(value = "/retailerDetail", method = RequestMethod.GET)
|
|
|
33 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber, Model model) throws ProfitMandiBusinessException{
|
|
|
34 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(), emailIdOrMobileNumber);
|
|
|
35 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
|
|
36 |
model.addAllAttributes(map);
|
|
|
37 |
return "retailer-details";
|
|
|
38 |
}
|
|
|
39 |
|
| 23026 |
ashik.ali |
40 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
|
|
41 |
public String updateRetailerDetails(HttpServletRequest request, @RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException{
|
|
|
42 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
|
|
43 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
|
|
44 |
model.addAllAttributes(map);
|
|
|
45 |
return "retailer-details";
|
|
|
46 |
}
|
|
|
47 |
|
| 22981 |
ashik.ali |
48 |
|
|
|
49 |
@RequestMapping(value = "/retailerInfo", method = RequestMethod.GET)
|
|
|
50 |
public String retailerInfo(HttpServletRequest request) throws Exception{
|
|
|
51 |
return "retailer-info";
|
|
|
52 |
}
|
|
|
53 |
}
|