From 145e705946adf1e47512f2450e8bdd42662751e6 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Sat, 13 Dec 2025 09:38:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInfoServiceImpl.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 7 deletions(-)
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 905d321..522afd6 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
@@ -12,6 +12,7 @@
import com.ard.data.noflyzone.domain.Vertex;
import com.ard.data.noflyzone.service.IArdNoFlyZoneService;
import com.ard.data.noflyzone.utils.NoFlyZoneUtils;
+import com.ard.framework.web.service.TokenService;
import com.ard.oss.model.MinioUploadResult;
import com.ard.oss.service.impl.OssServiceContext;
import com.ard.ossdock.service.impl.OssDockServiceContext;
@@ -29,12 +30,15 @@
import com.ard.work.domain.dto.state.PointData;
import com.ard.work.domain.dto.wayline.*;
import com.ard.work.service.ITyService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import static com.ard.route.util.InitializationUtils.divided_6;
import static com.ard.route.util.ToolUtils.*;
import static com.ard.route.util.UavRouteReqUtils.fileConversionEntity;
@@ -46,6 +50,8 @@
*/
@Service
public class ArdRouteInfoServiceImpl implements IArdRouteInfoService {
+
+ private static final Logger log = LoggerFactory.getLogger(TokenService.class);
@Autowired
private ArdRouteInfoMapper ardRouteInfoMapper;
@@ -83,6 +89,14 @@
}
for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) {
routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt"));
+ // 判断无人机类型
+ if (ardRouteInfo.getUavRouteReq().getDroneType().equals(89)){
+ for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) {
+ for (PointActionReq action : actionGroupReq.getActions()) {
+ action.setZoom(divided_6(action.getZoom()));
+ }
+ }
+ }
}
return ardRouteInfo;
}
@@ -154,7 +168,6 @@
}
ardRouteInfo.setPath(kmzResult.getPath());
}
- ardRouteInfo.setReadOnly("0");
return ardRouteInfoMapper.updateArdRouteInfo(dataProcessing(ardRouteInfo));
}
@@ -238,13 +251,17 @@
ardRouteInfo.setType(templateTypeData(uavRouteReq));
ardRouteInfo.setAircraft(droneTypeData(uavRouteReq));
}
+
// 判断禁飞区
-// List<RoutePointReq> routePointList = ardRouteInfo.getUavRouteReq().getRoutePointList();
-// for (RoutePointReq routePointReq : routePointList) {
-// ArdNoflyDto ardNoflyDto = new ArdNoflyDto();
-// ardNoflyDto.setCurrent(new Vertex(routePointReq.getLongitude(), routePointReq.getLatitude()));
-// verifyNoFlyZone(ardNoflyDto);
-// }
+ try {
+ arrayWithinNoFlyZone(ardRouteInfo.getUavRouteReq().getRoutePointList());
+ } catch (ControlException e) {
+ // 返回包含禁飞区错误信息的特定结果
+ return MinioUploadResult.builder()
+ .originalFilename("禁飞区错误.航线航点在禁飞区!")
+ .build();
+ }
+
String url = ossService.upload("kmz",file);
String urlDock = ossDockService.upload("kmz",file);
ardRouteInfo.setName(file.getOriginalFilename());
@@ -259,11 +276,39 @@
.originalFilename(file.getOriginalFilename())
.build();
}catch (Exception e){
+ log.error("上传航线文件失败", e);
return null;
}
}
/**
+ * 判断一组数组,是否包含禁飞区
+ */
+ private void arrayWithinNoFlyZone(List<RoutePointReq> routePointList) {
+ if (routePointList == null || routePointList.isEmpty()) {
+ return;
+ }
+ // 检查第一个航点
+ ArdNoflyDto firstDto = new ArdNoflyDto();
+ firstDto.setTarget(new Vertex(
+ routePointList.get(0).getLongitude(),
+ routePointList.get(0).getLatitude()));
+ verifyNoFlyZone(firstDto);
+
+ // 检查后续航点及与前一个航点的线段
+ for (int i = 1; i < routePointList.size(); i++) {
+ ArdNoflyDto dto = new ArdNoflyDto();
+ dto.setCurrent(new Vertex(
+ routePointList.get(i - 1).getLongitude(),
+ routePointList.get(i - 1).getLatitude()));
+ dto.setTarget(new Vertex(
+ routePointList.get(i).getLongitude(),
+ routePointList.get(i).getLatitude()));
+ verifyNoFlyZone(dto);
+ }
+ }
+
+ /**
* 根据名称查询航线信息
*
* @param name 文件名称
--
Gitblit v1.9.3