|
|
@ -11,6 +11,7 @@ import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|
|
|
import com.epmet.commons.tools.dto.commondto.IcEventComDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.AchievementTypeEnum; |
|
|
|
import com.epmet.commons.tools.enums.EventEnum; |
|
|
@ -1659,28 +1660,56 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
@Override |
|
|
|
public List<UnResolvedResultDTO> getUnResolvedList(ShiftProjectListFromDTO fromDTO) { |
|
|
|
List<UnResolvedResultDTO> resultList = new ArrayList<>(); |
|
|
|
List<UnResolvedResultDTO> allList = new ArrayList<>(); |
|
|
|
//1、该网格下已关闭且无需解决的议题
|
|
|
|
List<UnResolvedResultDTO> issueList = baseDao.selectUnResolvedList(fromDTO.getGridId()); |
|
|
|
if (CollectionUtils.isNotEmpty(issueList)) { |
|
|
|
resultList.addAll(issueList); |
|
|
|
allList.addAll(issueList); |
|
|
|
} |
|
|
|
//2、来源于议题的项目,结案无需解决的项目
|
|
|
|
List<UnResolvedResultDTO> projectList = govProjectOpenFeignClient.getUnResolvedList(fromDTO).getData(); |
|
|
|
if (CollectionUtils.isNotEmpty(projectList)) { |
|
|
|
resultList.addAll(projectList); |
|
|
|
allList.addAll(projectList); |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(resultList)) { |
|
|
|
resultList = resultList.stream().sorted(Comparator.comparing(UnResolvedResultDTO::getClosedTime).reversed()).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(allList)) { |
|
|
|
allList = allList.stream().sorted(Comparator.comparing(UnResolvedResultDTO::getClosedTime).reversed()).collect(Collectors.toList()); |
|
|
|
if (fromDTO.getIsPage()) { |
|
|
|
int fromIndex = (fromDTO.getPageNo() - NumConstant.ONE) * fromDTO.getPageSize(); |
|
|
|
int toIndex = fromDTO.getPageNo() * fromDTO.getPageSize(); |
|
|
|
if (fromIndex >= resultList.size()) { |
|
|
|
if (fromIndex >= allList.size()) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
if (toIndex > resultList.size()) { |
|
|
|
toIndex = resultList.size(); |
|
|
|
if (toIndex > allList.size()) { |
|
|
|
toIndex = allList.size(); |
|
|
|
} |
|
|
|
resultList = resultList.subList(fromIndex, toIndex); |
|
|
|
resultList = allList.subList(fromIndex, toIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
//重新查询一下所有议题的来源类型, 且来源于事件的议题,赋值icEventInfo
|
|
|
|
List<String> issueIds=resultList.stream().map(i -> i.getIssueId()).collect(Collectors.toList()); |
|
|
|
List<IssueEntity> issueEntityList=baseDao.selectBatchIds(issueIds); |
|
|
|
if(CollectionUtils.isNotEmpty(issueEntityList)){ |
|
|
|
Map<String, IcEventDTO> eventMap=new HashMap<>(); |
|
|
|
// 来源于事件的
|
|
|
|
List<String> icEventIds = issueEntityList.stream().filter(t -> t.getSourceType().equals("ic_event")).map(i -> i.getSourceId()).collect(Collectors.toList()); |
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(icEventIds)) { |
|
|
|
Result<List<IcEventDTO>> eventInfoRes = govProjectOpenFeignClient.batchSelectById(icEventIds); |
|
|
|
if (eventInfoRes.success() && !org.springframework.util.CollectionUtils.isEmpty(eventInfoRes.getData())) { |
|
|
|
eventMap = eventInfoRes.getData().stream().collect(Collectors.toMap(IcEventDTO::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String,IssueEntity> issueMap=issueEntityList.stream().collect(Collectors.toMap(IssueEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
Map<String, IcEventDTO> finalEventMap = eventMap; |
|
|
|
resultList.forEach(vi -> { |
|
|
|
vi.setIssueSourceType(null != issueMap.get(vi.getIssueId()) ? issueMap.get(vi.getIssueId()).getSourceType() : StrConstant.EPMETY_STR); |
|
|
|
IcEventDTO event = finalEventMap.get(vi.getSourceId()); |
|
|
|
if (null != event) { |
|
|
|
IcEventComDTO eventComDTO = ConvertUtils.sourceToTarget(event, IcEventComDTO.class); |
|
|
|
eventComDTO.setIcEventId(event.getId()); |
|
|
|
vi.setIcEventInfo(eventComDTO); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|