@AccountAccess @RequestMapping(value = "/upload/icon", method = RequestMethod.POST) @ResponseBody public DataWrapper<String> uploadIcon( DataWrapper<MultipartFile> wrapper, HttpServletRequest request) { DataWrapper<String> ret = new DataWrapper<String>(); String rootPath = request.getSession().getServletContext().getRealPath("/"); DataWrapper<String> fsRet = fs.saveIcon( wrapper.getData(), wrapper.getAccountId(), wrapper.getAccountCharacter(), rootPath); if (fsRet.getCallStatus().equals(CallStatusEnum.FAILED)) { ret.setErrorCode(fsRet.getErrorCode()); return ret; } DataWrapper<Account> asRet = as.getAccountById(wrapper.getAccountId(), wrapper.getAccountCharacter()); if (asRet.getCallStatus().equals(CallStatusEnum.FAILED)) { ret.setErrorCode(asRet.getErrorCode()); return ret; } Account a = asRet.getData(); a.setIconPath(fsRet.getData()); asRet = as.updateAccount(a, wrapper.getAccountCharacter()); if (asRet.getCallStatus().equals(CallStatusEnum.FAILED)) { ret.setErrorCode(asRet.getErrorCode()); return ret; } ret.setData(fsRet.getData()); return ret; }
/** * 添加评审信息(支持海选、初审、终审、正式入选)。role = [MANAGER] * * @param review the review * @return the data wrapper */ @RequestMapping(value = "/review", method = RequestMethod.POST) @RequiredRole(Role.MANAGER) DataWrapper add(@RequestBody Review review) { if (review.getPhase() == null) { return new DataWrapper(ErrorCodeEnum.BIZ_DATA_INSUFFICIENT, "Review phase is missing."); } DataWrapper check = isProjectValid(review.getProjectId(), review.getPhase()); if (check != null) { return check; } Account manager = currentAccount(); review.setCreaterId(manager.getId()); if (review.getPhase() == Phase.AUDITION) { review.setManagerName(manager.getName()); return reviewService.addLike(review); } if (review.getPhase() == Phase.FIRST_REVIEW) { return reviewService.addFirstReview(review); } if (review.getPhase() == Phase.FINAL_REVIEW) { return reviewService.addFinalReview(review); } if (review.getPhase() == Phase.ACCEPTED) { return reviewService.addEvaluation(review); } return new DataWrapper(ErrorCodeEnum.BIZ_PHASE_ERROR, "Unsupported phase for review."); }