避免bug报错

This commit is contained in:
2025-02-16 14:51:49 +08:00
parent cfb9392068
commit ec4df2eb50
5 changed files with 54 additions and 16 deletions

View File

@@ -252,6 +252,7 @@ public class TaskTaskServiceImpl implements TaskService {
DeviceEntity device = deviceRepository.getDevice(item.getDeviceId());
return Integer.valueOf(1).equals(device.getStatus());
})
.filter(item -> item.getDeviceId() != null) // 添加对 deviceId 为 null 的检查
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
if (sourcesMap.isEmpty()) {
// 主动禁止没有视频源视频生成
@@ -437,14 +438,17 @@ public class TaskTaskServiceImpl implements TaskService {
return;
}
List<SourceEntity> videoSourceList = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
if (videoSourceList == null || videoSourceList.isEmpty()) {
log.info("task callback: 没有视频源");
return;
}
Map<String, List<SourceEntity>> sourcesMap = videoSourceList.stream()
.filter(Objects::nonNull)
.filter(item -> Objects.nonNull(item.getVideoUrl()))
.peek(item -> item.setUrl(item.getVideoUrl()))
.filter(item -> {
DeviceEntity device = deviceRepository.getDevice(item.getDeviceId());
return Integer.valueOf(1).equals(device.getStatus());
})
.filter(item -> item.getDeviceId() != null) // 添加对 deviceId 为 null 的检查
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
if (sourcesMap.isEmpty()) {
// 主动禁止没有视频源视频生成