這篇文章主要為大家展示了“spring mybatis匯總統(tǒng)計處理的示例分析”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“spring mybatis匯總統(tǒng)計處理的示例分析”這篇文章吧。
十載的金口河網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。成都全網(wǎng)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整金口河建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。成都創(chuàng)新互聯(lián)從事“金口河網(wǎng)站設(shè)計”,“金口河網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。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.查詢需要統(tǒng)計的問股數(shù)據(jù) 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.判斷是否需要查詢投顧信息,用戶未根據(jù)投顧姓名搜索則需要重新查詢投顧信息 if (CollectionUtils.isEmpty(adviserIdList)) { adviserIdList = new ArrayList();// 最后循環(huán)組數(shù)據(jù)要用 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.統(tǒng)計數(shù)據(jù) Map askCountMap = new HashMap();// 提問數(shù)map Map answerCountMap = new HashMap();// 解答數(shù)map Map reportCountMap = new HashMap();// 舉報數(shù)map Map qualifiedCountMap = new HashMap();// 合格數(shù)map Map complianceCountMap = new HashMap();// 合規(guī)數(shù)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.組返回頁面數(shù)據(jù) 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("統(tǒng)計解答問股的投股信息", e); } return pageResult; }
以上是“spring mybatis匯總統(tǒng)計處理的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!