springmybatis汇总统计处理的示例分析-创新互联
这篇文章主要为大家展示了“spring mybatis汇总统计处理的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“spring mybatis汇总统计处理的示例分析”这篇文章吧。
十载的金口河网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整金口河建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“金口河网站设计”,“金口河网站推广”以来,每个客户项目都认真落实执行。public PageInfo getCenterInvestAnswerSum(GetCenterInvestSumReq askReq) throws BusinessException { PageInfo pageResult = new PageInfo(); final String METHOD = "getCenterAskInvestSum"; try { PageHelper.startPage(askReq.getPageNum(), askReq.getPageSize()); LogUtil.logInput(LOG_TYPE.BIZ.val, this, METHOD, askReq); // 1.如果存在投顾,es查询投顾信息 List adviserIdList = null; Map adviserMap = null; if (StringUtils.hasLength(askReq.getInvestAdviserName())) { AdviserEsReq adviserEsReq = new AdviserEsReq(); adviserEsReq.setInvestAdviserName(askReq.getInvestAdviserName()); adviserEsReq.setPageSize(1000); PageInfo pageInfo = AdviserEsUtils.findByParams(adviserEsReq); if (CollectionUtils.isEmpty(pageInfo.getList())) { return pageResult; } adviserIdList = new ArrayList(); adviserMap = new HashMap(); for (VdInvestAdviser adviser : pageInfo.getList()) { adviserIdList.add(adviser.getId()); adviserMap.put(adviser.getId(), adviser); } } // 2.查询需要统计的问股数据 AskStockStatisticsReq statisticsReq = new AskStockStatisticsReq(); statisticsReq.setBeginDate(DateUtils.toDate(askReq.getStartDate(), DateFormat.YEAR_MONTH_DAY)); statisticsReq.setEndDate( DateUtils.nextDays(DateUtils.toDate(askReq.getEndDate(), DateFormat.YEAR_MONTH_DAY), 1)); statisticsReq.setAdviserIdList(adviserIdList); List askList = this.apAskExtMapper.findByCreateTime(statisticsReq); if (CollectionUtils.isEmpty(askList)) { return pageResult; } // 3.判断是否需要查询投顾信息,用户未根据投顾姓名搜索则需要重新查询投顾信息 if (CollectionUtils.isEmpty(adviserIdList)) { adviserIdList = new ArrayList();// 最后循环组数据要用 Set adviserIdSet = new HashSet();// 去重用 adviserMap = new HashMap(); askList.forEach(ask -> { adviserIdSet.add(ask.getAdviserId()); }); adviserIdList.addAll(adviserIdSet); List adviserList = AdviserEsUtils.findByIds(adviserIdList); for (VdInvestAdviser adviser : adviserList) { adviserMap.put(adviser.getId(), adviser); } } // 4.统计数据 Map askCountMap = new HashMap();// 提问数map Map answerCountMap = new HashMap();// 解答数map Map reportCountMap = new HashMap();// 举报数map Map qualifiedCountMap = new HashMap();// 合格数map Map complianceCountMap = new HashMap();// 合规数map askList.forEach(ask -> { Long key = ask.getAdviserId(); setDataMap(askCountMap, key, 1); if (ask.getAnswerFlag() != null && ask.getAnswerFlag()) { setDataMap(answerCountMap, key, 1); } if (ask.getReportFlag() != null && ask.getReportFlag()) { setDataMap(reportCountMap, key, 1); } if (ask.getQualifiedFlag() != null && ask.getQualifiedFlag()) { setDataMap(qualifiedCountMap, key, 1); } if (ask.getComplianceFlag() != null && ask.getComplianceFlag()) { setDataMap(complianceCountMap, key, 1); } }); // 5.组返回页面数据 List resultList = new ArrayList(); for (Long adviserId : adviserIdList) { VdInvestAdviser adviser = adviserMap.get(adviserId); GetCenterInvestSumRes res = new GetCenterInvestSumRes(); res.setAdviserId(adviserId); res.setInvestAdviserName(adviser.getInvestAdviserName()); res.setInvestAdviserDept(adviser.getInvestAdviserDept()); res.setSatisfied(adviser.getAverageSatisfied()); res.setYybCode(adviser.getYybCode()); res.setAskAdviserCount(answerCountMap.containsKey(adviserId) ? answerCountMap.get(adviserId) : 0); res.setAskCount(askCountMap.containsKey(adviserId) ? askCountMap.get(adviserId) : 0); res.setQualifiedCount(qualifiedCountMap.containsKey(adviserId) ? qualifiedCountMap.get(adviserId) : 0); res.setComplianceCount( complianceCountMap.containsKey(adviserId) ? complianceCountMap.get(adviserId) : 0); res.setReportFlagCount(reportCountMap.containsKey(adviserId) ? reportCountMap.get(adviserId) : 0); resultList.add(res); } pageResult.setList(resultList); } catch (Exception e) { LogUtil.logError(LOG_TYPE.BIZ.val, this, METHOD, e); throw ExceptionUtil.generateException("统计解答问股的投股信息", e); } return pageResult; }
以上是“spring mybatis汇总统计处理的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
本文标题:springmybatis汇总统计处理的示例分析-创新互联
网页URL:http://azwzsj.com/article/dsgcjs.html