From e778750214d72d7aa9ce42d9e0b55dcc60fc41ca Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Tue, 25 Nov 2025 13:39:34 +0800
Subject: [PATCH] 1.增加行点总数字段。

---
 ard-route/src/main/java/com/ard/route/util/ToolUtils.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 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 3080eb8..d392f34 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 java.io.*;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 
@@ -7,6 +8,13 @@
  * 工具类
  */
 public class ToolUtils {
+
+    public static String kmzPath = "kmz";
+
+    /**
+     * XML 头部
+     */
+    public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 
     /**
      * 生成KMZ文件名称规则
@@ -74,4 +82,47 @@
         return "";
     }
 
+    // 对象序列化为字节数组
+    public static byte[] serialize(Object obj) throws IOException {
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+             ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+            oos.writeObject(obj);
+            return baos.toByteArray();
+        }
+    }
+
+    // 字节数组反序列化为对象
+    public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
+        try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
+             ObjectInputStream ois = new ObjectInputStream(bais)) {
+            return ois.readObject();
+        }
+    }
+
+    /**
+     * 截取字符串
+     * 参数: https://xxx.xxx.xxx.xxx:xxx/kmz/2025/11/08/文件名_20251108152249A001.kmz
+     */
+    public static String subStringMinioName(String url) {
+        return new File(url).getName();
+    }
+
+    /**
+     * 截取字符串
+     * minio里面文件夹路径名称
+     */
+    public static String subStringMinioUrlName(String url) {
+        int kmzIndex = url.indexOf("/kmz/");
+        return url.substring(kmzIndex + 5); // +5 是为了跳过 "/kmz/"
+    }
+
+    /**
+     * 截取字符串
+     * 参数: "0-89-0"
+     */
+    public static Integer subStringDroneType(String str) {
+        String[] parts = str.split("-");
+        return Integer.valueOf(parts[1]);
+    }
+
 }

--
Gitblit v1.9.3