From 1485154ea3c9a0268859b59a3f2bcf5d3e4e626a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 28 Aug 2020 17:57:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactIndexCommunityGovrnFiveScoreDTO.java | 30 +++++++------ .../FactIndexCommunityPartyFiveScoreDTO.java | 24 ++++++++--- ...FactIndexCommunityServiceFiveScoreDTO.java | 20 ++++----- .../IndexCalculateCommunityServiceImpl.java | 43 +++++++++++++------ .../FactIndexCommunityPartyFiveScoreDao.xml | 6 +-- 5 files changed, 76 insertions(+), 47 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java index bfa52ac370..5f2fbf85b7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java @@ -18,6 +18,8 @@ package com.epmet.dto.screen; import java.io.Serializable; +import java.math.BigDecimal; + import lombok.Data; /** @@ -47,29 +49,29 @@ public class FactIndexCommunityGovrnFiveScoreDTO implements Serializable { private String monthId; /** - * 季度ID + * 指标ID */ - private String quarterId; + private String indexId; /** - * 年度ID + * 总指数分值 */ - private String yearId; + private BigDecimal totalScore; /** - * 指标ID + * 党建能力分值 */ - private String indexId; + private BigDecimal partyAbilityScore; /** - * 分数 + * 治理能力分值 */ - private Double score; + private BigDecimal govrnAbilityScore; /** - * 社区被吹哨次数:transfered,社区办结项目数:closed_project,社区项目响应度:resp_project_ratio,社区超期项目率:overdue_project_ratio,社区办结项目率:closed_project_ratio,社区办结项目满意度:satisfaction_ratio + * 服务能力分值 */ - private String type; + private BigDecimal serviceAbilityScore; /** * 删除状态,0正常,1删除 @@ -94,11 +96,11 @@ public class FactIndexCommunityGovrnFiveScoreDTO implements Serializable { public FactIndexCommunityGovrnFiveScoreDTO() { this.agencyId = ""; this.monthId = ""; - this.quarterId = ""; - this.yearId = ""; this.indexId = ""; - this.score = 0.00; - this.type = ""; + this.totalScore = new BigDecimal(0); + this.partyAbilityScore = new BigDecimal(0); + this.govrnAbilityScore = new BigDecimal(0); + this.serviceAbilityScore = new BigDecimal(0); this.delFlag = 0; this.revision = 0; this.createdBy = "APP_USER"; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java index 9ab8f8f744..79024c60ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java @@ -54,14 +54,24 @@ public class FactIndexCommunityPartyFiveScoreDTO implements Serializable { private String indexId; /** - * 分数 + * 总指数分值 */ - private BigDecimal score; + private BigDecimal totalScore; /** - * 发文数量:publish_article + * 党建能力分值 */ - private String type; + private BigDecimal partyAbilityScore; + + /** + * 治理能力分值 + */ + private BigDecimal govrnAbilityScore; + + /** + * 服务能力分值 + */ + private BigDecimal serviceAbilityScore; /** * 删除状态,0正常,1删除 @@ -87,8 +97,10 @@ public class FactIndexCommunityPartyFiveScoreDTO implements Serializable { this.agencyId = ""; this.monthId = ""; this.indexId = ""; - this.score = BigDecimal.valueOf(0); - this.type = ""; + this.totalScore = new BigDecimal(0); + this.partyAbilityScore = new BigDecimal(0); + this.govrnAbilityScore = new BigDecimal(0); + this.serviceAbilityScore = new BigDecimal(0); this.delFlag = 0; this.revision = 0; this.createdBy = "APP_USER"; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java index a781ad0e4d..1eb6386bcc 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java @@ -50,29 +50,29 @@ public class FactIndexCommunityServiceFiveScoreDTO implements Serializable { private String monthId; /** - * 季度ID + * 指标ID */ - private String quarterId; + private String indexId; /** - * 年度ID + * 总指数分值 */ - private String yearId; + private BigDecimal totalScore; /** - * 指标ID + * 党建能力分值 */ - private String indexId; + private BigDecimal partyAbilityScore; /** - * 分数 + * 治理能力分值 */ - private BigDecimal score; + private BigDecimal govrnAbilityScore; /** - * 社区活动组织次数:activity + * 服务能力分值 */ - private String type; + private BigDecimal serviceAbilityScore; /** * 删除状态,0正常,1删除 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 543def9d3b..31a1cfe543 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 @@ -72,27 +72,31 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni @Override public void communityPublishArticleCountCalculate(String customerId, String monthId) { customerId = "b09527201c4409e19d1dbc5e3c3429a1"; + + // 党建能力 // 根据all_parent_index_code 获取指标明细 List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); List subAllGridList = new ArrayList<>(); List communityPublishArticle = new ArrayList<>(); - // todo 下属所有网格的党建能力平均值 + //下属所有网格的党建能力平均值 String finalCustomerId = customerId; detailListByParentCode.forEach(indexGroup -> { if (indexGroup.getIndexCode().equals("xiazhusuoyouwgddjnlpjz")){ List 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 index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll, indexGroup.getWeight(), sc1); List indexInputVOS = Arrays.asList(index1VO); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); List 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); } } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml index f2bab458f6..7110ba2c04 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml @@ -5,7 +5,7 @@ - INSERT INTO fact_index_community_party_five_score ( ID, AGENCY_ID, MONTH_ID, INDEX_ID, SCORE, TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO fact_index_community_party_five_score ( ID, AGENCY_ID, MONTH_ID, INDEX_ID, TOTAL_SCORE, PARTY_ABILITY_SCORE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( @@ -13,8 +13,8 @@ #{item.agencyId}, #{item.monthId}, #{item.indexId}, - #{item.score}, - #{item.type}, + #{item.totalScore}, + #{item.partyAbilityScore}, #{item.delFlag}, #{item.revision}, #{item.createdBy},