|
|
@ -2,6 +2,7 @@ package com.epmet.service.screen.impl; |
|
|
|
|
|
|
|
import com.alibaba.druid.util.StringUtils; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.IndexCalConstant; |
|
|
|
import com.epmet.dao.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; |
|
|
@ -60,8 +61,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
* @date 2020/8/26 10:46 上午 |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void communityPartyCalculate(String customerId, String monthId) { |
|
|
|
public Boolean communityPartyCalculate(String customerId, String monthId) { |
|
|
|
|
|
|
|
// 党建能力
|
|
|
|
// 根据all_parent_index_code 获取指标明细
|
|
|
@ -100,18 +100,12 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 社区名义发文数量
|
|
|
|
List<CommunityPublishArticleCountResultDTO> publishArticleCounts = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCount(customerId, monthId); |
|
|
|
detailListByParentCode.forEach(indexGroup -> { |
|
|
|
if (indexGroup.getIndexCode().equals("shequmingyifwsl")) { |
|
|
|
if (publishArticleCounts.size() == NumConstant.ONE) { |
|
|
|
//TODO 计算之后的分数
|
|
|
|
FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); |
|
|
|
BeanUtils.copyProperties(detailListByParentCode.get(NumConstant.ZERO), dto); |
|
|
|
dto.setScore(BigDecimal.valueOf(50.00)); |
|
|
|
dto.setIndexCode(detailListByParentCode.get(NumConstant.ZERO).getIndexCode()); |
|
|
|
communityPublishArticle.add(dto); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(communityPublishArticle); |
|
|
|
//TODO 结果为一条时
|
|
|
|
} else if (publishArticleCounts.size() > NumConstant.ONE) { |
|
|
|
Integer indexStart = NumConstant.ZERO; |
|
|
|
Integer indexEnd = NumConstant.TEN; |
|
|
@ -149,8 +143,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_PARTY); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_PARTY,subAllGridList); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -161,8 +155,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
* @date 2020/8/26 1:40 下午 |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void communityGovernAbilityCalculate(String customerId, String monthId) { |
|
|
|
public Boolean communityGovernAbilityCalculate(String customerId, String monthId) { |
|
|
|
List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
@ -243,9 +236,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
|
|
|
|
deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN,subAllGridList); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -256,23 +248,16 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
* @date 2020/8/31 1:38 下午 |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void communityServiceAbilityCalculate(String customerId, String monthId) { |
|
|
|
|
|
|
|
|
|
|
|
public Boolean communityServiceAbilityCalculate(String customerId, String monthId) { |
|
|
|
List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); |
|
|
|
List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
String indexCode = detail.getIndexCode(); |
|
|
|
if (indexCode.equals(IndexCalConstant.COMMUNITY_SERVICE_AVG)){ |
|
|
|
List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); |
|
|
|
if (subGridServiceAvg.size() == NumConstant.ONE){ |
|
|
|
|
|
|
|
// TODO 只有一条记录时
|
|
|
|
|
|
|
|
}else if (subGridServiceAvg.size() > NumConstant.ONE ){ |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); |
|
|
|
Integer indexStart = NumConstant.ZERO; |
|
|
@ -306,9 +291,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
}else{ |
|
|
|
List<CommunityActivityCountResultDTO> communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); |
|
|
|
if (communityActivityCount.size() == NumConstant.ONE){ |
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
}else if (communityActivityCount.size() > NumConstant.ONE){ |
|
|
|
Integer indexStart = NumConstant.ZERO; |
|
|
|
Integer indexEnd = NumConstant.TEN; |
|
|
@ -346,9 +329,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_SERVICE); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
|
|
|
|
deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_SERVICE,subAllGridList); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -358,7 +340,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/1 9:21 上午 |
|
|
|
*/ |
|
|
|
public void communityRelate(String customerId, String monthId) { |
|
|
|
public Boolean communityRelate(String customerId, String monthId) { |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); |
|
|
|
List<FactIndexCommunityScoreDTO> factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
@ -384,16 +366,35 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
}); |
|
|
|
result.add(score); |
|
|
|
}); |
|
|
|
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_RELATE); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(result); |
|
|
|
deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_RELATE,result); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
public void calAll(String customerId,String monthId){ |
|
|
|
this.communityPartyCalculate(customerId, monthId); //党建能力
|
|
|
|
this.communityGovernAbilityCalculate(customerId, monthId); // 治理能力
|
|
|
|
this.communityServiceAbilityCalculate(customerId, monthId); // 服务能力
|
|
|
|
|
|
|
|
communityRelate(customerId, monthId); |
|
|
|
/** |
|
|
|
* @Description 计算社区相关总分 |
|
|
|
* @param customerId |
|
|
|
* @param monthId |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/1 4:12 下午 |
|
|
|
*/ |
|
|
|
public Boolean calCommunityAll(String customerId,String monthId){ |
|
|
|
Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力
|
|
|
|
if (!aBoolean.equals(true)){ |
|
|
|
throw new RenException("calculate community-party-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力
|
|
|
|
if (!bBoolean.equals(true)){ |
|
|
|
throw new RenException("calculate community-govern-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力
|
|
|
|
if (!cBoolean.equals(true)){ |
|
|
|
throw new RenException("calculate community-service-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean dBoolean = communityRelate(customerId, monthId); |
|
|
|
if (!dBoolean.equals(true)){ |
|
|
|
throw new RenException("calculate community-all insert failure ......"); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -418,4 +419,18 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
|
return batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 先删除记录,在插入 |
|
|
|
* @param customerId |
|
|
|
* @param monthId |
|
|
|
* @param indexCode |
|
|
|
* @param subAllGridList |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/1 4:24 下午 |
|
|
|
*/ |
|
|
|
public void deleteAndInsert(String customerId,String monthId,String indexCode,List<FactIndexCommunityScoreDTO> subAllGridList){ |
|
|
|
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,indexCode); |
|
|
|
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
} |
|
|
|
} |
|
|
|