From eba81f662423c499fb9918f3840305f99a77c804 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 24 May 2021 15:56:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E6=B4=9E=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datastats/impl/DataStatsServiceImpl.java | 234 ++++++++++-------- 1 file changed, 136 insertions(+), 98 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index 3a0512349a..59bca42a8a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -263,18 +263,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序 - resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); - re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyUserResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setUserTotal(u.getUserTotal()); + dto.setPartyMemberTotal(u.getPartyMemberTotal()); + dto.setResiTotal(u.getResiTotal()); } - }); - }); + } + dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); + dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -326,18 +332,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级注册用户日统计数据,默认按用户总数降序 - resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); - re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridUserResultDTO dto = new SubGridUserResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridUserResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setUserTotal(re.getUserTotal()); + dto.setPartyMemberTotal(re.getPartyMemberTotal()); + dto.setResiTotal(re.getResiTotal()); } - }); - }); + } + dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); + dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -387,18 +399,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织小组日统计数据,默认按群组总数降序 - resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); - re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyGroupResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setGroupTotal(u.getGroupTotal()); + dto.setOrdinaryTotal(u.getOrdinaryTotal()); + dto.setBranchTotal(u.getBranchTotal()); } - }); - }); + } + dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); + dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -447,18 +465,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级小组日统计数据,默认按群组总数降序 - resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); //3.封装数据并返回 - resultList.forEach(re -> { - re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); - re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridGroupResultDTO dto = new SubGridGroupResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridGroupResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setGroupTotal(re.getGroupTotal()); + dto.setOrdinaryTotal(re.getOrdinaryTotal()); + dto.setBranchTotal(re.getBranchTotal()); } - }); - }); + } + dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); + dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -514,15 +538,14 @@ public class DataStatsServiceImpl implements DataStatsService { List topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); //查询直属下级组织热议中话题-机关日统计数据 List hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId()); - agencyIds.forEach(agencyId -> { + subAgencyList.forEach(sub -> { SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0); - AtomicReference agencyName = new AtomicReference<>(""); topic.forEach(t -> { - if (t.getAgencyId().equals(agencyId)) { + if (t.getAgencyId().equals(sub.getId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -530,23 +553,18 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getAgencyId().equals(agencyId)) { + if (t.getAgencyId().equals(sub.getId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getAgencyId().equals(agencyId)) { + if (t.getAgencyId().equals(sub.getId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - subAgencyList.forEach(sub -> { - if (agencyId.equals(sub.getId())) { - agencyName.set(sub.getAgencyName()); - } - }); - resultDTO.setAgencyId(agencyId); - resultDTO.setAgencyName(agencyName.get()); + resultDTO.setAgencyId(sub.getId()); + resultDTO.setAgencyName(sub.getAgencyName()); resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); @@ -614,15 +632,14 @@ public class DataStatsServiceImpl implements DataStatsService { List topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); //查询网格层级热议中话题-日统计数据 List hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); - gridIds.forEach(gridId -> { + gridList.forEach(gr -> { SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0); - AtomicReference gridName = new AtomicReference<>(""); topic.forEach(t -> { - if (t.getGridId().equals(gridId)) { + if (t.getGridId().equals(gr.getId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -630,23 +647,18 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getGridId().equals(gridId)) { + if (t.getGridId().equals(gr.getId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getGridId().equals(gridId)) { + if (t.getGridId().equals(gr.getId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - gridList.forEach(sub -> { - if (gridId.equals(sub.getId())) { - gridName.set(sub.getGridName()); - } - }); - resultDTO.setGridId(gridId); - resultDTO.setGridName(gridName.get()); + resultDTO.setGridId(gr.getId()); + resultDTO.setGridName(gr.getGridName()); resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); @@ -707,19 +719,26 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织议题日统计数据,默认按议题总数降序 - resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); - re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); - re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyIssueResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setIssueTotal(u.getIssueTotal()); + dto.setVotingTotal(u.getVotingTotal()); + dto.setClosedIssueTotal(u.getClosedIssueTotal()); + dto.setShiftProjectTotal(u.getShiftProjectTotal()); } - }); - }); + } + dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); + dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); + dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -770,19 +789,26 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级议题日统计数据,默认按议题总数降序 - resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); - re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); - re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridIssueResultDTO dto = new SubGridIssueResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridIssueResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setIssueTotal(re.getIssueTotal()); + dto.setVotingTotal(re.getVotingTotal()); + dto.setClosedIssueTotal(re.getClosedIssueTotal()); + dto.setShiftProjectTotal(re.getShiftProjectTotal()); } - }); - }); + } + dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); + dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); + dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -833,18 +859,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织项目日统计数据,默认按项目总数降序 - resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); - re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyProjectResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setProjectTotal(u.getProjectTotal()); + dto.setPendingTotal(u.getPendingTotal()); + dto.setClosedProjectTotal(u.getClosedProjectTotal()); } - }); - }); + } + dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); + dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -893,18 +925,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级项目日统计数据,默认按项目总数降序 - resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); - re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridProjectResultDTO dto = new SubGridProjectResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridProjectResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setProjectTotal(re.getProjectTotal()); + dto.setPendingTotal(re.getPendingTotal()); + dto.setClosedProjectTotal(re.getClosedProjectTotal()); } - }); - }); + } + dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); + dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() {