From 61e0c6780bc1af1fc177f9b942154cecd5f0301b Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 19 May 2021 18:02:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=97=E5=88=86=E8=AF=B4=E6=98=8E-=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/fact/FactIndexAgencySubScoreDao.java | 4 ++ .../fact/FactIndexCommunitySubScoreDao.java | 12 +++++ .../dao/fact/FactIndexGridSubScoreDao.java | 2 +- .../index/impl/IndexExplainServiceImpl.java | 50 +++++++++++++++---- .../fact/FactIndexAgencySubScoreDao.xml | 15 ++++++ .../fact/FactIndexCommunitySubScoreDao.xml | 15 ++++++ .../mapper/fact/FactIndexGridSubScoreDao.xml | 19 +------ 7 files changed, 87 insertions(+), 30 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java index 0fd8e29c06..5347867afc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java @@ -17,6 +17,8 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; +import com.epmet.evaluationindex.index.result.IndexScoreResult; import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; @@ -48,4 +50,6 @@ public interface FactIndexAgencySubScoreDao { * @author sun */ LinkedList selectMonthAblityList(MonthAblityListFormDTO formDTO); + + List selectSubScore(IndexScoreFormDTO ablityListFormDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java index 1689ab0b3c..5c38d0985e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java @@ -17,6 +17,8 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; +import com.epmet.evaluationindex.index.result.IndexScoreResult; import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; @@ -48,4 +50,14 @@ public interface FactIndexCommunitySubScoreDao { * @author sun */ LinkedList selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO); + + /** + * desc: 查询分数 + * + * @param ablityListFormDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/5/14 2:07 下午 + */ + List selectSubScore(IndexScoreFormDTO ablityListFormDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java index b71adcdd4e..8a64352187 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java @@ -59,5 +59,5 @@ public interface FactIndexGridSubScoreDao { * @author LiuJanJun * @date 2021/5/14 2:07 下午 */ - List selectGridSubScore(IndexScoreFormDTO ablityListFormDTO); + List selectSubScore(IndexScoreFormDTO ablityListFormDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java index 4eeb95a14b..ef85b31714 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java @@ -24,6 +24,8 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.constant.IndexConstant; import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao; import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao; +import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; +import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; import com.epmet.datareport.dao.fact.FactIndexCpcSubScoreDao; import com.epmet.datareport.dao.fact.FactIndexGridSubScoreDao; import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; @@ -34,6 +36,7 @@ import com.epmet.evaluationindex.index.result.IndexExplainResult; import com.epmet.evaluationindex.index.result.IndexGroupDetailResult; import com.epmet.evaluationindex.index.result.IndexScoreDetailResult; import com.epmet.evaluationindex.index.result.IndexScoreResult; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +54,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2021-05-12 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexExplainServiceImpl implements IndexExplainService { @@ -63,6 +67,10 @@ public class IndexExplainServiceImpl implements IndexExplainService { private FactIndexGridSubScoreDao gridSubScoreDao; @Autowired private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao; + @Autowired + private FactIndexCommunitySubScoreDao communitySubScoreDao; + @Autowired + private FactIndexAgencySubScoreDao agencySubScoreDao; @Override @@ -104,6 +112,11 @@ public class IndexExplainServiceImpl implements IndexExplainService { String type = explainDTO.getType(); String orgLevel = formDTO.getOrgLevel(); + String allIndexCodePath = explainDTO.getIndexCode(); + + //设置表头 + List tableHeaders = getTableHeaders(type, allIndexCodePath, orgLevel); + result.setTableTileList(tableHeaders); IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO(); ablityListFormDTO.setCustomerId(formDTO.getCustomerId()); @@ -111,32 +124,40 @@ public class IndexExplainServiceImpl implements IndexExplainService { ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); switch (orgLevel) { case "grid": - String allIndexCodePath = null; - if (IndexConstant.ZI_SHEN.equals(type)) { - allIndexCodePath = explainDTO.getIndexCode(); + if (IndexConstant.ZI_SHEN.equals(type)) { setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); - //不下钻 ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); - realScoreList = gridSubScoreDao.selectGridSubScore(ablityListFormDTO); + realScoreList = gridSubScoreDao.selectSubScore(ablityListFormDTO); } else if (IndexConstant.XIA_JI.equals(type)) { - allIndexCodePath = explainDTO.getIndexCode(); - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); - //下钻到党员 ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO); } - List tableHeaders = getTableHeaders(type, allIndexCodePath, orgLevel); - result.setTableTileList(tableHeaders); + break; case "community": - + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + //不下钻 + ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); + realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO); + break; + case "street": + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + //不下钻 + ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); + realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); + break; + case "district": + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + //不下钻 + ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); + realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); break; default: @@ -174,6 +195,10 @@ public class IndexExplainServiceImpl implements IndexExplainService { private List setDefaultTableData(String orgLevel, String type, Map> detailEntityMap, IndexExplainResult result, String allIndexCodePath) { List indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); + if (CollectionUtils.isEmpty(indexGroupDetailEntities)){ + log.warn("setDefaultTableData allINdexCodePath:{} is config error",allIndexCodePath); + return null; + } List tableList = new ArrayList<>(); List threlodList = new ArrayList<>(); indexGroupDetailEntities.forEach(index -> { @@ -181,6 +206,9 @@ public class IndexExplainServiceImpl implements IndexExplainService { if ("grid".equals(orgLevel) && IndexConstant.ZI_SHEN.equals(type) && index.getAllIndexCodePath().contains(IndexConstant.XIA_JI)) { return; } + if (!"grid".equals(orgLevel) && !index.getAllIndexCodePath().contains(type)){ + return; + } table.setIndexCode(index.getIndexCode()); table.setIndexName(index.getIndexName()); table.setOriginValue(NumConstant.ZERO_STR); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml index e1cbb6850b..3a5f74717c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -40,5 +40,20 @@ ORDER BY fact.month_id ASC + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml index b0fd69d5cf..35dec5b46b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -40,5 +40,20 @@ ORDER BY fact.month_id ASC + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml index eb2312455a..aa8f2550a8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -40,21 +40,7 @@ ORDER BY fact.month_id ASC - SELECT fact.index_code, IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value, @@ -68,9 +54,6 @@ AND customer_id = #{customerId} AND grid_id = #{orgId} AND month_id = #{monthId} - - -