Rev 23026 | Rev 23330 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.controller;import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.transaction.annotation.Transactional;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;import com.spice.profitmandi.common.model.ProfitMandiConstants;import com.spice.profitmandi.common.model.UpdateRetailerRequest;import com.spice.profitmandi.service.user.RetailerService;@Controller@Transactional(rollbackFor=Throwable.class)public class RetailerController {private static final Logger LOGGER = LoggerFactory.getLogger(RetailerController.class);@Autowiredprivate RetailerService retailerService;@RequestMapping(value = "/retailerDetail", method = RequestMethod.GET)public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber, Model model) throws ProfitMandiBusinessException{LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(), emailIdOrMobileNumber);Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);model.addAllAttributes(map);return "retailer-details";}@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)public String updateRetailerDetails(HttpServletRequest request, @RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException{LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);model.addAllAttributes(map);return "retailer-details";}@RequestMapping(value = "/retailerInfo", method = RequestMethod.GET)public String retailerInfo(HttpServletRequest request) throws Exception{return "retailer-info";}}