From 1dc6dd42706eb2a302c585b23541088459e58652 Mon Sep 17 00:00:00 2001
From: shench3 <shench3@xiaopeng.com>
Date: 星期六, 07 三月 2026 21:01:25 +0800
Subject: [PATCH] feat: 补充上传版本pb文件逻辑

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/AdcOssHandleServiceImpl.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/AdcOssHandleServiceImpl.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/AdcOssHandleServiceImpl.java
index 444e439..fc810ff 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/AdcOssHandleServiceImpl.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/AdcOssHandleServiceImpl.java
@@ -3,6 +3,7 @@
 import com.xiaopeng.map.config.VinSaltProperties;
 import com.xiaopeng.map.service.AdcOssHandleService;
 import com.xiaopeng.map.service.RobotaxiOssService;
+import com.xiaopeng.map.utils.MapAreaVersionProtoWriter;
 import com.xiaopeng.map.utils.VehicleCodec;
 import com.xiaopeng.map.utils.XngpAreaRTreeFbsUtil;
 import lombok.RequiredArgsConstructor;
@@ -12,8 +13,7 @@
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -24,8 +24,6 @@
 @RequiredArgsConstructor
 @ConditionalOnBean(RobotaxiOssService.class)
 public class AdcOssHandleServiceImpl implements AdcOssHandleService {
-
-    private static final String FILE_NAME_FORMAT = "yyyyMMddHHmmss";
 
     private final RobotaxiOssService robotaxiOssService;
     private final VinSaltProperties vinSaltProperties;
@@ -41,9 +39,18 @@
             throw new IllegalStateException("Failed to build RTree fbs from points");
         }
 
-        String fileName = new SimpleDateFormat(FILE_NAME_FORMAT).format(new Date()) + "_xngp_area_data.bin";
+        int version = (int) (System.currentTimeMillis() / 1000);
+        String binFileName = version + "_xngp_area_data.bin";
 
-        String objectKey = robotaxiOssService.uploadOddLayerFile(fbsBytes, fileName, areaCode, vehicleUuid);
+        String objectKey = robotaxiOssService.uploadOddLayerFile(fbsBytes, binFileName, areaCode, vehicleUuid);
+
+        try {
+            byte[] pbBytes = MapAreaVersionProtoWriter.toByteArray(version, fbsBytes.length);
+            robotaxiOssService.uploadOddLayerFile(pbBytes, "xngp_area_version.pb", areaCode, vehicleUuid);
+        } catch (IOException e) {
+            throw new IllegalStateException("Failed to build or upload xngp_area_version.pb", e);
+        }
+
         log.debug("AdcOssHandle uploaded ODD layer file, areaId={}, areaCode={}, objectKey={}", areaId, areaCode, objectKey);
         return objectKey;
     }

--
Gitblit v1.7.1