@ -67,13 +67,19 @@ public class IndexExplainServiceImpl implements IndexExplainService {
@Autowired
private FactIndexGridSubScoreDao gridSubScoreDao ;
@Autowired
private FactIndexGridScoreDao gridScoreDao ;
@Autowired
private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao ;
@Autowired
private FactIndexCommunitySubScoreDao communitySubScoreDao ;
@Autowired
private FactIndexCommunityScoreDao communityScoreDao ;
@Autowired
private FactIndexAgencySubScoreDao agencySubScoreDao ;
@Autowired
private FactIndexDeptSubScoreDao deptSubScoreDao ;
@Autowired
private FactIndexAgencyScoreDao agencyScoreDao ;
@Override
@ -83,6 +89,8 @@ public class IndexExplainServiceImpl implements IndexExplainService {
first . setTitle ( IndexConstant . INDEX_SCORE_TITLE ) ;
first . setMeaning ( IndexConstant . INDEX_SCORE_DESC ) ;
results . add ( first ) ;
//获取该等级的分数及权重
List < IndexExplainTreeDTO > explainDTOList = indexExplainDao . getIndexExplainTreeByOrgType ( formDTO . getOrgLevel ( ) ) ;
if ( CollectionUtils . isEmpty ( explainDTOList ) ) {
return null ;
@ -100,6 +108,7 @@ public class IndexExplainServiceImpl implements IndexExplainService {
results . add ( result ) ;
result . setTitle ( explainDTO . getTitle ( ) ) ;
result . setMeaning ( explainDTO . getMeaning ( ) ) ;
result . setIndexCode ( explainDTO . getIndexCode ( ) ) ;
//全区相关的服务能力的含义中 有权重 所以特殊处理下
if ( explainDTO . getOrgLevel ( ) . equals ( OrgLevelEnum . DISTRICT . getCode ( ) ) & & IndexConstant . ZLZS_CN . equals ( explainDTO . getTitle ( ) ) ) {
@ -114,6 +123,9 @@ public class IndexExplainServiceImpl implements IndexExplainService {
setTableData ( formDTO , detailEntityMap , explainDTO , result ) ;
//子节点
setChildren ( formDTO , detailEntityMap , result , explainDTO , explainDTO . getChildren ( ) ) ;
//设置 新的含义 带分数的
System . out . println ( result . getIndexCode ( ) + "=============" ) ;
setCurrentMonthScore ( formDTO , first , result ) ;
}
return results ;
@ -124,6 +136,55 @@ public class IndexExplainServiceImpl implements IndexExplainService {
return indexDictDao . selectIndexDict ( formDTO . getIndexCode ( ) ) ;
}
private void setCurrentMonthScore ( IndexExplainFormDTO formDTO , IndexExplainResult first , IndexExplainResult second ) {
String orgLevel = formDTO . getOrgLevel ( ) ;
OrgLevelEnum anEnum = OrgLevelEnum . getEnum ( orgLevel ) ;
List < IndexScoreResult > list = null ;
switch ( anEnum ) {
case GRID :
list = gridScoreDao . selectGridScoreList ( formDTO . getCustomerId ( ) , formDTO . getOrgId ( ) , formDTO . getMonthId ( ) ) ;
break ;
case COMMUNITY :
list = communityScoreDao . selectComunityScoreList ( formDTO . getCustomerId ( ) , formDTO . getOrgId ( ) , formDTO . getMonthId ( ) ) ;
break ;
case STREET :
list = agencyScoreDao . selectAgencyScoreList ( formDTO . getCustomerId ( ) , formDTO . getOrgId ( ) , formDTO . getMonthId ( ) ) ;
break ;
case DISTRICT :
list = agencyScoreDao . selectAgencyScoreList ( formDTO . getCustomerId ( ) , formDTO . getOrgId ( ) , formDTO . getMonthId ( ) ) ;
break ;
default :
log . error ( "暂不支持更高级别的查询,level:{}" , orgLevel ) ;
}
if ( CollectionUtils . isNotEmpty ( list ) ) {
setNewMeaningWithScore ( list , first , second ) ;
}
}
private void setNewMeaningWithScore ( List < IndexScoreResult > list , IndexExplainResult first , IndexExplainResult second ) {
String firstMeaning = first . getMeaning ( ) ;
String secondMeaning = second . getMeaning ( ) ;
for ( IndexScoreResult score : list ) {
String indexCode = score . getIndexCode ( ) ;
if ( score . getIsTotal ( ) ) {
firstMeaning = firstMeaning . replaceFirst ( IndexConstant . PATTERN_TOTAL , score . getScore ( ) . toString ( ) ) ;
continue ;
}
firstMeaning = firstMeaning . replaceFirst ( indexCode , score . getScore ( ) . toString ( ) ) . replaceFirst ( indexCode . concat ( IndexConstant . PATTERN_WEIGHT ) , score . getWeight ( ) . multiply ( new BigDecimal ( NumConstant . ONE_HUNDRED ) ) . setScale ( NumConstant . ZERO , BigDecimal . ROUND_HALF_UP ) . toString ( ) + "%" ) ;
if ( score . getIndexCode ( ) . equals ( second . getIndexCode ( ) ) ) {
secondMeaning = secondMeaning . replaceFirst ( IndexConstant . PATTERN_TOTAL , score . getScore ( ) . toString ( ) )
. replaceFirst ( IndexConstant . BEN_JI_EN , score . getSelfScore ( ) . toString ( ) )
. replaceFirst ( IndexConstant . XIA_JI_EN , score . getSubScore ( ) . toString ( ) ) ;
}
}
first . setMeaning ( firstMeaning ) ;
second . setMeaning ( secondMeaning ) ;
}
private void setTableData ( IndexExplainFormDTO formDTO , Map < String , List < IndexGroupDetailResult > > detailEntityMap , IndexExplainTreeDTO explainDTO , IndexExplainResult result ) {
if ( NumConstant . ONE = = explainDTO . getIsSearch ( ) ) {
List < IndexScoreResult > realScoreList = null ;