From 2efdf299b85a5bd1df81ca1e6017470cc87559d9 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 28 Dec 2020 17:39:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AE=E9=A2=98-=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../govissue/impl/GovIssueServiceImpl.java | 16 ++++++++++++++++ .../govproject/impl/GovProjectServiceImpl.java | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java index 6f0479a1f5..411ec78a9a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java @@ -72,27 +72,32 @@ public class GovIssueServiceImpl implements GovIssueService { List gridsInfoList = govOrgService.gridListByIds(formDTO.getGridIdList()); AllIssueResultDTO result = new AllIssueResultDTO(); switch (formDTO.getIssueType()){ + // 审核中议题 case IssueConstant.ISSUE_STATUS_AUDITING: List resultAuditing = issueStatusAuditing(formDTO); result.setIssueList(resultAuditing); result.setTotal(resultAuditing.size()); break; + // 被拒绝的议题 case IssueConstant.ISSUE_STATUS_REJECTED: List resultRejected = issueStatusRejected(formDTO); result.setIssueList(resultRejected); result.setTotal(resultRejected.size()); break; + // 已转项目的议题 case IssueConstant.ISSUE_STATUS_SHIFT_PROJECT: List resultShiftProject = issueStatusShiftProject(formDTO); result.setIssueList(resultShiftProject); result.setTotal(resultShiftProject.size()); break; + // 已关闭、表决中的议题 default: List resultClosedOrVoting = issueStatusClosedOrVoting(formDTO); result.setIssueList(resultClosedOrVoting); result.setTotal(resultClosedOrVoting.size()); } if (!CollectionUtils.isEmpty(gridsInfoList)){ + // 给所属网格 赋值 result.getIssueList().forEach(issue -> gridsInfoList.stream().filter(g -> issue.getGridId().equals(g.getGridId())).forEach(g -> issue.setBelongsGridName(g.getGridName()))); } return result; @@ -105,18 +110,24 @@ public class GovIssueServiceImpl implements GovIssueService { * @date 2020/12/25 下午2:30 */ public List issueStatusClosedOrVoting(AllIssueFormDTO formDTO){ + // 当议题类型为空时 if (StringUtils.isBlank(formDTO.getIssueType())){ throw new RenException(IssueConstant.NOT_EXISTS_ISSUE_TYPE); } + // 网格ID为空时 if (CollectionUtils.isEmpty(formDTO.getGridIdList())){ return new ArrayList<>(); } + // 分页查询关闭/表决中的议题 PageInfo result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueDao.issueStatusClosedOrVoting(formDTO.getGridIdList(), formDTO.getIssueType())); List list = result.getList(); List resultList = new ArrayList<>(); + // 根据议题类型,分开排序 if (formDTO.getIssueType().equals(IssueConstant.ISSUE_STATUS_CLOSED)){ + // 议题关闭时间排序 resultList = list.stream().sorted(Comparator.comparing(IssueListResultDTO::getIssueClosedTime).reversed()).collect(Collectors.toList()); }else { + // 议题创建时间 resultList = list.stream().sorted(Comparator.comparing(IssueListResultDTO::getCreateTime).reversed()).collect(Collectors.toList()); } return resultList; @@ -138,8 +149,10 @@ public class GovIssueServiceImpl implements GovIssueService { return new ArrayList<>(); } List resultDTOs = new ArrayList<>(); + // 按照话题ID分组 Map> groupByTopic = list.stream().collect(Collectors.groupingBy(IssueListResultDTO::getTopicId)); groupByTopic.forEach((topicId,l) -> { + // 取每个话题时间最近的一条记录 IssueListResultDTO issueListResultDTO = l.stream().max(Comparator.comparing(IssueListResultDTO::getRejectedTime)).get(); resultDTOs.add(issueListResultDTO); }); @@ -171,12 +184,14 @@ public class GovIssueServiceImpl implements GovIssueService { if (CollectionUtils.isEmpty(formDTO.getGridIdList())){ return new ArrayList<>(); } + // 查询已转项目的议题 PageInfo result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueDao.issueStatusShiftProject(formDTO.getGridIdList())); List list = result.getList(); if (CollectionUtils.isEmpty(list)){ return new ArrayList<>(); } List issueIds = list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()); + // 根据issueIds去查询项目信息 List resultDTOS = govProjectService.selectProjectInfo(issueIds); if (CollectionUtils.isEmpty(resultDTOS)){ throw new RenException(IssueConstant.NOT_EXISTS_PROJECT_INFO); @@ -190,6 +205,7 @@ public class GovIssueServiceImpl implements GovIssueService { } }); }); + // 根据转项目时间排序 List collect = list.stream().sorted(Comparator.comparing(IssueListResultDTO::getShiftProjectTime).reversed()).collect(Collectors.toList()); return collect; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java index c133e50dce..6d5810894a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java @@ -41,7 +41,9 @@ public class GovProjectServiceImpl implements GovProjectService { if (CollectionUtils.isEmpty(issueIds)){ return new ArrayList<>(); } + // 已关闭项目 List closedResult = projectDao.selectProjectInfoClosed(issueIds); + // 为关闭项目 List pendingResult = projectDao.selectProjectInfoPending(issueIds); if (CollectionUtils.isEmpty(closedResult)){ if (CollectionUtils.isEmpty(pendingResult))return new ArrayList<>(); @@ -53,8 +55,10 @@ public class GovProjectServiceImpl implements GovProjectService { } closedResult.addAll(pendingResult); List result = new ArrayList<>(); + // 根据议题分组 Map> groupByIssue = closedResult.stream().collect(Collectors.groupingBy(IssueListResultDTO::getIssueId)); groupByIssue.forEach((k,v) ->{ + // 取每个项目时间最近一条记录 List sortByTime = v.stream().sorted(Comparator.comparing(IssueListResultDTO::getOperationTime).reversed()).collect(Collectors.toList()); result.add(sortByTime.get(NumConstant.ZERO)); });