|
|
@ -72,27 +72,31 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
@Override |
|
|
|
public void communityPublishArticleCountCalculate(String customerId, String monthId) { |
|
|
|
customerId = "b09527201c4409e19d1dbc5e3c3429a1"; |
|
|
|
|
|
|
|
// 党建能力
|
|
|
|
// 根据all_parent_index_code 获取指标明细
|
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); |
|
|
|
|
|
|
|
List<FactIndexCommunityPartyFiveScoreDTO> subAllGridList = new ArrayList<>(); |
|
|
|
List<FactIndexCommunityPartyFiveScoreDTO> communityPublishArticle = new ArrayList<>(); |
|
|
|
|
|
|
|
// todo 下属所有网格的党建能力平均值
|
|
|
|
//下属所有网格的党建能力平均值
|
|
|
|
String finalCustomerId = customerId; |
|
|
|
detailListByParentCode.forEach(indexGroup -> { |
|
|
|
if (indexGroup.getIndexCode().equals("xiazhusuoyouwgddjnlpjz")){ |
|
|
|
List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(finalCustomerId, monthId); |
|
|
|
subGridPartyAvgScore.forEach(subGridParty -> { |
|
|
|
BigDecimal multiply = subGridParty.getScore().multiply(indexGroup.getWeight()); |
|
|
|
subGridParty.setScore(multiply); |
|
|
|
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO(); |
|
|
|
BeanUtils.copyProperties(subGridParty,dto); |
|
|
|
dto.setType("sub_all_grid_party_avg"); |
|
|
|
dto.setIndexId(indexGroup.getIndexId()); |
|
|
|
subAllGridList.add(dto); |
|
|
|
}); |
|
|
|
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
if (subGridPartyAvgScore.size() != NumConstant.ZERO){ |
|
|
|
subGridPartyAvgScore.forEach(subGridParty -> { |
|
|
|
BigDecimal multiply = subGridParty.getScore().multiply(indexGroup.getWeight()); |
|
|
|
subGridParty.setScore(multiply); |
|
|
|
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO(); |
|
|
|
BeanUtils.copyProperties(subGridParty,dto); |
|
|
|
dto.setIndexId(indexGroup.getIndexId()); |
|
|
|
dto.setTotalScore(dto.getPartyAbilityScore()); |
|
|
|
subAllGridList.add(dto); |
|
|
|
}); |
|
|
|
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(subAllGridList); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -103,8 +107,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
//TODO 计算之后的分数
|
|
|
|
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO(); |
|
|
|
BeanUtils.copyProperties(detailListByParentCode.get(NumConstant.ZERO), dto); |
|
|
|
dto.setScore(BigDecimal.valueOf(50.00)); |
|
|
|
dto.setType("publish_article_count"); |
|
|
|
dto.setPartyAbilityScore(BigDecimal.valueOf(50.00)); |
|
|
|
dto.setIndexId(detailListByParentCode.get(NumConstant.ZERO).getIndexId()); |
|
|
|
communityPublishArticle.add(dto); |
|
|
|
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle); |
|
|
@ -120,14 +123,26 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
collect.forEach(c -> { |
|
|
|
SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount()); |
|
|
|
ll.add(s); |
|
|
|
FactIndexCommunityPartyFiveScoreDTO publishArticle = new FactIndexCommunityPartyFiveScoreDTO(); |
|
|
|
BeanUtils.copyProperties(c,publishArticle); |
|
|
|
communityPublishArticle.add(publishArticle); |
|
|
|
}); |
|
|
|
IndexInputVO<Integer> index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll, indexGroup.getWeight(), sc1); |
|
|
|
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); |
|
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
|
List<IndexOutputVO> result = batchScoreCalculator.exec(indexInputVOS); |
|
|
|
|
|
|
|
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { |
|
|
|
communityPublishArticle.forEach(publish -> { |
|
|
|
if (publish.getAgencyId().equals(agency.getSampleId())){ |
|
|
|
publish.setIndexId(indexGroup.getIndexId()); |
|
|
|
publish.setPartyAbilityScore(agency.getSampleScore()); |
|
|
|
publish.setTotalScore(agency.getSampleScore()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
indexStart++; |
|
|
|
} while (collect.size() == 10); |
|
|
|
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|