@RequestMapping(value = "/providers", method = RequestMethod.GET) public String findAllProvider(Model uiModel) { Provider provider = providerService.findOne(6l); System.out.println(provider.getBusinessLicenseUrl()); uiModel.addAttribute("provider", provider); return PROVIDERCREATEOK; }
@RequestMapping(value = "/provider/detail", method = RequestMethod.GET) public String findCurrentProvider(Model uiModel) { SiteUser user = userContext.getCurrentUser(); Provider provider = providerService.findOne(user.getId()); if (provider == null) { throw new UserNotFoundException(); } uiModel.addAttribute("user", provider); return "user/provider/detail"; }
@RequestMapping(value = "/provider/detail", method = RequestMethod.PUT) public String updateCurrentProvider( Model uiModel, @ModelAttribute("user") Provider provider, BindingResult bindingResult) { if (bindingResult.hasErrors()) { uiModel.addAttribute("user", provider); return "user/provider/detail"; } SiteUser user = userContext.getCurrentUser(); provider.setId(user.getId()); provider = providerService.updateProvider(provider); uiModel.addAttribute("user", provider); return "user/provider/detail"; }