소스 검색

featg: cat测试

WANGKANG 3 달 전
부모
커밋
151257350d

+ 1 - 1
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/TargetDetectionServiceImpl.java

@@ -290,7 +290,7 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
         return this.removeByIds(Arrays.asList(ids));
     }
 
-    public String getTrainInputPath(SysOssVo ossEntity) {
+    public static String getTrainInputPath(SysOssVo ossEntity) {
         String unzipPath = getUnZipDirPath(ossEntity);
         File file = new File(unzipPath);
         if (!file.exists()) {

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

@@ -251,7 +251,15 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
             } catch (Exception e2) {
                 if (val.contains(",")) {
                     val = val.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\s", "");
-                    return Arrays.stream(val.split(",")).map(Integer::parseInt).collect(Collectors.toList());
+                    try {
+                        return Arrays.stream(val.split(",")).map(Integer::parseInt).collect(Collectors.toList());
+                    } catch (Exception e3) {
+                        try {
+                            return Arrays.stream(val.split(",")).map(Double::parseDouble).collect(Collectors.toList());
+                        } catch (Exception e4) {
+                            return "[" + val + "]";
+                        }
+                    }
                 } else {
                     return Boolean.parseBoolean(val);
                 }
@@ -538,6 +546,21 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
         return content;
     }
 
+    public static long getFolderSize(File folder) {
+        long totalSize = 0;
+        if (folder.isDirectory()) {
+            File[] files = folder.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    totalSize += getFolderSize(file);
+                }
+            }
+        } else {
+            totalSize = folder.length();
+        }
+        return totalSize;
+    }
+
     public static CommonResult getModelList_(String modelPath, String profile) {
         File modelDir = new File(modelPath);
         if (!modelDir.exists()) {
@@ -547,7 +570,8 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
         Integer idx = 0;
         ArrayList<Map<String, String>> res = new ArrayList<>();
         for (File file : files) {
-            if (file.getName().endsWith(".log")) {
+            if (file.getName().endsWith(".log") || file.getName().endsWith(".json")
+                    || file.getName().startsWith("events.out")) {
                 continue;
             }
             idx += 1;
@@ -556,14 +580,14 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
             tmp.put("name", file.getName());
             String filePath = file.getPath();
             tmp.put("path", filePath);
-            // todo 获取真正的url
+            // 获取url
             // http://localhost:9090/profile/upload/2024/10/27/1_1729404909511_20241027153840A001.zip
             // /profile/upload/2024/10/27/1_1729404909511_20241027153840A001.zip
             String url = "/api" + Constants.RESOURCE_PREFIX + filePath.substring(profile.length());
             url = url.replaceAll("\\\\", "/"); // windows
             tmp.put("url", url);
 
-            double fileSize = (file.length() / (1024.0 * 1024.0));
+            double fileSize = (getFolderSize(file) / (1024.0 * 1024.0));
             DecimalFormat decimalFormat = new DecimalFormat("#.##");
             String formatFileSize = decimalFormat.format(fileSize);
             tmp.put("size", formatFileSize + "MB");

+ 6 - 31
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/TrackSequenceServiceImpl.java

@@ -55,7 +55,7 @@ import java.util.*;
 
 import static com.taais.biz.constant.BizConstant.VideoStatus.NOT_START;
 import static com.taais.biz.domain.table.TrackSequenceTableDef.TRACK_SEQUENCE;
-import static com.taais.biz.service.impl.TargetDetectionServiceImpl.getFileSize;
+import static com.taais.biz.service.impl.TargetDetectionServiceImpl.*;
 import static com.taais.biz.service.impl.ToInfraredServiceImpl.*;
 import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
 
@@ -89,9 +89,9 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
         return this.list(queryWrapper);
     }
 
-    public String getTrainInputPath(SysOssVo ossEntity) {
-        return getUnZipDirPath(ossEntity);
-    }
+    // public String getTrainInputPath(SysOssVo ossEntity) {
+    // return getUnZipDirPath(ossEntity);
+    // }
 
     public String getTrainOutputPath(TrackSequence entity, SysOssVo ossEntity) {
         String resourcePath = getResourcePath(ossEntity);
@@ -469,33 +469,8 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
             return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
         }
 
-        String outputPath = "";
-        String zipFilePath = "";
-
-        AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService
-                .getById(entity.getAlgorithmId());
-
-        if (BizConstant.AlgorithmType.REASONING.equals(algorithmConfigTrack.getType())) {
-            outputPath = entity.getOutputPath() + File.separator + "predict";
-            File file__ = new File(outputPath);
-            if (!file__.exists()) {
-                outputPath = entity.getOutputPath();
-            }
-            zipFilePath = outputPath + ".zip";
-        } else if (BizConstant.AlgorithmType.TEST.equals(algorithmConfigTrack.getType())) {
-            outputPath = entity.getOutputPath() + File.separator + "evaluate";
-            File file__ = new File(outputPath);
-            if (!file__.exists()) {
-                outputPath = entity.getOutputPath();
-            }
-            zipFilePath = outputPath + ".zip";
-        } else if (BizConstant.AlgorithmType.TRAIN.equals(algorithmConfigTrack.getType())) {
-            outputPath = entity.getOutputPath();
-            zipFilePath = outputPath + ".zip";
-        } else {
-            System.out.println("未知算法类型!");
-            return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
-        }
+        String outputPath = entity.getOutputPath();
+        String zipFilePath = outputPath + ".zip";
 
         File file = new File(zipFilePath);
         if (!file.exists()) {