普通资源的npe问题

This commit is contained in:
wangliwen 2022-07-13 15:02:56 +08:00
parent 2ac2149cf8
commit 6e328843a8
2 changed files with 20 additions and 3 deletions

View File

@ -159,27 +159,41 @@ public class TAbilityApplicationController {
return new Result<TAbilityApplicationV2DTO>().ok(null);
}
TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class);
applicationDTOS.stream().limit(1l).forEach(dto -> {
if (StringUtils.isNotEmpty(dto.getCameraList())) {
if (applicationDTOS.size() > 1) {
tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + "" + applicationDTOS.size() + "个摄像头)");
} else {
tAbilityApplicationV2DTO.setSystem("视频资源申请:" + dto.getSystem());
}
}
});
Map<String, List<Map<String, Object>>> re = result.keySet().stream().map(index -> {
final List<TAbilityApplicationDTO> tAbilityApplicationDTOList = result.get(index);
if (tAbilityApplicationDTOList.isEmpty()) {
return null;
}
List<ResourceDTO> resourceDTOS = tAbilityApplicationDTOList.stream().filter(tAbilityApplicationDTO -> StringUtils.isEmpty(tAbilityApplicationDTO.getCameraList())) // 过滤非摄像头申请
.map(tAbilityApplicationDTO -> resourceService.get(Long.valueOf(tAbilityApplicationDTO.getResourceId()))).collect(Collectors.toList());
List<HistoryDetailDTO> taskHandleDetailInfo = activitiService.getTaskHandleDetailInfo(tAbilityApplicationDTOList.get(0).getInstanceId());
List<Object> camera;
ArrayList cameraList = new ArrayList();
System.err.println(tAbilityApplicationDTOList.get(0).getInstanceId());
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("instance_id", tAbilityApplicationDTOList.get(0).getInstanceId());
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
applicationEntities.forEach(index_ -> {
if (StringUtils.isEmpty(index_.getCameraList())) {
return;
}
List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index_.getCameraList().replaceAll("\"", ""));
if (!channelDto1s.isEmpty()) {
cameraList.add(channelDto1s.get(0));
}
});
System.err.println(JSON.toJSONString(cameraList));
camera = cameraList;
List<Object> finalCamera = camera;
Map<String, Object> resourceApplication = new HashMap<String, Object>() {
{
@ -193,7 +207,7 @@ public class TAbilityApplicationController {
}
};
return resourceApplication;
}).collect(Collectors.groupingBy(t -> {
}).filter(index -> index != null).collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept");
if (sysDeptDTO == null) {
return "未知部门"; // 无部门信息

View File

@ -51,6 +51,9 @@ public class TAbilityApplicationV2DTO implements Serializable {
@ApiModelProperty(value = "申请单标识(同一次的申请标识)")
private String applyFlag;
@ApiModelProperty(value = "审核状态:审核中,通过,不通过")
private String approveStatus;
// 以上为申请时公共信息
@ApiModelProperty(value = "资源申请情况(包含资源信息和流程流转)")