@RequestMapping( value = "/showDetailPer/{date}", method = {RequestMethod.GET, RequestMethod.POST}) public String showDailyPer(Page page, @PathVariable String date, Map<String, Object> map) { List<BizFinanceTransDetail> list = financeTransDetailService.findByGmtCreate(page, date); List<Map<String, String>> tempList = new ArrayList<Map<String, String>>(); Map<Long, BizMember> cacheMap = new HashMap<Long, BizMember>(); if (!CollectionUtils.isEmpty(list)) { for (BizFinanceTransDetail detail : list) { Map<String, String> tempMap = new HashMap<String, String>(); tempMap.put("id", detail.getId() + ""); tempMap.put("date", DateUtil.date2String(detail.getGmtCreate(), BizConstant.DATE_FORMAT)); tempMap.put("time", DateUtil.date2String(detail.getGmtCreate(), BizConstant.TIME_FORMAT)); TransUserEnum enums = TransUserEnum.getEnum(detail.getTransUse()); if (enums == (TransUserEnum.MEMBER_ATTENT) || enums == TransUserEnum.MEMBER_ATTENT_PROLONG) { String name = "大师"; BizMember tempMem = cacheMap.get(detail.getTransUseId()) == null ? memberService.get(detail.getTransUseId()) : cacheMap.get(detail.getTransUseId()); if (null != tempMem) { name = "大师(" + tempMem.getName() + ")"; } tempMap.put( "summary", StringUtils.replace( TransUserEnum.getEnum(detail.getTransUse()).getName(), "大师", name)); } else { tempMap.put("summary", TransUserEnum.getEnum(detail.getTransUse()).getName()); } long out = 0; long in = 0; tempMap.put("left", detail.getSysLeft() + ""); tempMap.put("type", TransTypeEnum.getEnum(detail.getTransType()).getName()); switch (TransTypeEnum.getEnum(detail.getTransType())) { case IN: in = detail.getValue(); break; case OUT: out = detail.getValue(); break; default: break; } tempMap.put("out", out + ""); tempMap.put("in", in + ""); tempList.add(tempMap); } map.put("page", page); map.put("data", tempList); } return SHOW_DETAIL_PER; }
@RequestMapping( value = "/findLastTransRecord2", method = {RequestMethod.GET, RequestMethod.POST}) public @ResponseBody String findLastTransRecord2( @RequestParam String type, @RequestParam String dateStr, @RequestParam Long id) { BizTransRecord record = transRecordService.get(id); Map<String, Object> paramMap = new HashMap<String, Object>(); // 得到上日权益 try { // 上日交易 BizTransRecordVO vo = transRecordService.findPreviousTransRecord( record.getMemberId(), type, DateUtil.string2Date(dateStr, DateUtil.PATTERN_DATE)); if (vo == null) { // 表示上日权益没有 paramMap.put("isHave", "false"); } else { paramMap.put("isHave", "true"); paramMap.put("lastDayValue", vo.getCurrValue() / 100.0); } BizTransRecordVO totalInfo = transRecordService.queryTotalInfoBeforeOneDate(record.getMemberId(), type, dateStr); paramMap.put( "totalInCome", totalInfo.getTotalIncome() == null ? 0 : totalInfo.getTotalIncome() / 100.0); paramMap.put( "totalOutCome", totalInfo.getTotalOutcome() == null ? 0 : totalInfo.getTotalOutcome() / 100.0); } catch (Exception e) { e.printStackTrace(); } return AjaxReturnInfo.returnSuc(paramMap); }
@RequestMapping( value = "/findTransRecordTotal", method = {RequestMethod.GET, RequestMethod.POST}) public @ResponseBody String findTransRecordTotal(HttpServletRequest request) { String memberNo = request.getParameter("memberNo"); String investType = request.getParameter("investType"); String startDate = request.getParameter("startDate"); String endDate = request.getParameter("endDate"); Map<String, Object> paramMap = new HashMap<String, Object>(); StringBuilder dates = new StringBuilder(); StringBuilder values = new StringBuilder(); try { // 获取大师信息 BizMember member = memberService.getBizMemberByMemberNo(memberNo); if (null == member) { return AjaxReturnInfo.returnErr("该大师不存在"); } List<BizTransRecordVO> list = transRecordService.findTransRecrorByMemberAndTypeAndDateAndStatus( member.getId(), investType, startDate, endDate, "S"); for (BizTransRecordVO vo : list) { if (StringUtil.isEmpty(vo.getTotalGainsAndLosses())) { values.append(0).append(","); } else { values .append( StringUtil.substring( vo.getTotalGainsAndLosses(), vo.getTotalGainsAndLosses().length() - 1)) .append(","); } dates .append( DateUtil.date2String( DateUtil.string2Date(vo.getImportDate(), DateUtil.PATTERN_DATE), "MMdd")) .append(","); } paramMap.put("dates", StringUtil.deleteLastOfChar(dates, ",")); paramMap.put("values", StringUtil.deleteLastOfChar(values, ",")); } catch (Exception e) { // 错误日志打印 // 跳转到错误页面 e.printStackTrace(); } return AjaxReturnInfo.returnSuc(paramMap); }
@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(); }
@RequestMapping( value = "/list", method = {RequestMethod.GET, RequestMethod.POST}) public String list(Page page, Map<String, Object> map, BizMember member) { BizMember admin = memberService.getAdminAccount(); if (null == admin) { return LIST; } String type = HttpReceiver.getHttpServletReqeuest().getParameter("keywords"); List<BizSiteMessage> list = null; if (StringUtils.isBlank(type)) { list = siteMessageService.findAll(page); } else { list = siteMessageService.findByMessageType(page, type); } List<Map<String, String>> mapList = new ArrayList<Map<String, String>>(); if (CollectionUtils.isNotEmpty(list)) { for (BizSiteMessage message : list) { Map<String, String> tempMap = new HashMap<String, String>(); tempMap.put("type", SiteMessageTypeEnum.getEnum(message.getMessageType()).getName()); BizMember tempMem = memberService.get(message.getMemberId()); tempMap.put("id", message.getId() + ""); tempMap.put("name", (null == tempMem) ? "该用户已经被删除!" : tempMem.getName()); tempMap.put("content", message.getMessageContent()); tempMap.put("status", MsgStatusEnum.getMsgUseEnum(message.getStatus()).getName()); tempMap.put( "time", DateUtil.date2String(message.getGmtCreate(), BizConstant.DATE_TIME_FORMAT)); mapList.add(tempMap); } } List<Map<String, String>> tempList = new ArrayList<Map<String, String>>(); for (SiteMessageTypeEnum enu : SiteMessageTypeEnum.values()) { Map<String, String> temp = new HashMap<String, String>(); temp.put("name", enu.getName()); temp.put("value", enu.getValue()); tempList.add(temp); } map.put("types", tempList); map.put("page", page); map.put("data", mapList); return LIST; }
/** * 上日权益级累计信息查询 * * @param type * @param dateStr * @return */ @RequestMapping( value = "/findLastTransRecord", method = {RequestMethod.GET, RequestMethod.POST}) public @ResponseBody String findLastTransRecord( @RequestParam String type, @RequestParam String dateStr) { BizMember member = (BizMember) HttpReceiver.getHttpSession().getAttribute("member"); if (null == member) { return AjaxReturnInfo.returnErr("请您先首页登录!"); } long memberId = member.getId(); Map<String, Object> paramMap = new HashMap<String, Object>(); // 得到上日权益 try { // 当日交易 BizTransRecordVO currRecord = transRecordService.findCurrTransRecord(memberId, type, dateStr); if (currRecord != null) { return AjaxReturnInfo.returnErr("当天记录不得重复录入"); } // 上日交易 BizTransRecordVO vo = transRecordService.findPreviousTransRecord( memberId, type, DateUtil.string2Date(dateStr, DateUtil.PATTERN_DATE)); if (vo == null) { // 表示上日权益没有 paramMap.put("isHave", "false"); } else { paramMap.put("isHave", "true"); paramMap.put("lastDayValue", vo.getCurrValue() / 100.0); } BizTransRecordVO totalInfo = transRecordService.queryTotalInfoBeforeOneDate(memberId, type, dateStr); paramMap.put( "totalInCome", totalInfo.getTotalIncome() == null ? 0 : totalInfo.getTotalIncome() / 100.0); paramMap.put( "totalOutCome", totalInfo.getTotalOutcome() == null ? 0 : totalInfo.getTotalOutcome() / 100.0); } catch (Exception e) { e.printStackTrace(); } return AjaxReturnInfo.returnSuc(paramMap); }
@RequestMapping(value = "/create", method = RequestMethod.POST) public @ResponseBody String create(HttpServletRequest request) { try { BizMember member = HttpReceiver.getCurrentMember(); if (null == member) { return AjaxReturnInfo.returnSuc("请您先首页登录!"); } String memberNo = request.getParameter("memberNo"); BizMember tempMem = memberService.getBizMemberByMemberNo(memberNo); BizMemberCollect collect = new BizMemberCollect(); collect.setMemberId(member.getId()); collect.setCollectedMemberId(tempMem.getId()); Date date = DateUtil.getNowDate(); collect.setGmtCreate(date); collect.setGmtModified(date); memberCollectService.save(collect); return AjaxReturnInfo.returnSuc("添加大师收藏成功!"); } catch (Exception e) { return AjaxReturnInfo.returnErr("添加大师收藏异常!"); } }
/** * 组装交易对象 * * @param request * @return */ private BizTransRecord getRecord(HttpServletRequest request) { String id = request.getParameter("id"); if (StringUtils.isBlank(id)) { return null; } BizTransRecord record = transRecordService.get(Long.parseLong(id)); String fee = request.getParameter("fee"); String gainsAndLosses = request.getParameter("gainsAndLosses"); String currValue = request.getParameter("currValue"); String totleGainsAndLosses = request.getParameter("totleGainsAndLosses"); String currIncome = request.getParameter("currIncome"); String currOutcome = request.getParameter("currOutcome"); record.setFee(getRealLong(fee)); record.setCurrIncome(getRealLong(currIncome)); record.setCurrOutcome(getRealLong(currOutcome)); record.setTotalGainsAndLosses(totleGainsAndLosses); record.setGainsAndLosses(getRealLong(gainsAndLosses)); record.setCurrValue(getRealLong(currValue)); record.setGmtModified(DateUtil.getNowDate()); return record; }
@RequestMapping( value = "/show/{id}", method = {RequestMethod.POST, RequestMethod.GET}) public String approval(@PathVariable Long id, Map<String, Object> map) { BizSiteMessage siteMessage = siteMessageService.get(id); if (null == siteMessage) { return SHOW; } Map<String, String> dataMap = new HashMap<String, String>(); dataMap.put("content", siteMessage.getMessageContent()); dataMap.put("status", MsgStatusEnum.getMsgUseEnum(siteMessage.getStatus()).getName()); dataMap.put("id", siteMessage.getId() + ""); dataMap.put("type", SiteMessageTypeEnum.getEnum(siteMessage.getMessageType()).getName()); dataMap.put( "createTime", DateUtil.date2String(siteMessage.getGmtCreate(), BizConstant.DATE_TIME_FORMAT)); BizMember mem = memberService.get(siteMessage.getMemberId()); if (null != mem) { dataMap.put("name", (null == mem) ? "该用户已经被删除!" : mem.getName()); } map.put("data", dataMap); return SHOW; }