|
|
|
@ -38,12 +38,9 @@ import com.xxl.job.core.log.XxlJobLogger;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.oss.model.BladeFile; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.core.tool.jackson.JsonUtil; |
|
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
|
import org.springblade.message.MessageConstants; |
|
|
|
|
import org.springblade.message.dto.BusinessMessageDTO; |
|
|
|
|
import org.springblade.message.fegin.IMessageClient; |
|
|
|
@ -53,7 +50,6 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.TransactionDefinition; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
@ -175,6 +171,7 @@ public class VideoTaskSchedule {
|
|
|
|
|
record.setUpdateUser(task.getUpdateUser()); |
|
|
|
|
record.setCurrentStatus("1"); |
|
|
|
|
CameraInfoEntity camera = this.getCameraByProIdAndConId(project.getProjectId(), content.getContentId()); |
|
|
|
|
log.info("【taskId:" + task.getId() + "】视频巡检任务执行,获取视频巡检结果,camera:" + Optional.of(camera).map(JsonUtil::toJson).orElse("null")); |
|
|
|
|
if (Func.isNotEmpty(camera)) { |
|
|
|
|
// 获取计划时间段内视频的告警信息设置是否异常
|
|
|
|
|
if (Func.isNotEmpty(camera.getEmCode())) { |
|
|
|
@ -244,17 +241,21 @@ public class VideoTaskSchedule {
|
|
|
|
|
|
|
|
|
|
private void pictureHandle(String url, Long contentId, EventRecordEntity record, TaskEntity task) { |
|
|
|
|
|
|
|
|
|
MultipartFile multipartFile = null; |
|
|
|
|
FileUtil.ByteArrayMultipartFile multipartFile = null; |
|
|
|
|
try { |
|
|
|
|
multipartFile = FileUtil.getMultipartFileFromUrl(url); |
|
|
|
|
multipartFile = FileUtil.getMultipartFileFromPureUrl(url); |
|
|
|
|
if (ObjectUtil.isEmpty(multipartFile.getContentType())) { |
|
|
|
|
multipartFile.setContentType(FileUtil.IMG); |
|
|
|
|
} |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.error("获取截图文件失败", e); |
|
|
|
|
throw new HzServiceException("获取截图文件失败"); |
|
|
|
|
} |
|
|
|
|
R<BladeFile> fileResponse = ossClient.putFile(multipartFile); |
|
|
|
|
if (fileResponse.isSuccess()) { |
|
|
|
|
record.setFileUrl(Optional.ofNullable(fileResponse.getData().getLink()).orElse(record.getFileUrl())); |
|
|
|
|
} |
|
|
|
|
// R<BladeFile> fileResponse = ossClient.putFile(multipartFile);
|
|
|
|
|
// log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null"));
|
|
|
|
|
// if (fileResponse.isSuccess()) {
|
|
|
|
|
// record.setFileUrl(Optional.ofNullable(fileResponse.getData().getLink()).orElse(record.getFileUrl()));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ContentEntity content = contentService.getById(contentId); |
|
|
|
|
if (StringUtil.isBlank(content.getMultiCheckTypeSon())) { |
|
|
|
@ -263,17 +264,12 @@ public class VideoTaskSchedule {
|
|
|
|
|
|
|
|
|
|
String[] typeArray = content.getMultiCheckTypeSon().split(","); |
|
|
|
|
List<String> checkTypeSonList = Arrays.asList(typeArray); |
|
|
|
|
String text = null; |
|
|
|
|
try { |
|
|
|
|
text = FileUtil.getBase64(multipartFile.getBytes()); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.error("转换截图文件内容失败", e); |
|
|
|
|
throw new HzServiceException("转换截图文件内容失败"); |
|
|
|
|
} |
|
|
|
|
BigModelAnalysisRequestDTO analysisRequest = new BigModelAnalysisRequestDTO(); |
|
|
|
|
analysisRequest.setCheckTypeSonList(checkTypeSonList); |
|
|
|
|
analysisRequest.setUrl(text); |
|
|
|
|
analysisRequest.setUrl(url); |
|
|
|
|
log.info("【taskId:{}}】视频巡检任务执行,大模型分析请求,{}", task.getId(), Optional.ofNullable(analysisRequest).map(JsonUtil::toJson).orElse("null")); |
|
|
|
|
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("大模型识别失败"); |
|
|
|
|
} |
|
|
|
|