diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 2b88f53f42..f8274a7f10 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -132,7 +132,7 @@ public class DemoController { @PostMapping("zxc2") public Result getZxc2(){ - indexCalculateCommunityService.communityServiceAbilityCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008"); + indexCalculateCommunityService.calAll("b09527201c4409e19d1dbc5e3c3429a1","202008"); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java index 261fb8b945..c557c74ac2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java @@ -26,6 +26,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 服务能力-组织(街道|社区|全区)相关事实表 @@ -73,4 +74,5 @@ public interface FactIndexServiceAblityOrgMonthlyDao extends BaseDao selectActivityCount(@Param("customerId")String customerId, @Param("monthId")String monthId); + List> selectActivityCountMap(@Param("customerId")String customerId, @Param("monthId")String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java index f597e3748f..dee16a06f7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java @@ -38,12 +38,5 @@ public interface IndexCalculateCommunityService { */ void communityServiceAbilityCalculate(String customerId, String monthId); - /** - * @Description 社区相关计算 - * @param customerId - * @param monthId - * @author zxc - * @date 2020/9/1 9:21 上午 - */ - void communityRelate(String customerId, String monthId); + void calAll(String customerId, String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java index 89554a0cf2..cdd6470ccf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java @@ -62,7 +62,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni @Transactional(rollbackFor = Exception.class) @Override public void communityPartyCalculate(String customerId, String monthId) { - customerId = "b09527201c4409e19d1dbc5e3c3429a1"; // 党建能力 // 根据all_parent_index_code 获取指标明细 @@ -70,10 +69,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subAllGridList = new ArrayList<>(); List communityPublishArticle = new ArrayList<>(); //下属所有网格的党建能力平均值 - String finalCustomerId = customerId; detailListByParentCode.forEach(indexGroup -> { if (indexGroup.getIndexCode().equals(IndexCalConstant.COMMUNITY_PARTY_AVG)){ - List subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(finalCustomerId, monthId); + List subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(customerId, monthId); if (subGridPartyAvgScore.size() != NumConstant.ZERO){ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); Integer indexStart = NumConstant.ZERO; @@ -81,7 +79,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List collect; do { collect = subGridPartyAvgScore.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); - BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); List index1SampleValues = new ArrayList<>(); collect.forEach(c -> { SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); @@ -90,14 +87,11 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni BeanUtils.copyProperties(c,dto); subAllGridList.add(dto); }); - IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), index1SampleValues,indexGroup.getThreshold(), indexGroup.getWeight(), sc1); - List indexInputVOS = Arrays.asList(index1VO); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - List result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); - result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { + HashMap result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, indexGroup); + result.forEach((key,value) -> { subAllGridList.forEach(grid -> { - if (grid.getAgencyId().equals(agency.getSampleId())){ - grid.setScore(agency.getSampleScore()); + if (grid.getAgencyId().equals(key)){ + grid.setScore(value); } }); }); @@ -122,11 +116,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni Integer indexStart = NumConstant.ZERO; Integer indexEnd = NumConstant.TEN; List collect; - MaxAndMinIntegerResultDTO maxAndMinInteger = this.getMaxAndMinInteger(publishArticleCounts.stream().map(CommunityPublishArticleCountResultDTO::getPublishArticleCount).collect(Collectors.toList())); + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(publishArticleCounts.stream().map(o -> new BigDecimal(o.getPublishArticleCount())).collect(Collectors.toList())); do { collect = publishArticleCounts.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); - ScoreCalculator sc1 = new IntegerScoreCalculator(maxAndMinInteger.getMin(), maxAndMinInteger.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); - List> ll = new ArrayList<>(); + List ll = new ArrayList<>(); collect.forEach(c -> { SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount()); ll.add(s); @@ -134,15 +127,12 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni BeanUtils.copyProperties(c,publishArticle); communityPublishArticle.add(publishArticle); }); - IndexInputVO index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll,indexGroup.getThreshold(), indexGroup.getWeight(), sc1); - List indexInputVOS = Arrays.asList(index1VO); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - List result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); - result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { + HashMap result = this.getCalResult(maxAndMinBigDecimal, ll, indexGroup); + result.forEach((key,value) -> { communityPublishArticle.forEach(publish -> { - if (publish.getAgencyId().equals(agency.getSampleId())){ + if (publish.getAgencyId().equals(key)){ publish.setIndexCode(indexGroup.getIndexCode()); - publish.setScore(agency.getSampleScore()); + publish.setScore(value); } }); }); @@ -163,6 +153,14 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); } + public HashMap getCalResult(MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal,List ll, IndexGroupDetailEntity indexGroup){ + BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), ll,indexGroup.getThreshold(), indexGroup.getWeight(), sc); + List indexInputVOS = Arrays.asList(index1VO); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + return batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + } + /** * @Description 社区治理能力 * @param customerId @@ -173,16 +171,11 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni @Transactional(rollbackFor = Exception.class) @Override public void communityGovernAbilityCalculate(String customerId, String monthId) { - customerId = "b09527201c4409e19d1dbc5e3c3429a1"; - List subAllGridList = new ArrayList<>(); - List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - - String finalCustomerId = customerId; detailListByParentCode.forEach(detail -> { if (detail.getIndexCode().equals(IndexCalConstant.COMMUNITY_GOVERN_AVG)){ - List subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(finalCustomerId, monthId); + List subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(customerId, monthId); if (subGridGovernAvg.size() == NumConstant.ONE){ // TODO @@ -194,7 +187,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List collect; do { collect = subGridGovernAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); - BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); List index1SampleValues = new ArrayList<>(); collect.forEach(c -> { SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); @@ -203,11 +195,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni BeanUtils.copyProperties(c,dto); subAllGridList.add(dto); }); - IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold() ,detail.getWeight(), sc1); - List indexInputVOS = Arrays.asList(index1VO); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); - scoreCountOfSampleId.forEach((key,value) -> { + HashMap result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, detail); + result.forEach((key,value) -> { subAllGridList.forEach(grid -> { if (grid.getAgencyId().equals(key)){ grid.setScore(value); @@ -218,12 +207,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni }while (collect.size() == NumConstant.TEN); } } - else { - - } }); - List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(finalCustomerId, monthId); + List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId); if (communityGovernAbility.size() == NumConstant.ONE){ // TODO @@ -250,21 +236,20 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); indexInputVOS.add(index1VO); } while (collect.size() == NumConstant.TEN); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); - scoreCountOfSampleId.forEach((key,value) -> { - subAllGridList.forEach(grid -> { - if (key.equals(grid.getAgencyId())) { - grid.setCustomerId(finalCustomerId); - grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); - grid.setScore(grid.getScore().add(value)); - } - }); - }); } } }); - + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + scoreCountOfSampleId.forEach((key,value) -> { + subAllGridList.forEach(grid -> { + if (key.equals(grid.getAgencyId())) { + grid.setCustomerId(customerId); + grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); + grid.setScore(grid.getScore().add(value)); + } + }); + }); } factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN); factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); @@ -289,82 +274,75 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); detailListByParentCode.forEach(detail -> { - switch (detail.getIndexCode()){ - case IndexCalConstant.COMMUNITY_SERVICE_AVG: - List subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); - if (subGridServiceAvg.size() == NumConstant.ONE){ + String indexCode = detail.getIndexCode(); + if (indexCode.equals(IndexCalConstant.COMMUNITY_SERVICE_AVG)){ + List subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); + if (subGridServiceAvg.size() == NumConstant.ONE){ - // TODO 只有一条记录时 + // TODO 只有一条记录时 - }else if (subGridServiceAvg.size() > NumConstant.ONE ){ - MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); - Integer indexStart = NumConstant.ZERO; - Integer indexEnd = NumConstant.TEN; - List collect; - do { - collect = subGridServiceAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); - BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); - List index1SampleValues = new ArrayList<>(); - collect.forEach(c -> { - SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); - index1SampleValues.add(s); - FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); - BeanUtils.copyProperties(c,dto); - subAllGridList.add(dto); - }); - IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues,detail.getThreshold(), detail.getWeight(), sc1); - List indexInputVOS = Arrays.asList(index1VO); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - List result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); - result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { - subAllGridList.forEach(grid -> { - if (grid.getAgencyId().equals(agency.getSampleId())){ - grid.setScore(agency.getSampleScore()); - } - }); + }else if (subGridServiceAvg.size() > NumConstant.ONE ){ + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); + Integer indexStart = NumConstant.ZERO; + Integer indexEnd = NumConstant.TEN; + List collect; + do { + collect = subGridServiceAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); + BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + List index1SampleValues = new ArrayList<>(); + collect.forEach(c -> { + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); + FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); + BeanUtils.copyProperties(c,dto); + subAllGridList.add(dto); + }); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues,detail.getThreshold(), detail.getWeight(), sc1); + List indexInputVOS = Arrays.asList(index1VO); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + List result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); + result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { + subAllGridList.forEach(grid -> { + if (grid.getAgencyId().equals(agency.getSampleId())){ + grid.setScore(agency.getSampleScore()); + } }); - indexStart++; - }while (collect.size() == NumConstant.TEN); - } - break; - case "shequhuodongzzcs": - List communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); - if (communityActivityCount.size() == NumConstant.ONE){ + }); + indexStart++; + }while (collect.size() == NumConstant.TEN); + } + }else{ + List communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); + if (communityActivityCount.size() == NumConstant.ONE){ - // TODO + // TODO - }else if (communityActivityCount.size() > NumConstant.ONE){ - Integer indexStart = NumConstant.ZERO; - Integer indexEnd = NumConstant.TEN; - List collect; - MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList())); - do { - collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); - ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); - List> ll = new ArrayList<>(); - collect.forEach(c -> { - SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount()); - ll.add(s); - FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); - BeanUtils.copyProperties(c,publishArticle); - communityPublishArticle.add(publishArticle); - }); - IndexInputVO index1VO = new IndexInputVO<>(detail.getIndexId(), ll, detail.getThreshold(),detail.getWeight(), sc1); - List indexInputVOS = Arrays.asList(index1VO); - BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - List result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); - result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { - communityPublishArticle.forEach(publish -> { - if (publish.getAgencyId().equals(agency.getSampleId())){ - publish.setScore(agency.getSampleScore()); - } - }); + }else if (communityActivityCount.size() > NumConstant.ONE){ + Integer indexStart = NumConstant.ZERO; + Integer indexEnd = NumConstant.TEN; + List collect; + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList())); + do { + collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); + List ll = new ArrayList<>(); + collect.forEach(c -> { + SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount()); + ll.add(s); + FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); + BeanUtils.copyProperties(c,publishArticle); + communityPublishArticle.add(publishArticle); + }); + HashMap result = this.getCalResult(maxAndMinBigDecimal, ll, detail); + result.forEach((k,v) -> { + communityPublishArticle.forEach(publish -> { + if (publish.getAgencyId().equals(k)){ + publish.setScore(v); + } }); - indexStart++; - } while (collect.size() == NumConstant.TEN); - } - break; - default: + }); + indexStart++; + } while (collect.size() == NumConstant.TEN); + } } }); subAllGridList.forEach(grid -> { @@ -388,15 +366,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni * @author zxc * @date 2020/9/1 9:21 上午 */ - @Override public void communityRelate(String customerId, String monthId) { - - this.communityPartyCalculate(customerId, monthId); //党建能力 - this.communityGovernAbilityCalculate(customerId, monthId); // 治理能力 - this.communityServiceAbilityCalculate(customerId, monthId); // 服务能力 - - List communityPublishArticle = new ArrayList<>(); - List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); List factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId); detailListByParentCode.forEach(detail -> { @@ -406,7 +376,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } }); }); - Map> collect = factIndexCommunityScoreEntities.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); List result = new ArrayList<>(); collect.forEach((key,value) -> { @@ -417,7 +386,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni score.setMonthId(monthId); score.setYearId(DateUtils.getYearId(monthId)); score.setQuarterId(DateUtils.getQuarterId(monthId)); - factIndexCommunityScoreEntities.forEach(community -> { + score.setIndexCode(IndexCalConstant.COMMUNITY_RELATE); + value.forEach(community -> { score.setScore(score.getScore().add(community.getScore())); }); result.add(score); @@ -426,22 +396,20 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni factIndexCommunityScoreDao.insertCommunityPartyRecord(result); } + public void calAll(String customerId,String monthId){ + this.communityPartyCalculate(customerId, monthId); //党建能力 + this.communityGovernAbilityCalculate(customerId, monthId); // 治理能力 + this.communityServiceAbilityCalculate(customerId, monthId); // 服务能力 + + communityRelate(customerId, monthId); + } + /** - * @Description Integer类型获取最大数和最小数 + * @Description BigDecimal类型获取最大数和最小数 * @param list * @author zxc * @date 2020/8/27 1:30 下午 */ - public MaxAndMinIntegerResultDTO getMaxAndMinInteger(List list){ - Integer max = Collections.max(list); - Integer min = Collections.min(list); - MaxAndMinIntegerResultDTO result = new MaxAndMinIntegerResultDTO(); - result.setMax(max); - result.setMin(min); - return result; - } - - public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List list){ BigDecimal max = Collections.max(list); BigDecimal min = Collections.min(list); @@ -450,21 +418,4 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni result.setMin(min); return result; } - - /** - * @Description Double类型获取最大数和最小数 - * @param list - * @author zxc - * @date 2020/8/27 1:32 下午 - */ - public MaxAndMinDoubleResultDTO getMaxAndMinDouble(List list){ - Double max = Collections.max(list); - Double min = Collections.min(list); - MaxAndMinDoubleResultDTO result = new MaxAndMinDoubleResultDTO(); - result.setMax(max); - result.setMin(min); - return result; - } - - } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java index 1eecc8cf36..43688efa21 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java @@ -7,7 +7,7 @@ import java.math.BigDecimal; */ public class ScoreConstants { - public static final BigDecimal MIN_SCORE = new BigDecimal(0); + public static final BigDecimal MIN_SCORE = new BigDecimal(1); public static final BigDecimal MAX_SCORE = new BigDecimal(100); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml index d223423e17..8315280f89 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml @@ -89,4 +89,23 @@ AND customer_id = #{customerId} AND month_id = #{monthId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml index 91bebf545b..68b9d5344b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml @@ -57,6 +57,7 @@ del_flag = 0 AND CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} + AND INDEX_CODE != "shequxiangguan" \ No newline at end of file