|
|
|
@ -1087,58 +1087,58 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
IcEventListResultDTO resultDTO = new IcEventListResultDTO(); |
|
|
|
//1.获取事件基本信息
|
|
|
|
List<IcEventListResultDTO> list = baseDao.icEventList(formDTO); |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
resultDTO = list.get(0); |
|
|
|
//查询网格名称(组织-网格)
|
|
|
|
List<String> gridIds = list.stream().map(IcEventListResultDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); |
|
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); |
|
|
|
|
|
|
|
//事件管理字典表数据
|
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
|
|
|
|
//封装数据
|
|
|
|
if (gridInfoMap.containsKey(resultDTO.getGridId())) { |
|
|
|
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(resultDTO.getSourceType())) { |
|
|
|
resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType())); |
|
|
|
} |
|
|
|
//每个事件对应的图片数据
|
|
|
|
if(!CollectionUtils.isEmpty(resultDTO.getAttachmentList())){ |
|
|
|
List<String> imageList = new ArrayList<>(); |
|
|
|
List<IcEventListResultDTO.Attachment> voiceList = new ArrayList<>(); |
|
|
|
resultDTO.getAttachmentList().forEach(file -> { |
|
|
|
if ("image".equals(file.getType())) { |
|
|
|
imageList.add(file.getUrl()); |
|
|
|
} else if ("voice".equals(file.getType())) { |
|
|
|
voiceList.add(file); |
|
|
|
} |
|
|
|
}); |
|
|
|
resultDTO.setImageList(imageList); |
|
|
|
resultDTO.setVoiceList(voiceList); |
|
|
|
} |
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"事件不存在","事件已删除"); |
|
|
|
} |
|
|
|
resultDTO = list.get(0); |
|
|
|
//查询网格名称(组织-网格)
|
|
|
|
List<String> gridIds = list.stream().map(IcEventListResultDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); |
|
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); |
|
|
|
|
|
|
|
//事件管理字典表数据
|
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
|
|
|
|
//封装数据
|
|
|
|
if (gridInfoMap.containsKey(resultDTO.getGridId())) { |
|
|
|
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(resultDTO.getSourceType())) { |
|
|
|
resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType())); |
|
|
|
} |
|
|
|
//每个事件对应的图片数据
|
|
|
|
if(!CollectionUtils.isEmpty(resultDTO.getAttachmentList())){ |
|
|
|
List<String> imageList = new ArrayList<>(); |
|
|
|
List<IcEventListResultDTO.Attachment> voiceList = new ArrayList<>(); |
|
|
|
resultDTO.getAttachmentList().forEach(file -> { |
|
|
|
if ("image".equals(file.getType())) { |
|
|
|
imageList.add(file.getUrl()); |
|
|
|
} else if ("voice".equals(file.getType())) { |
|
|
|
voiceList.add(file); |
|
|
|
} |
|
|
|
}); |
|
|
|
resultDTO.setImageList(imageList); |
|
|
|
resultDTO.setVoiceList(voiceList); |
|
|
|
} |
|
|
|
|
|
|
|
//分类信息
|
|
|
|
if(StringUtils.isNotBlank(resultDTO.getCategoryId())){ |
|
|
|
List<String> categoryList = new ArrayList<>(); |
|
|
|
categoryList.add(resultDTO.getCategoryId()); |
|
|
|
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); |
|
|
|
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ |
|
|
|
if (ca.getId().equals(resultDTO.getCategoryId())) { |
|
|
|
resultDTO.setParentCategoryId(ca.getPid()); |
|
|
|
resultDTO.setCategoryId(ca.getId()); |
|
|
|
resultDTO.setParentCategoryCode(ca.getParentCategoryCode()); |
|
|
|
resultDTO.setCategoryCode(ca.getCategoryCode()); |
|
|
|
resultDTO.setParentCategoryName(ca.getParentCategoryName()); |
|
|
|
resultDTO.setCategoryName(ca.getCategoryName()); |
|
|
|
} |
|
|
|
//分类信息
|
|
|
|
if(StringUtils.isNotBlank(resultDTO.getCategoryId())){ |
|
|
|
List<String> categoryList = new ArrayList<>(); |
|
|
|
categoryList.add(resultDTO.getCategoryId()); |
|
|
|
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); |
|
|
|
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ |
|
|
|
if (ca.getId().equals(resultDTO.getCategoryId())) { |
|
|
|
resultDTO.setParentCategoryId(ca.getPid()); |
|
|
|
resultDTO.setCategoryId(ca.getId()); |
|
|
|
resultDTO.setParentCategoryCode(ca.getParentCategoryCode()); |
|
|
|
resultDTO.setCategoryCode(ca.getCategoryCode()); |
|
|
|
resultDTO.setParentCategoryName(ca.getParentCategoryName()); |
|
|
|
resultDTO.setCategoryName(ca.getCategoryName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
|