From d7fef91a4cbb702988dc820bcde82c166253ceec Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Sat, 07 Mar 2026 10:17:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
ard-route/src/main/java/com/ard/route/util/ToolUtils.java | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 42 insertions(+), 4 deletions(-)
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 2d34f6c..a08e8c5 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,5 +1,6 @@
package com.ard.route.util;
+import com.ard.route.domain.djuav.UavRouteReq;
import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -8,10 +9,6 @@
* 工具类
*/
public class ToolUtils {
-
- public static Boolean isLocal = false;
-
- public static String localFilePath = "KmzFile/kmz/";
public static String kmzPath = "kmz";
@@ -88,6 +85,9 @@
// 对象序列化为字节数组
public static byte[] serialize(Object obj) throws IOException {
+ if (obj == null) {
+ return null;
+ }
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos)) {
oos.writeObject(obj);
@@ -129,4 +129,42 @@
return Integer.valueOf(parts[1]);
}
+ /**
+ * 截取字符串
+ * 获取经纬度高度
+ */
+ public static Double getDoublePoint(String str,String type) {
+ if (str == null || str.isEmpty()) {
+ return null;
+ }
+ String[] parts = str.split(",");
+ if ("lon".equals(type)) {
+ return Double.parseDouble(parts[0].trim());
+ }
+ if ("lat".equals(type)){
+ return Double.parseDouble(parts[1].trim());
+ }
+ if ("alt".equals(type)){
+ return Double.parseDouble(parts[2].trim());
+ }
+ return null;
+ }
+
+ /**
+ * 获取航线类型方法
+ */
+ public static String templateTypeData(UavRouteReq uavRouteReq) {
+ if ("waypoint".equals(uavRouteReq.getTemplateType())){
+ return "0";
+ }
+ return "1";
+ }
+
+ /**
+ * 获取无人机类型方法
+ */
+ public static String droneTypeData(UavRouteReq uavRouteReq) {
+ return "0-" + uavRouteReq.getDroneType() + "-0";
+ }
+
}
--
Gitblit v1.9.3