Kaynağa Gözat

feat: 可见光转红外预测接口对接完成

WANGKANG 8 ay önce
ebeveyn
işleme
d0d43b4aed

+ 2 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/constant/BizConstant.java

@@ -6,6 +6,8 @@ package com.taais.biz.constant;
 public class BizConstant {
     // 视频文件存储目录
     public static final String UPLOAD_DIR = "uploads/";
+    public static final String MODEL_PATH = "model/";
+    public static final String MODEL_SUFFIX = ".pt";
 
     public static final String UNZIP_SUFFIX = "_unzip";
     public static final String TO_INFRARED_SUFFIX = "_to_infrared";

+ 31 - 4
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/ToInfraredServiceImpl.java

@@ -244,7 +244,10 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
         makeDir(inputPath.toString());
         makeDir(outputPath.toString());
 
-        ZipUtils.unzip(resourcePath, inputPath.toString());
+        File file = new File(resourcePath);
+        if (!file.exists()) {
+            ZipUtils.unzip(resourcePath, inputPath.toString());
+        }
 
         toInfrared.setInputPath(inputPath.toString());
         toInfrared.setOutputPath(outputPath.toString());
@@ -262,8 +265,8 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
 
         String osName = System.getProperty("os.name");
         if (osName.toLowerCase().contains("windows")) {
-            startToInfraredTask.setSource_dir("C://" + toInfrared.getInputPath());
-            startToInfraredTask.setResult_dir("C://" + toInfrared.getOutputPath());
+            startToInfraredTask.setSource_dir("C:" + toInfrared.getInputPath());
+            startToInfraredTask.setResult_dir("C:" + toInfrared.getOutputPath());
         } else {
             startToInfraredTask.setSource_dir(toInfrared.getInputPath());
             startToInfraredTask.setResult_dir(toInfrared.getOutputPath());
@@ -272,7 +275,7 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
         // startToInfraredTask.setSource_dir(toInfrared.getInputPath());
         // startToInfraredTask.setResult_dir(toInfrared.getOutputPath());
 
-        if (algorithmConfigTrack.getType() == BizConstant.AlgorithmType.REASONING) {
+        if ( BizConstant.AlgorithmType.REASONING.equals(algorithmConfigTrack.getType())) {
             startToInfraredTask.setModel_path(algorithmModelTrack.getModelAddress());
         }
 
@@ -318,6 +321,30 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
             entity.setCostSecond(null);
         }
         updateById(entity);
+        /*
+         * 这里有很多需要做的:1. 保存所有模型到oss 2. 模型文件保存到算法模型配置表中
+         */
+/*
+        Path resultsPath = Paths.get(entity.getInputPath());
+        Path modelPath = resultsPath.resolve(BizConstant.MODEL_PATH);
+
+        File modelDir = new File(modelPath.toString());
+
+        if(!modelDir.exists() || !modelDir.isDirectory()) {
+            return CommonResult.fail("模型文件不存在");
+        }
+
+        for (File f : modelDir.listFiles()) {
+            if (f.isFile() && f.getName().endsWith(BizConstant.MODEL_SUFFIX)) {
+                SysOssVo upload = ossService.upload(f);
+                AlgorithmModelTrack algorithmModelTrack = new AlgorithmModelTrack();
+                algorithmModelTrack.set
+                algorithmModelTrackService.insert();
+            }
+        }
+*/
+
+
         return CommonResult.success();
     }
 

+ 6 - 5
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/VideoStableServiceImpl.java

@@ -171,11 +171,12 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         if (!folder.exists()) {
             folder.mkdirs();
         } else {
-            try {
-                FileUtils.cleanDirectory(folder);
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            // 如果目录存在,则清空目录 (这个去掉)
+            // try {
+            //     FileUtils.cleanDirectory(folder);
+            // } catch (IOException e) {
+            //     throw new RuntimeException(e);
+            // }
         }
     }