|
|
@ -19,6 +19,7 @@ package com.epmet.datareport.service.evaluationindex.index.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.datareport.constant.IndexConstant; |
|
|
@ -70,6 +71,8 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
|
private FactIndexCommunitySubScoreDao communitySubScoreDao; |
|
|
|
@Autowired |
|
|
|
private FactIndexAgencySubScoreDao agencySubScoreDao; |
|
|
|
@Autowired |
|
|
|
private FactIndexDeptSubScoreDao deptSubScoreDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -125,46 +128,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": |
|
|
|
|
|
|
|
OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel); |
|
|
|
switch (anEnum) { |
|
|
|
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); |
|
|
|
case COMMUNITY: |
|
|
|
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); |
|
|
|
//不下钻
|
|
|
|
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); |
|
|
|
realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO); |
|
|
|
break; |
|
|
|
case "street": |
|
|
|
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); |
|
|
|
case STREET: |
|
|
|
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); |
|
|
|
//不下钻
|
|
|
|
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); |
|
|
|
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); |
|
|
|
break; |
|
|
|
case "district": |
|
|
|
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath); |
|
|
|
case DISTRICT: |
|
|
|
if (allIndexCodePath.contains(IndexConstant.ZHI_LI_NENG_LI)) { |
|
|
|
List<IndexGroupDetailResult> detailResults = detailEntityMap.get(allIndexCodePath); |
|
|
|
|
|
|
|
List<IndexGroupDetailResult> 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); |
|
|
|
//不下钻
|
|
|
|
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); |
|
|
|
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); |
|
|
|
break; |
|
|
|
default: |
|
|
|
} 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: |
|
|
|
log.error("暂不支持更高级别的查询,level:{}",orgLevel); |
|
|
|
} |
|
|
|
|
|
|
|
setRealValue(result.getTableDataList(), realScoreList); |
|
|
@ -191,14 +211,20 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
|
} |
|
|
|
tb.setOriginValue(score.getOriginValue()); |
|
|
|
tb.setScore(String.valueOf(score.getScore())); |
|
|
|
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<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, String allIndexCodePath) { |
|
|
|
List<IndexGroupDetailResult> indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); |
|
|
|
private List<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, |
|
|
|
IndexExplainResult result, String allIndexCodePath, List<IndexGroupDetailResult> indexGroupDetailEntities) { |
|
|
|
|
|
|
|
if (indexGroupDetailEntities == null) { |
|
|
|
indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); |
|
|
|
} |
|
|
|
if (CollectionUtils.isEmpty(indexGroupDetailEntities)) { |
|
|
|
log.warn("setDefaultTableData allINdexCodePath:{} is config error", allIndexCodePath); |
|
|
|
return null; |
|
|
@ -210,7 +236,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 +244,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 +284,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 +292,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); |
|
|
|