192.168.9.165 1 mēnesi atpakaļ
vecāks
revīzija
7846e5b052

+ 1 - 1
src/main/java/com/fdkankan/scene/SceneApplication.java

@@ -48,7 +48,7 @@ public class SceneApplication {
             writer.write("1");
             writer.flush();
         }
-        String setting = fdkkLaserConfig.getBinPath() + File.separator + "setting.json";
+        String setting = fdkkLaserConfig.getSettingJson();
         String data = FileUtil.readString(setting, "UTF-8");
         JSONObject config = JSONObject.parseObject(data);
         Integer javaPort = config.getInteger("javaPort");

+ 10 - 0
src/main/java/com/fdkankan/scene/config/FdkkLaserConfig.java

@@ -2,6 +2,7 @@ package com.fdkankan.scene.config;
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import lombok.Data;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
@@ -60,6 +61,7 @@ public class FdkkLaserConfig {
     public Integer laserPort;
 
     public String buildCallPath;
+    public String settingJson;
 
     public Integer getLaserPort() {
         return laserPort;
@@ -72,6 +74,14 @@ public class FdkkLaserConfig {
     @PostConstruct
     private void init() {
         FileUtil.mkdir(FdkkLaserConfig.profile);
+        if (StrUtil.isNotEmpty(settingJson)){
+            String data = FileUtil.readString(settingJson, "UTF-8");
+            JSONObject config = JSONObject.parseObject(data);
+            this.setBinPath(config.getString("binPath"));
+            this.setProfile(config.getString("profilePath"));
+            this.setBuildModelPath(config.getString("buildModelPath"));
+            this.setBuildCallPath(config.getString("buildCallPath"));
+        }
     }
 
 

+ 1 - 1
src/main/java/com/fdkankan/scene/service/impl/LaserServiceImpl.java

@@ -55,7 +55,7 @@ public class LaserServiceImpl implements ILaserService {
 
     @PostConstruct
     public void initAddress(){
-        String setting = fdkkLaserConfig.getBinPath() + File.separator + "setting.json";
+        String setting = fdkkLaserConfig.getSettingJson();
         String data = FileUtil.readUtf8String(setting);
         JSONObject config = JSONObject.parseObject(data);
         this.port = config.getIntValue("javaPort");

+ 3 - 3
src/main/java/com/fdkankan/scene/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -189,7 +189,7 @@ public class SceneDownloadHandlerServiceImpl {
 
             Set<String> cacheKeys = new ConcurrentHashSet<>();
 
-            Map<String, List<String>> allFiles = this.getAllFiles(num, v4localPath, bucket);
+            Map<String, List<String>> allFiles = this.getAllFiles(num, FdkkLaserConfig.getProfile("")+v4localPath, bucket);
             List<String> ossFilePaths = allFiles.get("ossFilePaths");
             List<String> v4localFilePaths = allFiles.get("localFilePaths");
 
@@ -198,7 +198,7 @@ public class SceneDownloadHandlerServiceImpl {
             AtomicInteger count = new AtomicInteger(0);
 
             //定义压缩包
-            zipPath = String.format(this.zipLocalFormat, num);
+            zipPath = String.format(FdkkLaserConfig.getProfile("")+this.zipLocalFormat, num);
             File zipFile = new File(zipPath);
             if(!zipFile.getParentFile().exists()){
                 zipFile.getParentFile().mkdirs();
@@ -376,7 +376,7 @@ public class SceneDownloadHandlerServiceImpl {
     }
 
     private void zipLocalFiles(List<String> localFilePaths, String num, AtomicInteger count, int total, String version, String sourcePath) throws Exception{
-        String localPath = "v4".equals(version) ? this.v4localPath : this.v3localPath;
+        String localPath = "v4".equals(version) ? FdkkLaserConfig.getProfile("")+this.v4localPath : this.v3localPath;
         for (String localFilePath : localFilePaths) {
             try (FileInputStream in = new FileInputStream(localFilePath)){
 //                this.zipInputStream(out, localFilePath.replace(v3localPath, ""), in);

+ 4 - 7
src/main/resources/application-standAloneProd.yml

@@ -1,9 +1,7 @@
 # 项目相关配置
 fdkk:
   # 文件路径 示例( Windows配置D:/fdkk/uploadPath,Linux配置 /home/fdkk/uploadPath)
-  profile: ${PROFILE_PATH}
   #算法软件目录
-  binPath: ${BIN_PATH}
   defaultFolder: datav1
   # 是否本地化部署:开启此项会使用minio文件管理
   isLocalization: true
@@ -11,8 +9,7 @@ fdkk:
   isBucket: false
   #是否使用软连接
   isLink: false
-  #算法软件目录
-  buildCallPath: ${BUILD_CALL_PATH}
+  settingJson: ${SETTING_JSON}
 aliyun:
   oss:
     env: dev
@@ -96,11 +93,11 @@ scene:
 zip:
   nThreads: 10
 path:
-  v4school: ${PROFILE_PATH}v4local
+  v4school: v4local
   v3school:
-  source-local: ${PROFILE_PATH}offlinev4/%s/%s
+  source-local: offlinev4/%s/%s
   zip-root: wwwroot/
-  zip-local: ${PROFILE_PATH}offlinev4/%s.zip
+  zip-local: offlinev4/%s.zip
   zip-oss: downloads/scenes/%s.zip
 download:
   config: