@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 = "/showLast", method = {RequestMethod.GET, RequestMethod.POST}) public String showLast(Page page, String keywords, Map<String, Object> map) { List<BizTransRecordVO> records = transRecordService.findTransRecordToReview(page); List<Map<String, String>> recordList = new ArrayList<Map<String, String>>(); if (!CollectionUtils.isEmpty(records)) { Map<Long, BizMember> cacheMap = new HashMap<Long, BizMember>(); for (BizTransRecordVO vo : records) { Map<String, String> tempMap = new HashMap<String, String>(); String name = "该用户已经被删除!"; String memberNo = "无"; String isVal = ""; if (!StringUtils.isBlank(vo.getMemberId())) { Long memberId = Long.parseLong(vo.getMemberId()); BizMember member = cacheMap.get(memberId) == null ? memberService.get(memberId) : cacheMap.get(memberId); name = member.getName(); memberNo = member.getMemberNo(); BizInvestion investion = investionService.findByMemberIdAndInvestDirection( Long.parseLong(vo.getMemberId()), vo.getInvestType()); if (null == investion) { isVal = "无"; } else { isVal = StringUtils.equals(investion.getIsValidated(), "1") ? "赛" : "无"; } } tempMap.put("id", vo.getId() + ""); tempMap.put( "investTypeStr", InvestDirectionEnum.getInvestDirectionEnum(vo.getInvestType()).getName()); tempMap.put("name", name); tempMap.put("memberNo", memberNo); tempMap.put("isVal", isVal); tempMap.put("origionValue", getRealString(vo.getOrigionValue()) + ""); tempMap.put("currValue", getRealString(vo.getCurrValue()) + ""); tempMap.put("lastDayValue", getRealString(vo.getLastDayValue()) + ""); tempMap.put("fee", getRealString(vo.getFee()) + ""); tempMap.put("gainsAndLosses", getRealString(vo.getGainsAndLosses()) + ""); tempMap.put("currIncome", getRealString(vo.getCurrIncome()) + ""); tempMap.put("currOutcome", getRealString(vo.getCurrOutcome()) + ""); recordList.add(tempMap); } } map.put("page", page); map.put("records", recordList); map.put("keywords", keywords); return SHOW_LAST; }
@RequestMapping( value = "/list", method = {RequestMethod.GET, RequestMethod.POST}) public @ResponseBody String listTop(Page page, Map<String, Object> map) { BizMember member = HttpReceiver.getCurrentMember(); if (null == member) { return PageUtils.toJsonString(page, null); } List<BizMemberCollect> collectList = memberCollectService.findByMemberId(page, member.getId()); List<Map<String, String>> mapList = new ArrayList<Map<String, String>>(); for (BizMemberCollect collect : collectList) { Map<String, String> tempMap = new HashMap<String, String>(); BizMember mem = memberService.get(collect.getCollectedMemberId()); tempMap.put("id", collect.getId() + ""); tempMap.put("name", mem.getName()); tempMap.put("memberNo", mem.getMemberNo()); mapList.add(tempMap); } return PageUtils.toJsonString(page, mapList); }