From 7352f239c19b130ba17a0667dff79348a127aead Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 12 Sep 2020 14:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/indexcal/AgencyScoreDTO.java | 9 +++++++-- .../dto/screen/FactIndexCommunityScoreDTO.java | 13 +++++++++---- .../data-statistical-server/pom.xml | 2 +- .../impl/CpcIndexCalculateServiceImpl.java | 15 ++++++++++----- .../indexcal/impl/DeptScoreServiceImpl.java | 15 ++++++++++----- .../indexcal/impl/GridCorreLationServiceImpl.java | 9 ++++++--- .../impl/IndexCalculateCommunityServiceImpl.java | 6 ++++++ .../impl/IndexCalculateDistrictServiceImpl.java | 7 ++++++- .../impl/IndexCalculateStreetServiceImpl.java | 8 +++++++- 9 files changed, 62 insertions(+), 22 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java index dabf459123..605f755064 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java @@ -120,12 +120,17 @@ public class AgencyScoreDTO implements Serializable { /** * 更新人 */ - private String updatedBy; + private String updatedBy; /** * 更新时间 */ - private Date updatedTime; + private Date updatedTime; + + /** + * 权重 + */ + private BigDecimal weight; public AgencyScoreDTO() { this.isTotal = NumConstant.ZERO_STR; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java index 026b92084b..2888cc7706 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java @@ -17,11 +17,11 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; /** * 社区相关分数表 @@ -112,12 +112,17 @@ public class FactIndexCommunityScoreDTO implements Serializable { /** * 更新人 */ - private String updatedBy; + private String updatedBy; /** * 更新时间 */ - private Date updatedTime; + private Date updatedTime; + + /** + * 权重 + */ + private BigDecimal weight; public FactIndexCommunityScoreDTO() { this.customerId = ""; diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index b907c6525e..d930651a68 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -226,7 +226,7 @@ true - 8109 + 8108 local diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java index 7c2f3dc367..2eacb84ef6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java @@ -50,7 +50,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { @Autowired private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; @Autowired - private IndexGroupDetailService getDetailListByParentCode; + private IndexGroupDetailService indexGroupDetailService; @Autowired private IndexCodeFieldReService indexCodeFieldReService; @Autowired @@ -72,7 +72,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { */ private void calculateTotalScore(CalculateCommonFormDTO formDTO) { //获取指标权重 - List parentIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); + List parentIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); if (CollectionUtils.isEmpty(parentIndexDetails)) { log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); throw new RenException("客户【党员相关】指标权重信息不存在"); @@ -113,6 +113,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { totalEntity.setIndexCode(IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); totalEntity.setScore(new BigDecimal(NumConstant.ZERO)); totalEntity.setAllParentIndexCode(NumConstant.ZERO_STR); + totalEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG)); if (preLastCpcScoreTotalMap.containsKey(part.getUserId())) { preLastCpcScoreTotalMap.put(part.getUserId(), part); @@ -265,6 +266,9 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { cpcScoreEntity.setScore(new BigDecimal(NumConstant.ZERO)); cpcScoreEntity.setIndexCode(parentIndexCode); cpcScoreEntity.setAllParentIndexCode(value.getAllParentIndexCode()); + String vallPath = value.getAllParentIndexCode().concat(StrConstant.COLON).concat(parentIndexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(formDTO.getCustomerId(), vallPath); + cpcScoreEntity.setWeight(weight); scoreEntityMap.put(userId, cpcScoreEntity); //构造样本值对象 @@ -311,6 +315,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { child.setIndexCode(o.getIndexCode()); child.setAllParentIndexCode(o.getAllParentIndexCode()); child.setScore(o.getScore()); + child.setWeight(o.getWeight()); subList.add(child); }); @@ -403,17 +408,17 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { */ private Map> getIndexDetailMap(CalculateCommonFormDTO formDTO) { //获取指标权重信息 -参与议事 - List canyuyishiIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode()); + List canyuyishiIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; } - List dangwuhongdongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode()); + List dangwuhongdongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; } - List lianxiqunzhongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode()); + List lianxiqunzhongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index b133615512..fabd8d515e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -78,7 +78,7 @@ import java.util.stream.Collectors; @Service public class DeptScoreServiceImpl extends BaseServiceImpl implements DeptScoreService { @Autowired - private IndexGroupDetailService getDetailListByParentCode; + private IndexGroupDetailService indexGroupDetailService; @Autowired private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao; @Autowired @@ -117,7 +117,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl indexGroupDetailEntityList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), + List indexGroupDetailEntityList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(indexGroupDetailEntityList)) { @@ -167,7 +167,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl indexList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); if (CollectionUtils.isEmpty(indexList)) { log.error("calculateDeptTotalScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); @@ -189,6 +189,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl { score.setScore(score.getScore().add(community.getScore())); score.setParentAgencyId(community.getParentAgencyId()); @@ -441,6 +443,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni score.setIndexCode(indexCode); score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { score.setParentAgencyId(parentAgency); @@ -458,6 +463,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni s.setIndexCode(fiveDetail.getIndexCode()); s.setScore(fiveDetail.getScore()); s.setAllParentIndexCode(fiveDetail.getAllParentIndexCode()); + s.setWeight(fiveDetail.getWeight()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index d11a1e7df2..c3fc5684bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.druid.util.StringUtils; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -415,13 +416,16 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); score.setDataType(IndexCalConstant.DISTRICT_LEVEL); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { //todo 确认 if (k != null && k.equals(agency)) { score.setParentAgencyId(parentAgency); } }); - if (!CollectionUtils.isEmpty(v.getDetails())){ + if (!CollectionUtils.isEmpty(v.getDetails())) { v.getDetails().forEach(streetScore -> { AgencyScoreDTO s = new AgencyScoreDTO(); s.setCustomerId(customerId); @@ -434,6 +438,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict s.setScore(streetScore.getScore()); s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setDataType(IndexCalConstant.DISTRICT_LEVEL); + s.setWeight(streetScore.getWeight()); pid.forEach((agency, parentAgency) -> { //todo 确认 if (k != null && k.equals(agency)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 1eb6a60a5b..5fb28ac104 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.druid.util.StringUtils; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -351,6 +352,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode()); score.setDataType(IndexCalConstant.STREET_LEVEL); score.setAllParentIndexCode(NumConstant.ZERO_STR); + score.setWeight(new BigDecimal(NumConstant.ONE_NEG)); value.forEach(street -> { score.setScore(score.getScore().add(street.getScore())); score.setParentAgencyId(street.getParentAgencyId()); @@ -445,12 +447,15 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); score.setDataType(IndexCalConstant.STREET_LEVEL); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { score.setParentAgencyId(parentAgency); } }); - if (!CollectionUtils.isEmpty(v.getDetails())){ + if (!CollectionUtils.isEmpty(v.getDetails())) { v.getDetails().forEach(streetScore -> { AgencyScoreDTO s = new AgencyScoreDTO(); s.setCustomerId(customerId); @@ -463,6 +468,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ s.setScore(streetScore.getScore()); s.setDataType(IndexCalConstant.STREET_LEVEL); s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); + s.setWeight(streetScore.getWeight()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency);