Browse Source

fix:视频巡检取消异常抛出,记录对应记录

zhongwei
luyie 2 months ago
parent
commit
0b0519371d
  1. 11
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

11
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

@ -195,6 +195,8 @@ public class VideoTaskSchedule {
record.setFileUrl(picUrl);
record.setCurrentValue(picUrl);
pictureHandle(picUrl, content.getContentId(), record, task);
} else {
record.setCurrentValue("获取视频地址失败");
}
}
return record;
@ -257,7 +259,7 @@ public class VideoTaskSchedule {
}
} catch (IOException e) {
log.error("获取截图文件失败", e);
throw new HzServiceException("获取截图文件失败");
record.setCurrentValue("获取截图文件失败");
}
R<BladeFile> fileResponse = ossClient.putFileByNameAndTenantId("file", multipartFile, task.getTenantId());
log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null"));
@ -267,6 +269,7 @@ public class VideoTaskSchedule {
ContentEntity content = contentService.getById(contentId);
if (StringUtil.isBlank(content.getMultiCheckTypeSon())) {
record.setCurrentValue("没有找到巡检内容");
return;
}
@ -279,7 +282,9 @@ public class VideoTaskSchedule {
BigModelAnalysisResponseDTO analysisResponse = bigModelClient.analysis(analysisRequest);
log.info("【taskId:{}}】视频巡检任务执行,大模型分析结果,{}", task.getId(), Optional.ofNullable(analysisResponse).map(JsonUtil::toJson).orElse("null"));
if (!analysisResponse.getSuccess() || CollectionUtil.isEmpty(analysisResponse.getData())) {
throw new HzServiceException("大模型识别失败");
record.setCurrentValue("大模型分析失败");
log.error("【taskId:{}}】,返回消息 : {}" , task.getId(),Optional.ofNullable(analysisResponse).map(JsonUtil::toJson).orElse("null"));
return;
}
List<BigModelAnalysisResponseDTO.BigModelAnalysisResult> results = analysisResponse.getData();
StringBuilder stringBuilder = new StringBuilder();
@ -321,7 +326,7 @@ public class VideoTaskSchedule {
messageDTO.setContent(textBuilder.toString());
R booleanR = messageClient.sendAppAndWsMsgByUsers(messageDTO);
if (!booleanR.isSuccess()) {
throw new ServiceException("消息推送失败");
log.error("【taskId:{}}】,返回的消息为{}", task.getId(), booleanR.getMsg());
}
log.info("推送成功~");
}

Loading…
Cancel
Save