@RequestMapping(value = "/reviewTransRecord", method = RequestMethod.POST) public @ResponseBody String reviewTransRecord( TransRecordReviewForm form, HttpServletRequest request) { BizTransRecord transRecord = transRecordService.get(form.getTransRecordId()); // 后续应加上判断此刻该记录的状态,应先锁,后判断状态,再更新 if (isPass(form)) { transRecord.setStatus(TransStatusEnum.S.getValue()); transRecord.setGmtValidate(DateUtil.getNowDate()); } else { transRecord.setStatus(TransStatusEnum.F.getValue()); } transRecordService.saveWithStatisAndReview(transRecord, form); return new AjaxObject("审核成功").toString(); }
@Log(message = "添加了transRecord,id:{0}。") @RequestMapping(value = "/create", method = RequestMethod.POST) public String create( @RequestParam MultipartFile[] myfiles1, @RequestParam MultipartFile[] myfiles2, HttpServletRequest request) { // 如果只是上传一个文件,则只需要MultipartFile类型接收文件即可,而且无需显式指定@RequestParam注解 // 如果想上传多个文件,那么这里就要用MultipartFile[]类型来接收文件,并且还要指定@RequestParam注解 // 并且上传多个文件时,前台表单中的所有<input // type="file"/>的name都应该是myfiles1,2,否则参数里的myfiles无法获取到所有上传的文件 BizTransRecord transRecord = buildBizTransRecord(request); // 设置为初始状态 transRecord.setStatus(TransStatusEnum.I.getValue()); HttpSession session = HttpReceiver.getHttpSession(); BizMember member = (BizMember) session.getAttribute("member"); transRecord.setMemberId(member.getId()); Map<String, String> extendMap = new HashMap<String, String>(); extendMap.put("memberNo", member.getMemberNo()); try { transRecordService.save(transRecord, myfiles1, myfiles2, extendMap); } catch (ServiceException e) { return "redirect:/personalPage?suc=false"; } return "redirect:/personalPage?suc=true"; }
@RequestMapping(value = "/updateRecord", method = RequestMethod.POST) public String updateRecord( @RequestParam MultipartFile[] myfiles1, @RequestParam MultipartFile[] myfiles2, HttpServletRequest request) { String flag = "1"; try { BizTransRecord record = getRecord(request); record.setStatus("I"); transRecordService.update(record); } catch (Exception e) { logger.error("更新交易信息异常!", e); flag = "0"; } return "redirect:/myTransRecord?flag=" + flag; }