From 7653e39b0c809b7f31aed1eaaa42e1662755dfdb Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Sat, 07 Mar 2026 10:33:11 +0800
Subject: [PATCH] 1. 优化精细化巡检业务。
---
ard-inspection/src/main/resources/mapper/ArdPointCloudMapper.xml | 37 +++++++++
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteCloud.java | 18 ++++
ard-route/src/main/java/com/ard/route/mapper/ArdRouteCloudMapper.java | 43 ++++++++++
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInfo.java | 7 +
ard-inspection/src/main/java/com/ard/inspection/mapper/ArdPointCloudMapper.java | 5 +
ard-route/pom.xml | 4 +
ard-route/src/main/java/com/ard/route/util/ToolUtils.java | 9 ++
ard-route/src/main/resources/mapper/ArdRouteCloudMapper.xml | 41 ++++++++++
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java | 41 +++++++++
9 files changed, 202 insertions(+), 3 deletions(-)
diff --git a/ard-inspection/src/main/java/com/ard/inspection/mapper/ArdPointCloudMapper.java b/ard-inspection/src/main/java/com/ard/inspection/mapper/ArdPointCloudMapper.java
index 19115d6..ba1f5a2 100644
--- a/ard-inspection/src/main/java/com/ard/inspection/mapper/ArdPointCloudMapper.java
+++ b/ard-inspection/src/main/java/com/ard/inspection/mapper/ArdPointCloudMapper.java
@@ -61,4 +61,9 @@
public ArdPointCloud selectArdPointCloudByFileName(String fileName);
+// /**
+// * 根据航线ID,查询航线名称
+// */
+// public int selectCloudIdByRouteName(ArdPointCloud ardPointCloud);
+
}
diff --git a/ard-inspection/src/main/resources/mapper/ArdPointCloudMapper.xml b/ard-inspection/src/main/resources/mapper/ArdPointCloudMapper.xml
index 236313f..43c6a84 100644
--- a/ard-inspection/src/main/resources/mapper/ArdPointCloudMapper.xml
+++ b/ard-inspection/src/main/resources/mapper/ArdPointCloudMapper.xml
@@ -20,6 +20,20 @@
<result property="filePath" column="file_path" />
</resultMap>
+<!-- <resultMap type="ArdPointCloud" id="ArdPointCloudRouteNameResult">-->
+<!-- <result property="id" column="id" />-->
+<!-- <result property="cloudName" column="cloud_name" />-->
+<!-- <result property="fileName" column="file_name" />-->
+<!-- <result property="folderName" column="folder_name" />-->
+<!-- <result property="fileSize" column="file_size" />-->
+<!-- <result property="associatedState" column="associated_state" />-->
+<!-- <result property="routeId" column="route_id" />-->
+<!-- <result property="groupId" column="group_id" />-->
+<!-- <result property="filePath" column="file_path" />-->
+<!-- <result property="filePath" column="file_path" />-->
+<!-- <result property="filePath" column="file_path" />-->
+<!-- </resultMap>-->
+
<sql id="selectArdPointCloudVo">
select id,
cloud_name,
@@ -35,6 +49,24 @@
update_time,
file_path
from ard_point_cloud
+ </sql>
+
+ <sql id="selectArdPointCloudRouteName">
+ SELECT
+ a.id,
+ a.cloud_name,
+ a.file_name,
+ a.folder_name,
+ a.file_size,
+ a.associated_state,
+ a.route_id,
+ a.group_id,
+ a.file_path,
+ c.id,
+ c.name
+ FROM ard_point_cloud a
+ LEFT JOIN ard_route_cloud b ON a.id = b.cloud_id
+ LEFT JOIN ard_route_info c ON b.route_id = c.id
</sql>
<select id="selectArdPointCloudList" parameterType="ArdPointCloud" resultMap="ArdPointCloudResult">
@@ -130,4 +162,9 @@
where file_name = #{fileName}
</select>
+<!-- <select id="selectCloudIdByRouteName" parameterType="String" resultMap="ArdPointCloudResult">-->
+<!-- <include refid="selectArdPointCloudRouteName"/>-->
+<!-- where file_name = #{fileName}-->
+<!-- </select>-->
+
</mapper>
\ No newline at end of file
diff --git a/ard-route/pom.xml b/ard-route/pom.xml
index fad44dd..0aafa2a 100644
--- a/ard-route/pom.xml
+++ b/ard-route/pom.xml
@@ -64,6 +64,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.ard</groupId>
+ <artifactId>ard-inspection</artifactId>
+ </dependency>
</dependencies>
diff --git a/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteCloud.java b/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteCloud.java
new file mode 100644
index 0000000..fad0410
--- /dev/null
+++ b/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteCloud.java
@@ -0,0 +1,18 @@
+package com.ard.route.domain.route;
+
+import lombok.Data;
+
+@Data
+public class ArdRouteCloud {
+
+ /** 航线ID */
+ private String routeId;
+
+ /** 点云ID */
+ private String cloudId;
+
+ private A a;
+
+ private B b;
+
+}
diff --git a/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInfo.java b/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInfo.java
index 50ce0f9..24ad7b9 100644
--- a/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInfo.java
+++ b/ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInfo.java
@@ -1,11 +1,13 @@
package com.ard.route.domain.route;
import com.ard.common.core.domain.BaseEntity;
+import com.ard.inspection.domain.ArdPointCloud;
import com.ard.route.domain.djuav.UavRouteReq;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
+import java.util.List;
/**
* 航线(kmz)对象 ard_route_info
@@ -72,6 +74,9 @@
/** 航线数据 */
private byte[] routeData;
+ /** 点云数据 */
+ private byte[] cloudData;
+
/** 行点总数 */
private Integer pointCount;
@@ -79,6 +84,6 @@
private String missionId;
/** 点云数据 */
- //private List<>
+ private List<ArdPointCloud> ardPointCloudList;
}
diff --git a/ard-route/src/main/java/com/ard/route/mapper/ArdRouteCloudMapper.java b/ard-route/src/main/java/com/ard/route/mapper/ArdRouteCloudMapper.java
new file mode 100644
index 0000000..fdcdbea
--- /dev/null
+++ b/ard-route/src/main/java/com/ard/route/mapper/ArdRouteCloudMapper.java
@@ -0,0 +1,43 @@
+package com.ard.route.mapper;
+
+import com.ard.route.domain.route.ArdRouteCloud;
+import java.util.List;
+
+/**
+ * @author xia
+ */
+public interface ArdRouteCloudMapper {
+
+ /**
+ * 通过航线ID删除关联
+ *
+ * @param routeId 航线ID
+ * @return 结果
+ */
+ public int deleteRouteCloudByRouteId(String routeId);
+
+ /**
+ * 批量删除关联信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int selectRouteCloudByCloudId(String[] ids);
+
+ /**
+ * 查询点云ID使用数量
+ *
+ * @param cloudId 点云ID
+ * @return 结果
+ */
+ public int deleteRouteCloud(String cloudId);
+
+ /**
+ * 批量新增
+ *
+ * @param routeCloudList List
+ * @return 结果
+ */
+ public int batchRouteCloud(List<ArdRouteCloud> routeCloudList);
+
+}
diff --git a/ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java b/ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java
index 0dd708b..933fe99 100644
--- a/ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java
+++ b/ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java
@@ -1,6 +1,7 @@
package com.ard.route.service.impl;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import com.ard.common.exception.ControlException;
@@ -13,6 +14,8 @@
import com.ard.data.noflyzone.service.IArdNoFlyZoneService;
import com.ard.data.noflyzone.utils.NoFlyZoneUtils;
import com.ard.framework.web.service.TokenService;
+import com.ard.inspection.domain.ArdPointCloud;
+import com.ard.inspection.mapper.ArdPointCloudMapper;
import com.ard.oss.model.MinioUploadResult;
import com.ard.oss.service.impl.OssServiceContext;
import com.ard.route.domain.djuav.ActionGroupReq;
@@ -20,9 +23,11 @@
import com.ard.route.domain.djuav.RoutePointReq;
import com.ard.route.domain.djuav.UavRouteReq;
import com.ard.route.domain.dto.ArdNoflyDto;
+import com.ard.route.domain.route.ArdRouteCloud;
import com.ard.route.domain.route.ArdRouteInfo;
import com.ard.route.domain.route.ArdRouteMission;
import com.ard.route.domain.vo.KmzResultVo;
+import com.ard.route.mapper.ArdRouteCloudMapper;
import com.ard.route.mapper.ArdRouteInfoMapper;
import com.ard.route.mapper.ArdRouteMissionMapper;
import com.ard.route.service.IArdRouteInfoService;
@@ -38,8 +43,6 @@
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
-
-import static com.ard.common.utils.SecurityUtils.getUserId;
import static com.ard.route.enums.kml.DroneEnumValueEnums.M350_RTK;
import static com.ard.route.util.InitializationUtils.divided_23;
import static com.ard.route.util.ToolUtils.*;
@@ -69,6 +72,12 @@
@Autowired
private ArdRouteMissionMapper ardRouteMissionMapper;
+ @Autowired
+ private ArdPointCloudMapper ardPointCloudMapper;
+
+ @Autowired
+ private ArdRouteCloudMapper ardRouteCloudMapper;
+
@Resource
private IArdNoFlyZoneService ardNoFlyZoneService;
@@ -88,6 +97,7 @@
if (ardRouteInfo != null) {
if (ardRouteInfo.getRouteData() != null){
ardRouteInfo.setUavRouteReq((UavRouteReq) deserialize(ardRouteInfo.getRouteData()));
+ ardRouteInfo.setArdPointCloudList(deserializeLs(ardRouteInfo.getCloudData()));
}
}
} catch (IOException | ClassNotFoundException e) {
@@ -153,8 +163,29 @@
zoomProcessing(ardRouteInfo);
ardRouteInfo.setPath(kmzResult.getPath());
ardRouteInfo.setReadOnly("0");
+ insertRoutePointCloud(ardRouteInfo);
ardRouteInfoMapper.insertArdRouteInfo(dataProcessing(ardRouteInfo));
return kmzResult.getPath();
+ }
+
+ /**
+ * 新增航信信息时,修改点云数据
+ * 同时增加航线与点云关联关系表数据
+ */
+ private void insertRoutePointCloud(ArdRouteInfo ardRouteInfo) {
+ List<ArdRouteCloud> cloudList = new ArrayList<>();
+ if (ardRouteInfo.getArdPointCloudList() != null){
+ for (ArdPointCloud cloudId : ardRouteInfo.getArdPointCloudList()) {
+ ArdRouteCloud cloud = new ArdRouteCloud();
+ cloud.setRouteId(ardRouteInfo.getId());
+ cloud.setCloudId(cloudId.getId());
+ cloudId.setAssociatedState("1");
+ cloudList.add(cloud);
+ cloudId.setUpdateTime(DateUtils.getNowDate());
+ ardPointCloudMapper.updateArdPointCloud(cloudId);
+ }
+ ardRouteCloudMapper.batchRouteCloud(cloudList);
+ }
}
/**
@@ -255,14 +286,19 @@
private ArdRouteInfo dataProcessing(ArdRouteInfo ardRouteInfo) {
// 航线数据
byte[] routeData = null;
+ byte[] cloudData = null;
try {
if (ardRouteInfo.getUavRouteReq() != null){
routeData = serialize(ardRouteInfo.getUavRouteReq());
+ }
+ if (ardRouteInfo.getArdPointCloudList() != null){
+ cloudData = serialize(ardRouteInfo.getArdPointCloudList());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
ardRouteInfo.setRouteData(routeData);
+ ardRouteInfo.setCloudData(cloudData);
ardRouteInfo.setPointCount(getPointCount(ardRouteInfo));
return ardRouteInfo;
}
@@ -419,6 +455,7 @@
ArdRouteInfo route = ardRouteInfoMapper.selectArdRouteInfoById(id);
try {
route.setUavRouteReq((UavRouteReq) deserialize(route.getRouteData()));
+ route.setArdPointCloudList(deserializeLs(route.getRouteData()));
} catch (IOException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
diff --git a/ard-route/src/main/java/com/ard/route/util/ToolUtils.java b/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
index a08e8c5..dcab57b 100644
--- a/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
+++ b/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
@@ -1,9 +1,11 @@
package com.ard.route.util;
+import com.ard.inspection.domain.ArdPointCloud;
import com.ard.route.domain.djuav.UavRouteReq;
import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.List;
/**
* 工具类
@@ -103,6 +105,13 @@
}
}
+ public static List<ArdPointCloud> deserializeLs(byte[] data) throws IOException, ClassNotFoundException {
+ try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ ObjectInputStream ois = new ObjectInputStream(bais)) {
+ return (List<ArdPointCloud>) ois.readObject();
+ }
+ }
+
/**
* 截取字符串
* 参数: https://xxx.xxx.xxx.xxx:xxx/kmz/2025/11/08/文件名_20251108152249A001.kmz
diff --git a/ard-route/src/main/resources/mapper/ArdRouteCloudMapper.xml b/ard-route/src/main/resources/mapper/ArdRouteCloudMapper.xml
new file mode 100644
index 0000000..d84ca67
--- /dev/null
+++ b/ard-route/src/main/resources/mapper/ArdRouteCloudMapper.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ard.route.mapper.ArdRouteCloudMapper">
+
+ <resultMap type="ArdRouteCloud" id="ArdRouteCloudResult">
+ <result property="routeId" column="route_id" />
+ <result property="cloudId" column="cloud_id" />
+ </resultMap>
+
+ <delete id="deleteRouteCloudByRouteId" parameterType="String">
+ delete from ard_route_cloud where route_id=#{routeId}
+ </delete>
+
+ <select id="selectRouteCloudByCloudId" resultType="Integer">
+ select count(1) from ard_route_cloud where cloud_id=#{cloudId}
+ </select>
+
+ <delete id="deleteRouteCloud" parameterType="String">
+ delete from ard_route_cloud where route_id in
+ <foreach collection="array" item="routeId" open="(" separator="," close=")">
+ #{routeId}
+ </foreach>
+ </delete>
+
+ <insert id="batchRouteCloud">
+ insert into ard_route_cloud(route_id, cloud_id) values
+ <foreach item="item" index="index" collection="list" separator=",">
+ (#{item.routeId},#{item.cloudId})
+ </foreach>
+ </insert>
+
+ <insert id="insert">
+ insert into ard_route_cloud(route_id, cloud_id) values
+ <foreach item="item" index="index" collection="list" separator=",">
+ (#{item.routeId},#{item.cloudId})
+ </foreach>
+ </insert>
+
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3