|
|
@ -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<String> 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<String> 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<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, String allIndexCodePath) { |
|
|
|
List<IndexGroupDetailResult> indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); |
|
|
|
if (CollectionUtils.isEmpty(indexGroupDetailEntities)){ |
|
|
|
log.warn("setDefaultTableData allINdexCodePath:{} is config error",allIndexCodePath); |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<IndexScoreDetailResult> tableList = new ArrayList<>(); |
|
|
|
List<String> 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); |
|
|
|