28968 il y a 8 mois
Parent
commit
c8fd1e5aa2

+ 2 - 2
taais-admin/src/main/resources/application.yml

@@ -9,9 +9,9 @@ taais:
   # 实例演示开关
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/km/uploadPath,Linux配置 /home/km/uploadPath)
-  #profile: D:/taais/uploadPath
+  profile: D:/taais/uploadPath
   # 后面不能有 /
-  profile: /www/project
+  #profile: /www/project
   # 获取ip地址开关
   addressEnabled: false
 

+ 23 - 6
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/DataAugmentationController.java

@@ -162,19 +162,20 @@ public class DataAugmentationController extends BaseController {
                             .filter(Files::isRegularFile)  // 只选择常规文件(排除子目录、排除图像拼接算法_sift输入中的txt文件)
                             .filter(path -> !path.toString().toLowerCase().endsWith(".txt")).map(path -> {
                                 return path.getFileName().toString();
-                            }).collect(Collectors.toList());
+                            }).sorted().collect(Collectors.toList());
                         if ("目标毁伤评估".equals(taskType)) {
                             QueryWrapper queryWrapper = new QueryWrapper();
                             queryWrapper.eq("dict_type", "biz_data_augmentation");
                             queryWrapper.eq("dict_label", "目标毁伤评估必须输出文件名称");
                             List<SysDictData> list = sysDictDataService.list(queryWrapper);
+                            String[] split = list.get(0).getDictValue().split(",");
                             if (list.isEmpty()) {
                                 origin.add("未在数据字典中定义目标毁伤评估必须输出文件名称");
                                 origin_list.add(origin);
                                 images.put("error", origin_list);
                                 return ResponseEntity.status(500).body(images);
                             } else {
-                                String[] split = list.get(0).getDictValue().split(",");
+
                                 for (String fileName: split) {
                                     if (!outputFileList.contains(fileName)) {
                                         stable.add("输出目录不存在结果文件:" + fileName);
@@ -185,6 +186,25 @@ public class DataAugmentationController extends BaseController {
                                 }
                             }
                             outputFileList.sort(Comparator.comparingInt(DataAugmentationController::extractNumber));
+                            Map<String, Integer> indexMap = new HashMap<>();
+                            for (int i = 0; i < split.length; i++) {
+                                indexMap.put(split[i], i);
+                            }
+                            // 自定义比较器,基于indexMap中存储的位置信息
+                            Comparator<String> customComparator = (o1, o2) -> {
+                                Integer index1 = indexMap.get(o1);
+                                Integer index2 = indexMap.get(o2);
+                                // 如果o1或o2不在s数组中,则保持它们在原始列表中的相对顺序
+                                if (index1 == null && index2 == null) {
+                                    return 0;
+                                } else if (index1 == null) {
+                                    return 1;
+                                } else if (index2 == null) {
+                                    return -1;
+                                }
+                                return index1.compareTo(index2);
+                            };
+                            Collections.sort(outputFileList, customComparator);
                         }
                     } else {
                         System.out.println(taskType + "任务:" + dataAugmentation.getId() + "未创建结果目录!");
@@ -200,7 +220,7 @@ public class DataAugmentationController extends BaseController {
                         .filter(path -> !path.toString().toLowerCase().endsWith(".json"))
                         .map(path -> {
                             return path.getFileName().toString();
-                        }).collect(Collectors.toList());
+                        }).sorted().collect(Collectors.toList());
                 } else {
                     //算法输入是一对一时,输出文件名称和输入文件名称相同
                     inputPath1 = inputPath;
@@ -312,9 +332,6 @@ public class DataAugmentationController extends BaseController {
     public void export(HttpServletResponse response, @RequestBody String zipDirPath) {
 
         try {
-            // 假设你已经知道ZIP文件的路径
-//            String zipFilePath = dataAugmentationVo.getOutputPath() + ".zip";
-//            System.out.println(dataAugmentationVo.toString());
 
             String zipFilePath = zipDirPath.substring(1, zipDirPath.length() - 1) + ".zip";
             System.out.println( zipFilePath);