From 1f9be1b1cd8111231adfd68661e0915243bfec64 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 20 Oct 2020 09:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8B=E7=BA=A7=E5=92=8C?= =?UTF-8?q?=E8=87=AA=E8=BA=AB=E6=9D=83=E9=87=8D=E4=B8=8D=E5=AF=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcal/impl/DeptScoreServiceImpl.java | 11 +++++++---- .../indexcal/impl/GridCorreLationServiceImpl.java | 7 +++++-- .../impl/IndexCalculateCommunityServiceImpl.java | 7 +++++-- .../impl/IndexCalculateDistrictServiceImpl.java | 7 +++++-- .../impl/IndexCalculateStreetServiceImpl.java | 8 ++++++-- 5 files changed, 28 insertions(+), 12 deletions(-) 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 f4d97de2aa..00ebad6b5d 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 @@ -140,12 +140,15 @@ public class DeptScoreServiceImpl extends BaseServiceImpl> selfSubParentMap = new HashMap<>(); selfSubParentMap.put(ProjectConstant.ZI_SHEN, new HashSet<>()); selfSubParentMap.put(ProjectConstant.XIA_JI, new HashSet<>()); + Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); + weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { selfSubParentMap.get(ProjectConstant.ZI_SHEN).add(o.getIndexCode()); + weightMap.put(ProjectConstant.ZI_SHEN, weightMap.getOrDefault(ProjectConstant.ZI_SHEN, new BigDecimal(0)).add(o.getWeight())); } }); Map insertMap = new HashMap<>(); @@ -158,16 +161,16 @@ public class DeptScoreServiceImpl extends BaseServiceImpl> selfSubParentMap = new HashMap<>(); selfSubParentMap.put(ProjectConstant.ZI_SHEN, new HashSet<>()); selfSubParentMap.put(ProjectConstant.XIA_JI, new HashSet<>()); + Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); + weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { selfSubParentMap.get(ProjectConstant.ZI_SHEN).add(o.getIndexCode()); + weightMap.put(ProjectConstant.ZI_SHEN, weightMap.getOrDefault(ProjectConstant.ZI_SHEN, new BigDecimal(0)).add(o.getWeight())); } }); Map insertMap = new HashMap<>(); @@ -154,10 +157,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { BigDecimal partScore = score.getScore().multiply(score.getWeight()); if (selfSubParentMap.get(ProjectConstant.XIA_JI).contains(score.getIndexCode())) { scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore)); - scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.XIA_JI)); } else { scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore)); - scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.ZI_SHEN)); } log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getGridId(), score.getScore(), score.getWeight(), partScore); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 34b95afaf4..0b0ad32dc8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -138,12 +138,15 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni Map> selfSubParentMap = new HashMap<>(); selfSubParentMap.put(ProjectConstant.ZI_SHEN, new HashSet<>()); selfSubParentMap.put(ProjectConstant.XIA_JI, new HashSet<>()); + Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); + weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { selfSubParentMap.get(ProjectConstant.ZI_SHEN).add(o.getIndexCode()); + weightMap.put(ProjectConstant.ZI_SHEN, weightMap.getOrDefault(ProjectConstant.ZI_SHEN, new BigDecimal(0)).add(o.getWeight())); } }); Map insertMap = new HashMap<>(); @@ -162,10 +165,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni BigDecimal partScore = score.getScore().multiply(score.getWeight()); if (selfSubParentMap.get(ProjectConstant.XIA_JI).contains(score.getIndexCode())) { scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore)); - scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.XIA_JI)); } else { scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore)); - scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight())); + scoreEntity.setSelfWeight(weightMap.get(ProjectConstant.ZI_SHEN)); } log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getAgencyId(), score.getScore(), score.getWeight(), partScore); }); 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 cc640e1853..f295a69d83 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 @@ -136,12 +136,15 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict Map> selfSubParentMap = new HashMap<>(); selfSubParentMap.put(ProjectConstant.ZI_SHEN, new HashSet<>()); selfSubParentMap.put(ProjectConstant.XIA_JI, new HashSet<>()); + Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); + weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { selfSubParentMap.get(ProjectConstant.ZI_SHEN).add(o.getIndexCode()); + weightMap.put(ProjectConstant.ZI_SHEN, weightMap.getOrDefault(ProjectConstant.ZI_SHEN, new BigDecimal(0)).add(o.getWeight())); } }); Map insertMap = new HashMap<>(); @@ -160,10 +163,10 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict BigDecimal partScore = score.getScore().multiply(score.getWeight()); if (selfSubParentMap.get(ProjectConstant.XIA_JI).contains(score.getIndexCode())) { scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore)); - scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.XIA_JI)); } else { scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore)); - scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.ZI_SHEN)); } log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getAgencyId(), score.getScore(), score.getWeight(), partScore); }); 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 d7637f8e5a..842e9e3c81 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 @@ -139,13 +139,17 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ Map> selfSubParentMap = new HashMap<>(); selfSubParentMap.put(ProjectConstant.ZI_SHEN, new HashSet<>()); selfSubParentMap.put(ProjectConstant.XIA_JI, new HashSet<>()); + Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); + weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { selfSubParentMap.get(ProjectConstant.ZI_SHEN).add(o.getIndexCode()); + weightMap.put(ProjectConstant.ZI_SHEN, weightMap.getOrDefault(ProjectConstant.ZI_SHEN, new BigDecimal(0)).add(o.getWeight())); } + }); Map insertMap = new HashMap<>(); subScore.forEach(score -> { @@ -163,10 +167,10 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ BigDecimal partScore = score.getScore().multiply(score.getWeight()); if (selfSubParentMap.get(ProjectConstant.XIA_JI).contains(score.getIndexCode())) { scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore)); - scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight())); + scoreEntity.setSubWeight(weightMap.get(ProjectConstant.XIA_JI)); } else { scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore)); - scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight())); + scoreEntity.setSelfWeight(weightMap.get(ProjectConstant.ZI_SHEN)); } log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getAgencyId(), score.getScore(), score.getWeight(), partScore); });