+ * 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/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/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 4eeb95a14b..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
@@ -24,8 +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.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;
@@ -34,6 +33,8 @@ 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;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,10 +52,12 @@ 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 {
-
+ @Autowired
+ private IndexDictDao indexDictDao;
@Autowired
private IndexExplainDao indexExplainDao;
@Autowired
@@ -63,6 +66,12 @@ public class IndexExplainServiceImpl implements IndexExplainService {
private FactIndexGridSubScoreDao gridSubScoreDao;
@Autowired
private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao;
+ @Autowired
+ private FactIndexCommunitySubScoreDao communitySubScoreDao;
+ @Autowired
+ private FactIndexAgencySubScoreDao agencySubScoreDao;
+ @Autowired
+ private FactIndexDeptSubScoreDao deptSubScoreDao;
@Override
@@ -98,44 +107,82 @@ 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;
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());
ablityListFormDTO.setOrgId(formDTO.getOrgId());
+ ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
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();
-
- setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
+ if (IndexConstant.ZI_SHEN.equals(type)) {
+ setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
//不下钻
- 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);
-
+ setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
//下钻到党员
- 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, null);
+ //不下钻
+ realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO);
+ break;
+ case "street":
+ setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
+ //不下钻
+ realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
+ break;
+ case "district":
+ 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:
@@ -166,14 +213,24 @@ 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);
+ 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<>();
List threlodList = new ArrayList<>();
indexGroupDetailEntities.forEach(index -> {
@@ -181,11 +238,15 @@ 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) && !"district".equals(orgLevel)) && !index.getAllIndexCodePath().contains(type)) {
+ return;
+ }
table.setIndexCode(index.getIndexCode());
table.setIndexName(index.getIndexName());
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())));
@@ -225,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")) {
@@ -233,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 e1cbb6850b..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
@@ -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
@@ -40,5 +41,27 @@
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..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
@@ -40,5 +41,20 @@
ORDER BY
fact.month_id ASC
+
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 @@
+
+
+
+
+
+
+
+
+
+
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..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
@@ -40,21 +41,7 @@
ORDER BY
fact.month_id ASC
-