|
@@ -5,6 +5,7 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"github.com/cloudwego/hertz/pkg/app"
|
|
|
+ "github.com/cloudwego/hertz/pkg/protocol/consts"
|
|
|
"io"
|
|
|
"net/http"
|
|
|
"os"
|
|
@@ -12,6 +13,7 @@ import (
|
|
|
"pji_desktop_http/biz/dal/mysql"
|
|
|
"pji_desktop_http/common/config"
|
|
|
"pji_desktop_http/common/config/c_log"
|
|
|
+ "pji_desktop_http/common/entity"
|
|
|
"pji_desktop_http/common/util"
|
|
|
)
|
|
|
|
|
@@ -86,18 +88,19 @@ func generateSimulationZipById(ctx context.Context, id string) (file string, tmp
|
|
|
}
|
|
|
c_log.GlobalLogger.Info("创建文件打包根目录:", baseDir)
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
simulationFileList := util.FilterBySuffixes(allFileList, config.SimulationFiltersuffixes...)
|
|
|
+ fmt.Println("simulationFileList", simulationFileList)
|
|
|
|
|
|
for _, file := range simulationFileList {
|
|
|
err = config.OssBucket.GetObjectToFile(file, filepath.Join(baseDir, filepath.Base(file)))
|
|
|
if err != nil {
|
|
|
- fmt.Println("Error downloading mapBuf file:", err)
|
|
|
+ fmt.Println("Error downloading file - data.zip, map.pgm, map.yaml:", err)
|
|
|
return "", "", err
|
|
|
}
|
|
|
}
|
|
|
- c_log.GlobalLogger.Info("下载data.zip文件到根目录 - 成功")
|
|
|
+ c_log.GlobalLogger.Info("下载data.zip, map.pgm, map.yaml文件到根目录 - 成功")
|
|
|
|
|
|
|
|
|
|
|
@@ -115,6 +118,19 @@ func generateSimulationZipById(ctx context.Context, id string) (file string, tmp
|
|
|
c_log.GlobalLogger.Info("下载world文件到根目录 - 成功")
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ rosField, err := util.GetRosFileById(id)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Error querying origin map's bag file:", err)
|
|
|
+ return "", "", err
|
|
|
+ }
|
|
|
+ err = config.OssBucket.GetObjectToFile(rosField, filepath.Join(baseDir, "origin_map.bag"))
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Error downloading origin map's bag file:", err)
|
|
|
+ return "", "", err
|
|
|
+ }
|
|
|
+ c_log.GlobalLogger.Info("下载origin_map.bag文件到根目录 - 成功")
|
|
|
+
|
|
|
|
|
|
zipPath := filepath.Join(tmpDir, "simulationFile-"+id+".zip")
|
|
|
zipFile, err := os.Create(zipPath)
|
|
@@ -138,3 +154,23 @@ func generateSimulationZipById(ctx context.Context, id string) (file string, tmp
|
|
|
|
|
|
return zipPath, tmpDir, nil
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func CheckDataFileStatus(ctx context.Context, c *app.RequestContext) {
|
|
|
+ sceneID := c.Query("id")
|
|
|
+ fmt.Println("id", sceneID)
|
|
|
+
|
|
|
+
|
|
|
+ allFileList, err := util.GetExactedMapFileById(sceneID)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ simulationFileList := util.FilterBySuffixes(allFileList, config.DataFiltersuffixes...)
|
|
|
+ if len(simulationFileList) == 0 {
|
|
|
+ c.JSON(consts.StatusOK, entity.HttpResult{Status: false, Code: "", Message: "data目录不存在"})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.JSON(consts.StatusOK, entity.HttpResult{Status: true, Code: "", Message: "data目录存在"})
|
|
|
+}
|