@RequestMapping(value = "add", method = RequestMethod.POST) public String addBrandSubmit( @ModelAttribute Brand brand, HttpServletRequest request, RedirectAttributes redirectAttributes) { String reP = "redirect:/brand/list?m=75"; if (StringUtils.isEmpty(brand.getBrandName()) && StringUtils.isEmpty(brand.getBrandEname()) || StringUtils.isEmpty(brand.getPinyin()) || (StringUtils.isNotEmpty(brand.getBrandStory()) && brand.getBrandStory().length() > 1000)) { request.setAttribute("warnFlag", true); reP = "/brand/add"; } else { TStaff staff = (TStaff) SecurityUtils.getSubject().getPrincipal(); brand.setCreateByName(staff.getLoginName()); brand.setCreateDate(DateUtils.currentDate()); brand.setStatus(SystemConstants.DB_STATUS_VALID); try { this.brandService.insertBrand(brand); } catch (Exception e) { e.printStackTrace(); } redirectAttributes.addFlashAttribute("addFlag", true); } return reP; }
@RequestMapping("/applyAudit") @ResponseBody public int auditApply( @RequestParam(value = "sbId") int sellerBrandId, @RequestParam(value = "opinion", required = false) String opinion, @RequestParam(value = "flag") int flag, HttpServletRequest request) { int re = 0; TStaff staff = (TStaff) SecurityUtils.getSubject().getPrincipal(); // 通过 if (flag == 1) { re = this.sellerBrandService.passApply(staff.getLoginName(), "审核通过", sellerBrandId); } else if (flag == 2) { // 驳回 re = this.sellerBrandService.rejectApply(staff.getLoginName(), opinion, sellerBrandId); } return re; }