From 61e0c6780bc1af1fc177f9b942154cecd5f0301b Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 19 May 2021 18:02:31 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BE=97=E5=88=86=E8=AF=B4=E6=98=8E-?= =?UTF-8?q?=E4=BB=A3=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} - - - From c2ca0073a7bfb21b24faade6cccfadb6115792d3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 20 May 2021 10:29:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8C=87=E6=A0=87=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E9=A1=B9-=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/result/AblityListResultDTO.java | 7 +++++++ .../controller/index/IndexExplainController.java | 15 +++++++++++++++ .../index/IndexExplainService.java | 12 ++++++++++++ .../index/impl/IndexExplainServiceImpl.java | 14 +++++++++----- .../mapper/fact/FactIndexAgencySubScoreDao.xml | 3 ++- .../mapper/fact/FactIndexCommunitySubScoreDao.xml | 3 ++- .../mapper/fact/FactIndexGridSubScoreDao.xml | 3 ++- .../main/resources/mapper/index/IndexDictDao.xml | 3 ++- 8 files changed, 51 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java index 2c8c7b6d00..d25c99c678 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java @@ -36,6 +36,13 @@ public class AblityListResultDTO implements Serializable { */ private BigDecimal weight; + /** + * 原始分数 + */ private Double score; + /** + * 加权分数(乘以权重后得分) + */ + private BigDecimal weightedScore; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java index 14ab225481..abac68a416 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java @@ -20,7 +20,9 @@ package com.epmet.datareport.controller.index; import com.epmet.commons.tools.utils.Result; import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; +import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; import com.epmet.evaluationindex.index.result.IndexExplainResult; +import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -58,5 +60,18 @@ public class IndexExplainController { return ok; } + /** + * desc: 指标字典项 + * + * @param formDTO + * @author LiuJanJun + * @date 2021/5/12 4:12 下午 + */ + @PostMapping("indexdict") + public Result getIndexMeaning(@RequestBody IndexScoreFormDTO formDTO){ + IndexDictResultDTO result = indexExplainService.getIndexMeaning(formDTO); + return new Result().ok(result); + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java index 54c12aed09..c028422cd4 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java @@ -18,7 +18,9 @@ package com.epmet.datareport.service.evaluationindex.index; import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; +import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; import com.epmet.evaluationindex.index.result.IndexExplainResult; +import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; import java.util.List; @@ -39,4 +41,14 @@ public interface IndexExplainService { * @date 2021/5/12 4:38 下午 */ List getScoreDetail(IndexExplainFormDTO formDTO); + + /** + * desc: 条件获取指标 + * + * @param formDTO + * @return com.epmet.evaluationindex.index.result.IndexDictResultDTO + * @author LiuJanJun + * @date 2021/5/20 10:20 上午 + */ + IndexDictResultDTO getIndexMeaning(IndexScoreFormDTO formDTO); } 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 ef85b31714..3e035f30ae 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,10 +24,7 @@ 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.dao.fact.*; import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; import com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO; import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; @@ -36,6 +33,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 com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -58,7 +56,8 @@ import java.util.stream.Collectors; @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexExplainServiceImpl implements IndexExplainService { - + @Autowired + private IndexDictDao indexDictDao; @Autowired private IndexExplainDao indexExplainDao; @Autowired @@ -106,6 +105,11 @@ public class IndexExplainServiceImpl implements IndexExplainService { return results; } + @Override + public IndexDictResultDTO getIndexMeaning(IndexScoreFormDTO formDTO) { + return indexDictDao.selectIndexDict(formDTO.getIndexCode()); + } + private void setTableData(IndexExplainFormDTO formDTO, Map> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) { if (NumConstant.ONE == explainDTO.getIsSearch()) { List realScoreList = null; 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 3a5f74717c..954ce4c772 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 @@ -9,7 +9,8 @@ IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", fact.score AS score, dict.index_name AS "name", - round(fact.WEIGHT,2) AS weight + round(fact.WEIGHT,2) AS weight, + (fact.SCORE * fact.WEIGHT) AS weightedScore FROM fact_index_agency_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code 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 35dec5b46b..52f1e767f0 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 @@ -9,7 +9,8 @@ IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", dict.index_name AS "name", fact.score AS score, - round(fact.WEIGHT,2) AS weight + round(fact.WEIGHT,2) AS weight, + (fact.SCORE * fact.WEIGHT) AS weightedScore FROM fact_index_community_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code 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 aa8f2550a8..e7b23aebcc 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 @@ -9,7 +9,8 @@ IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", dict.index_name AS "name", fact.score AS score, - round(fact.WEIGHT,2) AS weight + round(fact.WEIGHT,2) AS weight, + (fact.SCORE * fact.WEIGHT) AS weightedScore FROM fact_index_grid_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml index fffd0604bf..28f6d1955b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml @@ -18,7 +18,8 @@ SELECT index_name AS "indexName", index_code AS "indexCode", - value_type AS "valueType" + value_type AS "valueType", + INDEX_DESC FROM index_dict WHERE From c065da7cfbcde0178d97fbce3823633dc1562a94 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 20 May 2021 11:20:27 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/data-aggregator/data-aggregator-server/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 604d182cb8..a2cc3bc297 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -337,8 +337,8 @@ - epmet_data_statistical_user - EpmEt-db-UsEr + epmet + elink@833066 0 @@ -452,4 +452,4 @@ - \ No newline at end of file + From 76e989c0bfc853f4138bc3812a6aac16026295b8 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 20 May 2021 15:14:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=85=A8=E5=8C=BA=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=8C=87=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index/form/IndexScoreFormDTO.java | 5 +- .../datareport/constant/IndexConstant.java | 2 + .../dao/fact/FactIndexDeptSubScoreDao.java | 36 +++++++++ .../index/impl/IndexExplainServiceImpl.java | 80 ++++++++++++++----- .../fact/FactIndexAgencySubScoreDao.xml | 9 ++- .../mapper/fact/FactIndexDeptSubScoreDao.xml | 24 ++++++ 6 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexDeptSubScoreDao.java create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexDeptSubScoreDao.xml diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java index 0ee464a9b5..f2f7f98a01 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java @@ -36,5 +36,8 @@ public class IndexScoreFormDTO implements Serializable { * 所有有权重的指标code拼接的字符串 冒号隔开 */ private String allParentIndexCode; - + /** + * pid + */ + private String pid; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java index 7bae5401c4..af1ae3588d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java @@ -31,6 +31,8 @@ public class IndexConstant { public static final String TABLE_DESC = "详见下表:"; public static final String INDEX_SCORE_TITLE = "当月指数"; public static final String INDEX_SCORE_DESC = "含义:自然月周期内,当月指数得分=党建指数得分*相关权重+治理指数得分*相关权重+服务指数得分*相关权重"; + public static final String INDEX_DISTRINCT_TABLE1_INDEX_CODE = "suoyoujiedaozlnlpjz"; + public static final String ZHI_LI_NENG_LI = "zhilinengli"; /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexDeptSubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexDeptSubScoreDao.java new file mode 100644 index 0000000000..7d84dd87e7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexDeptSubScoreDao.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; +import com.epmet.evaluationindex.index.result.IndexScoreResult; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 部门相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexDeptSubScoreDao { + + List selecDeptAvgScore(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 3e035f30ae..6ca654a4ec 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 @@ -70,6 +70,8 @@ public class IndexExplainServiceImpl implements IndexExplainService { private FactIndexCommunitySubScoreDao communitySubScoreDao; @Autowired private FactIndexAgencySubScoreDao agencySubScoreDao; + @Autowired + private FactIndexDeptSubScoreDao deptSubScoreDao; @Override @@ -125,43 +127,63 @@ public class IndexExplainServiceImpl implements IndexExplainService { IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO(); ablityListFormDTO.setCustomerId(formDTO.getCustomerId()); ablityListFormDTO.setOrgId(formDTO.getOrgId()); + ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); switch (orgLevel) { case "grid": if (IndexConstant.ZI_SHEN.equals(type)) { - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 - ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); realScoreList = gridSubScoreDao.selectSubScore(ablityListFormDTO); } else if (IndexConstant.XIA_JI.equals(type)) { - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //下钻到党员 - ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO); } break; case "community": - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 - ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO); break; case "street": - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 - ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); break; case "district": - setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); - //不下钻 - ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); - realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); + System.out.println("========" + allIndexCodePath); + if (allIndexCodePath.contains(IndexConstant.ZHI_LI_NENG_LI)) { + List detailResults = detailEntityMap.get(allIndexCodePath); + + List indexGroupDetailEntities = new ArrayList<>(); + for (IndexGroupDetailResult index : detailResults) { + + if (IndexConstant.INDEX_DISTRINCT_TABLE1_INDEX_CODE.equals(index.getIndexCode())) { + indexGroupDetailEntities.add(index); + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, indexGroupDetailEntities); + //不下钻 + realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); + break; + } else { + //下钻 + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); + ablityListFormDTO.setPid(formDTO.getOrgId()); + realScoreList = deptSubScoreDao.selecDeptAvgScore(ablityListFormDTO); + } + } + } else { + setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); + //不下钻 + realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); + } + + break; default: @@ -191,16 +213,22 @@ public class IndexExplainServiceImpl implements IndexExplainService { } tb.setOriginValue(score.getOriginValue()); tb.setScore(String.valueOf(score.getScore())); - tb.setQuantity(score.getQuantity()); + if (StringUtils.isNotBlank(score.getQuantity())) { + tb.setQuantity(score.getQuantity()); + } tb.setWeight(score.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%"); } } } - 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); + private List setDefaultTableData(String orgLevel, String type, Map> detailEntityMap, + IndexExplainResult result, String allIndexCodePath, List indexGroupDetailEntities) { + + if (indexGroupDetailEntities == null) { + indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); + } + if (CollectionUtils.isEmpty(indexGroupDetailEntities)) { + log.warn("setDefaultTableData allINdexCodePath:{} is config error", allIndexCodePath); return null; } List tableList = new ArrayList<>(); @@ -210,7 +238,7 @@ 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)){ + if ((!"grid".equals(orgLevel) && !"district".equals(orgLevel)) && !index.getAllIndexCodePath().contains(type)) { return; } table.setIndexCode(index.getIndexCode()); @@ -218,6 +246,7 @@ public class IndexExplainServiceImpl implements IndexExplainService { table.setOriginValue(NumConstant.ZERO_STR); table.setScore(NumConstant.ZERO_STR); table.setWeight(index.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%"); + table.setQuantity(NumConstant.ZERO_STR); tableList.add(table); if (new BigDecimal(-1).compareTo(index.getThreshold()) != 0) { threlodList.add(index.getIndexName().concat(String.format(IndexConstant.THRESHOLD_TEXT, index.getThreshold().intValue()))); @@ -257,7 +286,7 @@ public class IndexExplainServiceImpl implements IndexExplainService { headers = IndexConstant.getStandardSelfHeaders(allIndexCode); } else if ("xiaji".equals(type)) { - headers = IndexConstant.getStandardSubHeaders(allIndexCode); + headers = new ArrayList<>(IndexConstant.QuantityLastHeader); if (allIndexCode.contains("canyuyishi")) { headers.add(0, "组织内党员的参与议事指数考评分(平均值)"); } else if (allIndexCode.contains("lianxiqunzhong")) { @@ -265,6 +294,19 @@ public class IndexExplainServiceImpl implements IndexExplainService { } break; } + case "district": + if ("zishen".equals(type)) { + headers = IndexConstant.getStandardSelfHeaders(allIndexCode); + + } else if ("xiaji".equals(type)) { + headers = new ArrayList<>(IndexConstant.QuantityLastHeader); + if (allIndexCode.contains("quzhibumen")) { + headers.add(0, "区直部门各项治理指数指标"); + } else { + headers.add(0, "所有街道治理指数指标"); + } + } + break; default: if ("zishen".equals(type)) { headers = IndexConstant.getStandardSelfHeaders(allIndexCode); 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 954ce4c772..481d5be0f1 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 @@ -53,7 +53,14 @@ fact.del_flag = '0' AND fact.all_parent_index_code = #{allParentIndexCode} AND customer_id = #{customerId} - AND agency_id = #{orgId} + + + AND PARENT_AGENCY_ID = #{pid} + + + AND agency_id = #{orgId} + + AND month_id = #{monthId} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexDeptSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexDeptSubScoreDao.xml new file mode 100644 index 0000000000..af7d01495b --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexDeptSubScoreDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + +