From 8e917b970bf47dd8b61ab03b9a6c5a92b5f14e83 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 4 Dec 2021 13:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=90=B9=E5=93=A8=E5=87=86?= =?UTF-8?q?=E7=A1=AE=E7=8E=87=20=E9=A1=B9=E7=9B=AE=E4=B8=BA0=E6=97=B6=20?= =?UTF-8?q?=E8=BF=94=E5=9B=9E100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CalGridIndexServiceImpl.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java index e37586f930..389901ffd3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java @@ -36,11 +36,8 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -328,8 +325,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { }); } //网格办结项目数 - List gridProjectClosedTotalList = projectMainService.selectGridClosedProject(result.stream().map(m -> m.getGridId()).collect(Collectors.toList()), monthId, ExtractConstant.CLOSED); + List allGridIds = result.stream().map(GovernAbilityGridMonthlyFormDTO::getGridId).collect(Collectors.toList()); + List gridProjectClosedTotalList = projectMainService.selectGridClosedProject(allGridIds, monthId, ExtractConstant.CLOSED); //网格吹哨部门准确率 【没被退回的项目数/项目总数 】 + //获取网格 存在的项目id及网格Id 没有项目的网格需要过滤出来 List transferRightRatioResultDTOS = projectMainService.selectTransferRightRatio(customerId, monthId); List transferRightRatioResultDTOS1 = projectLogService.selectNotReturn(customerId, monthId); if (!CollectionUtils.isEmpty(transferRightRatioResultDTOS1)){ @@ -339,16 +338,19 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { }else { transferRightRatioResultDTOS.forEach(r -> r.setStatus(false)); } + Set haveNotProjectSet = new HashSet<>(allGridIds); Map> groupByGridProject = transferRightRatioResultDTOS.stream().collect(Collectors.groupingBy(TransferRightRatioResultDTO::getGridId)); Map notReturnMap = new HashMap<>(16); groupByGridProject.forEach((grid,project) -> { - AtomicReference count = new AtomicReference<>(NumConstant.ZERO); + AtomicInteger count = new AtomicInteger(NumConstant.ZERO); project.forEach(p -> { if (p.getStatus().equals(false)){ - count.getAndSet(count.get() + NumConstant.ONE); + count.incrementAndGet(); } }); - notReturnMap.put(grid,getRound(new BigDecimal(count.get()/project.size()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); + notReturnMap.put(grid,getRound(new BigDecimal(count.get()).divide(new BigDecimal(project.size()),NumConstant.EIGHT,BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); + //把有项目数的网格剔除 只剩下没有项目的网格 + haveNotProjectSet.remove(grid); }); //网格内解决的项目的满意度 //项目评价(分值定义下非常满意100,满意80,不满意(一般)60)的人数的平均分(每个项目的参加人数的分数和/评论人数=一个项目的平均分)+其他项目得分/已关闭项目总数 @@ -425,6 +427,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } }); } + //如果项目数为0 则准确率设置为100 + if (haveNotProjectSet.contains(r.getGridId())){ + r.setTransferRightRatio(new BigDecimal(100)); + } // 5. 网格内解决的项目的满意度 if (!CollectionUtils.isEmpty(resultSatisfactionScore)){ resultSatisfactionScore.forEach((k, v) -> {