From bcab5f190fc0cf10720a30bd03efc966de5e02aa Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Mon, 26 Jan 2026 17:11:39 +0800
Subject: [PATCH] 附件表结构优化
---
drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java | 63 ++-----------------------------
1 files changed, 4 insertions(+), 59 deletions(-)
diff --git a/drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java b/drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java
index 37c5f53..b6f4ee4 100644
--- a/drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java
+++ b/drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java
@@ -52,6 +52,7 @@
import org.sxkj.resource.model.FileMetadataDTO;
import org.sxkj.resource.model.MinioPojo;
import org.sxkj.resource.model.PositionDTO;
+import org.sxkj.resource.param.AttachPageParam;
import org.sxkj.resource.service.IAttachService;
import org.sxkj.resource.util.MinioFileDownloader;
import org.sxkj.resource.vo.*;
@@ -104,15 +105,8 @@
@Override
- public IPage<AttachVO> selectAttachPage(IPage<AttachVO> page, AttachVO attach) {
- Integer resultType = attach.getResultType();
- List<AttachVO> attachVOS = Collections.emptyList();
- if (Objects.nonNull(resultType) && Attach.RESULT_TYPE_AI.equals(resultType)) {
- attachVOS = baseMapper.selectEventAttachPage(page, attach);
- } else {
- attachVOS = baseMapper.selectAttachPage(page, attach);
- }
-
+ public IPage<AttachVO> selectAttachPage(IPage<AttachVO> page, AttachPageParam attach) {
+ List<AttachVO> attachVOS = baseMapper.selectAttachPage(page, attach);
return page.setRecords(attachVOS);
}
@@ -445,36 +439,6 @@
@Override
- public List<AnalysisAttachVo> contrastiveAnalysis(Long id) {
- Attach attach = getById(id);
- ValidUtil.assertNull(attach, "数据不能为空!");
- ValidUtil.assertNull(attach.getMetadata(), "媒体数据不存在经纬度!");
- FileMetadataDTO metadata = JSON.parseObject(attach.getMetadata().toString(), FileMetadataDTO.class);
- PositionDTO shootPosition = metadata.getShootPosition();
- ValidUtil.assertNull(shootPosition, "媒体数据不存在经纬度!");
- Double lat = attach.getLatitude() != null && attach.getLatitude() > 0 ? attach.getLatitude() : shootPosition.getLat();
- Double lng = attach.getLongitude() != null && attach.getLongitude() > 0 ? attach.getLongitude() : shootPosition.getLng();
- Date createTime = attach.getCreateTime();
- // 转换为 LocalDateTime(保留时间部分)
- LocalDateTime ldt = createTime.toInstant()
- .atZone(ZoneId.systemDefault())
- .toLocalDateTime();
-// 计算前后两个月
- LocalDateTime twoMonthsBefore = ldt.minusMonths(2); // 前2个月
- LocalDateTime twoMonthsAfter = ldt.plusMonths(2); // 后2个月
-
-// 如果需要转回 Date 类型
- Date beforeDate = Date.from(twoMonthsBefore.atZone(ZoneId.systemDefault()).toInstant());
- Date afterDate = Date.from(twoMonthsAfter.atZone(ZoneId.systemDefault()).toInstant());
- List<AnalysisAttachVo> pointAttachList = baseMapper.findPointAttach(lat, lng, beforeDate, afterDate, id);
- return Streams.toList(pointAttachList, entity -> {
- entity.setIsCheck(entity.getId().equals(id));
- return entity;
- });
-
- }
-
- @Override
public AttachInfoVO getAttachInfo(Long id) {
AttachInfoVO attachVO = baseMapper.getAttachInfo(id);
if (attachVO != null) {
@@ -484,16 +448,8 @@
PositionDTO shootPosition = metadata.getShootPosition();
ValidUtil.assertNull(shootPosition, "媒体数据不存在经纬度!");
Double lat = shootPosition.getLat();
- attachVO.setLatitude(lat);
Double lng = shootPosition.getLng();
- attachVO.setLongitude(lng);
}
- // 文件类型,通过文件名称有_T,则是红外,包含_W|_V 则是可见光
-// if (attachVO.getName().contains("_T")) {
-// attachVO.setPhotoType("ir");
-// } else if (attachVO.getName().contains("_W") || attachVO.getName().contains("_V")) {
-// attachVO.setPhotoType("visible");
-// }
}
return attachVO;
}
@@ -507,19 +463,8 @@
FileMetadataDTO metadata = JSON.parseObject(item.getMetadata().toString(), FileMetadataDTO.class);
PositionDTO shootPosition = metadata.getShootPosition();
Double lat = shootPosition.getLat();
- item.setLatitude(lat);
Double lng = shootPosition.getLng();
- item.setLongitude(lng);
}
- });
- // 把result_type=0和把result_type=2数据进行用经度和纬度对比,如果有相同的,则把result_type=0的数据删除
- boolean removed = attachVO.removeIf(item -> {
- return item.getResultType() == 0 &&
- attachVO.stream().anyMatch(
- item1 -> item1.getResultType() == 2
- && item1.getLatitude().equals(item.getLatitude())
- && item1.getLongitude().equals(item.getLongitude())
- );
});
return attachVO;
}
@@ -577,7 +522,7 @@
return baseMapper.selectCount(Wrappers.<Attach>lambdaQuery()
.eq(Attach::getIsGenerateAiImg, 0)
.eq(Attach::getIsDeleted, 0)
- .eq(Attach::getWayLineJobId, jobId).in(Attach::getResultType, AttachResultTypeEnum.getTheAttachmentType()));
+ .eq(Attach::getPatrolTaskId, jobId).in(Attach::getResultType, AttachResultTypeEnum.getTheAttachmentType()));
}
@Override
--
Gitblit v1.9.3