|
|
@ -72,27 +72,32 @@ public class GovIssueServiceImpl implements GovIssueService { |
|
|
|
List<GridsInfoListResultDTO> gridsInfoList = govOrgService.gridListByIds(formDTO.getGridIdList()); |
|
|
|
AllIssueResultDTO result = new AllIssueResultDTO(); |
|
|
|
switch (formDTO.getIssueType()){ |
|
|
|
// 审核中议题
|
|
|
|
case IssueConstant.ISSUE_STATUS_AUDITING: |
|
|
|
List<IssueListResultDTO> resultAuditing = issueStatusAuditing(formDTO); |
|
|
|
result.setIssueList(resultAuditing); |
|
|
|
result.setTotal(resultAuditing.size()); |
|
|
|
break; |
|
|
|
// 被拒绝的议题
|
|
|
|
case IssueConstant.ISSUE_STATUS_REJECTED: |
|
|
|
List<IssueListResultDTO> resultRejected = issueStatusRejected(formDTO); |
|
|
|
result.setIssueList(resultRejected); |
|
|
|
result.setTotal(resultRejected.size()); |
|
|
|
break; |
|
|
|
// 已转项目的议题
|
|
|
|
case IssueConstant.ISSUE_STATUS_SHIFT_PROJECT: |
|
|
|
List<IssueListResultDTO> resultShiftProject = issueStatusShiftProject(formDTO); |
|
|
|
result.setIssueList(resultShiftProject); |
|
|
|
result.setTotal(resultShiftProject.size()); |
|
|
|
break; |
|
|
|
// 已关闭、表决中的议题
|
|
|
|
default: |
|
|
|
List<IssueListResultDTO> 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<IssueListResultDTO> 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<IssueListResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueDao.issueStatusClosedOrVoting(formDTO.getGridIdList(), formDTO.getIssueType())); |
|
|
|
List<IssueListResultDTO> list = result.getList(); |
|
|
|
List<IssueListResultDTO> 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<IssueListResultDTO> resultDTOs = new ArrayList<>(); |
|
|
|
// 按照话题ID分组
|
|
|
|
Map<String, List<IssueListResultDTO>> 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<IssueListResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueDao.issueStatusShiftProject(formDTO.getGridIdList())); |
|
|
|
List<IssueListResultDTO> list = result.getList(); |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<String> issueIds = list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()); |
|
|
|
// 根据issueIds去查询项目信息
|
|
|
|
List<IssueListResultDTO> 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<IssueListResultDTO> collect = list.stream().sorted(Comparator.comparing(IssueListResultDTO::getShiftProjectTime).reversed()).collect(Collectors.toList()); |
|
|
|
return collect; |
|
|
|
} |
|
|
|