|
|
@ -2,8 +2,10 @@ package com.epmet.dataaggre.service.govissue.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.constant.IssueConstant; |
|
|
|
import com.epmet.dataaggre.dao.govissue.IssueApplicationDao; |
|
|
|
import com.epmet.dataaggre.dao.govissue.IssueDao; |
|
|
|
import com.epmet.dataaggre.dto.govissue.form.AllIssueFormDTO; |
|
|
@ -15,16 +17,16 @@ import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO; |
|
|
|
import com.epmet.dataaggre.service.govissue.GovIssueService; |
|
|
|
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|
|
|
import com.epmet.dataaggre.service.govproject.GovProjectService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -42,6 +44,8 @@ public class GovIssueServiceImpl implements GovIssueService { |
|
|
|
private IssueApplicationDao issueApplicationDao; |
|
|
|
@Autowired |
|
|
|
private GovOrgService govOrgService; |
|
|
|
@Autowired |
|
|
|
private GovProjectService govProjectService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 按组织查询所有议题 |
|
|
@ -53,9 +57,42 @@ public class GovIssueServiceImpl implements GovIssueService { |
|
|
|
@Override |
|
|
|
public AllIssueResultDTO allIssueList(AllIssueFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
if (CollectionUtils.isEmpty(formDTO.getGridIdList())){ |
|
|
|
|
|
|
|
String userId = govOrgService.getAgencyIdByUserId(tokenDto.getUserId()); |
|
|
|
if (StringUtils.isBlank(userId)){ |
|
|
|
throw new RenException(IssueConstant.GET_AGENCY_FAILURE); |
|
|
|
} |
|
|
|
List<GridInfoResultDTO> gridList = govOrgService.gridList(userId); |
|
|
|
if (CollectionUtils.isEmpty(gridList)){ |
|
|
|
throw new RenException(IssueConstant.GET_GRID_LIST_FAILURE); |
|
|
|
} |
|
|
|
formDTO.setGridIdList(gridList.stream().map(m -> m.getGridId()).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
return null; |
|
|
|
// xx街道-xx网格
|
|
|
|
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()); |
|
|
|
} |
|
|
|
result.getIssueList().forEach(issue -> gridsInfoList.stream().filter(g -> issue.getGridId().equals(g.getGridId())).forEach(g -> issue.setBelongsGridName(g.getGridName()))); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -82,8 +119,65 @@ public class GovIssueServiceImpl implements GovIssueService { |
|
|
|
if (CollectionUtils.isEmpty(formDTO.getGridIdList())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
// PageInfo<IssueListResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> .issueStatusClosed(formDTO.getGridIdList()));
|
|
|
|
return null; |
|
|
|
PageInfo<IssueListResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueApplicationDao.issueStatusRejected(formDTO.getGridIdList())); |
|
|
|
List<IssueListResultDTO> list = result.getList(); |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<IssueListResultDTO> resultDTOs = new ArrayList<>(); |
|
|
|
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); |
|
|
|
}); |
|
|
|
List<IssueListResultDTO> collect = resultDTOs.stream().sorted(Comparator.comparing(IssueListResultDTO::getRejectedTime).reversed()).collect(Collectors.toList()); |
|
|
|
return collect; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 审核中的议题走此方法 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2020/12/25 下午4:34 |
|
|
|
*/ |
|
|
|
public List<IssueListResultDTO> issueStatusAuditing(AllIssueFormDTO formDTO){ |
|
|
|
if (CollectionUtils.isEmpty(formDTO.getGridIdList())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
PageInfo<IssueListResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> issueApplicationDao.issueStatusAuditing(formDTO.getGridIdList())); |
|
|
|
return result.getList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 议题状态为转项目时走此方法 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2020/12/28 上午9:13 |
|
|
|
*/ |
|
|
|
public List<IssueListResultDTO> issueStatusShiftProject(AllIssueFormDTO formDTO){ |
|
|
|
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()); |
|
|
|
List<IssueListResultDTO> resultDTOS = govProjectService.selectProjectInfo(issueIds); |
|
|
|
if (CollectionUtils.isEmpty(resultDTOS)){ |
|
|
|
throw new RenException(IssueConstant.NOT_EXISTS_PROJECT_INFO); |
|
|
|
} |
|
|
|
list.forEach(l -> { |
|
|
|
resultDTOS.forEach(r -> { |
|
|
|
if (l.getIssueId().equals(r.getIssueId())){ |
|
|
|
l.setClosedReason(r.getClosedReason()); |
|
|
|
l.setStatus(r.getStatus()); |
|
|
|
l.setCurrentDepartment(r.getCurrentDepartment()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|