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 @@
+
+
+
+
+
+
+
+
+
+