From 0ab71d4f9154dc2a0306ea57ec08659f4e28e449 Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Mon, 16 Mar 2026 16:04:06 +0800
Subject: [PATCH] 1. 智云3.0业务优化,优化类型获取。
---
ard-route/src/main/java/com/ard/route/util/UavRouteReqUtils.java | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 150 insertions(+), 0 deletions(-)
diff --git a/ard-route/src/main/java/com/ard/route/util/UavRouteReqUtils.java b/ard-route/src/main/java/com/ard/route/util/UavRouteReqUtils.java
index 36bdc5c..b9d620e 100644
--- a/ard-route/src/main/java/com/ard/route/util/UavRouteReqUtils.java
+++ b/ard-route/src/main/java/com/ard/route/util/UavRouteReqUtils.java
@@ -5,7 +5,12 @@
import com.ard.route.domain.djuav.RoutePointReq;
import com.ard.route.domain.djuav.UavRouteReq;
import com.ard.route.domain.djuav.kml.*;
+import com.ard.route.domain.route.ArdRouteInfo;
import com.ard.route.domain.vo.KmzInfoVo;
+import com.ard.work.domain.dto.state.PointData;
+import com.ard.work.domain.dto.wayline.PlanLineData;
+import com.ard.work.domain.dto.wayline.PointAction;
+import com.ard.work.domain.dto.wayline.WayLineUploadDTO;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
@@ -126,4 +131,149 @@
return pointActionReq;
}
+ /**
+ * ArdRouteInfo实体转换,WayLineUploadDTO
+ */
+ public static WayLineUploadDTO buildWayLineUploadDTO(ArdRouteInfo ardRouteInfo){
+ WayLineUploadDTO wayLineUploadDTO = new WayLineUploadDTO();
+ String finishAction = ardRouteInfo.getUavRouteReq().getFinishAction(); //1
+ Double autoFlightSpeed = ardRouteInfo.getUavRouteReq().getAutoFlightSpeed(); //15
+ Double globalTransitionalSpeed = ardRouteInfo.getUavRouteReq().getGlobalTransitionalSpeed(); //8
+ String exitOnRcLostAction = ardRouteInfo.getUavRouteReq().getExitOnRcLostAction(); //0
+
+ PlanLineData planLineData = new PlanLineData();
+ if (finishAction != null){
+ planLineData.setLoseAction(0);
+ }
+ if (autoFlightSpeed != null){
+ planLineData.setAutoSpeed(8);
+ }
+ planLineData.setMaxSpeed(15);
+// if (globalTransitionalSpeed != null){
+// planLineData.setMaxSpeed(15);
+// }
+ if (exitOnRcLostAction != null){
+ planLineData.setFinishedAction(1);
+ }
+ planLineData.setHomeHeight(50);
+ planLineData.setInterests(new ArrayList<>());
+ planLineData.setIsSaveEnergyMode(0);
+ planLineData.setPoints(buildPointDataList(ardRouteInfo.getUavRouteReq()));
+
+ wayLineUploadDTO.setWayLineData(planLineData);
+ return wayLineUploadDTO;
+ }
+
+ public static List<PointData> buildPointDataList(UavRouteReq uavRouteReq){
+ List<PointData> pointDataList = new ArrayList<>();
+ for (RoutePointReq routePointReq : uavRouteReq.getRoutePointList()) {
+ PointData pointData = new PointData();
+
+ Integer routePointIndex = routePointReq.getRoutePointIndex();
+ if (routePointIndex != null){
+ pointData.setGroupIndex(routePointIndex);
+ }
+ Double height = routePointReq.getHeight();
+ if (height != null){
+ pointData.setHeight(height.floatValue());
+ }
+ Double longitude = routePointReq.getLongitude();
+ if (longitude != null){
+ pointData.setLng(longitude.floatValue());
+ }
+ Double latitude = routePointReq.getLatitude();
+ if (latitude != null){
+ pointData.setLat(latitude.floatValue());
+ }
+ Double speed = routePointReq.getSpeed();
+ if (speed != null){
+ pointData.setSpeed(speed.floatValue());
+ }
+ pointData.setDampingDistance(0);
+ pointData.setFlightPathMode(1);
+ pointData.setHeading(0);
+ pointData.setHeadingMode(0);
+ pointData.setInterestIndex(-1);
+ pointData.setSafeGohomeFlag(0);
+ pointData.setActions(buildPointActionList(routePointReq.getActionGroupList()));
+ pointDataList.add(pointData);
+
+ }
+ return pointDataList;
+ }
+
+ public static List<PointAction> buildPointActionList(List<ActionGroupReq> actionGroupList){
+ List<PointAction> pointActionList = new ArrayList<>();
+ for (ActionGroupReq actionGroupReq : actionGroupList) {
+ for (PointActionReq action : actionGroupReq.getActions()) {
+ PointAction pointAction = typeProcessing(action);
+ pointActionList.add(pointAction);
+ }
+ }
+ return pointActionList;
+ }
+
+ public static PointAction typeProcessing(PointActionReq pointActionReq){
+ PointAction pointAction = new PointAction();
+
+ if (pointActionReq.getZoom() != null){
+ pointAction.setType(1);
+ pointAction.setParam(pointActionReq.getZoom().floatValue());
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getTakePhotoType() != null){
+ pointAction.setType(2);
+ pointAction.setParam(1);
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getStartRecord() != null){
+ pointAction.setType(3);
+ pointAction.setParam(1);
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getStopRecord() != null){
+ pointAction.setType(4);
+ pointAction.setParam(1);
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getAircraftHeading() != null){
+ pointAction.setType(5);
+ pointAction.setParam(pointActionReq.getAircraftHeading().floatValue());
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getGimbalPitchRotateAngle() != null){
+ pointAction.setType(6);
+ pointAction.setParam(pointActionReq.getGimbalPitchRotateAngle().floatValue());
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getGimbalYawRotateAngle() != null){
+ pointAction.setType(7);
+ pointAction.setParam(pointActionReq.getGimbalYawRotateAngle().floatValue());
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ if (pointActionReq.getHoverTime() != null){
+ pointAction.setType(9);
+ pointAction.setParam(pointActionReq.getHoverTime().floatValue());
+ pointAction.setSpeakInfo("");
+ pointAction.setWaitTime(2);
+ }
+
+ return pointAction;
+
+ }
+
}
--
Gitblit v1.9.3