Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of spring mybatis Summary Statistical processing

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you the "sample analysis of spring mybatis summary statistical processing", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and study the "sample analysis of spring mybatis summary statistical processing".

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. If there is a patronage, es queries the patronage information 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. Query AskStockStatisticsReq statisticsReq = new AskStockStatisticsReq (); statisticsReq.setBeginDate (DateUtils.toDate (askReq.getStartDate (), DateFormat.YEAR_MONTH_DAY)); statisticsReq.setEndDate (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. Determine whether you need to query the patronage information. If you do not search according to the patronage name, you need to re-query the patronage information if (CollectionUtils.isEmpty (adviserIdList)) {adviserIdList = new ArrayList (); / / use Set adviserIdSet = new HashSet () for the last cycle group data; / / to reuse 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. Statistics Map askCountMap = new HashMap (); / / number of questions map Map answerCountMap = new HashMap (); / / number of answers map Map reportCountMap = new HashMap (); / / number of reports map Map qualifiedCountMap = new HashMap (); / / qualified number map Map complianceCountMap = new HashMap (); / / Compliance 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. Group returns page data 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 ("Statistical answers to Stock Investment Information", e);} return pageResult;} above are all the contents of the article "sample Analysis of spring mybatis Summary Statistical processing". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report