Sfoglia il codice sorgente

fix: 估值表解析增加RAR文件格式路径错误问题修复

chenjianhua 2 mesi fa
parent
commit
7a494e209c

+ 21 - 1
service-base/src/main/java/com/simuwang/base/common/util/ExcelUtil.java

@@ -315,7 +315,7 @@ public class ExcelUtil {
                     File dir  = new File(outputDirPath);
                     for (File file : dir.listFiles()) {
                         logger.info(file.getAbsolutePath());
-                        fileList.add(file.getAbsolutePath());
+                        fileList.addAll(fileList(file));
                     }
                 }catch (Exception e1){
                     logger.error(e.getMessage(),e1);
@@ -324,6 +324,26 @@ public class ExcelUtil {
         return fileList;
     }
 
+    private static List<String> fileList(File file){
+        List<String> fileList = new ArrayList<>();
+        if(file.isDirectory()){
+            File[] files = file.listFiles();
+            for (File file1 : files) {
+                System.out.println(file1.getAbsolutePath());
+                if(file1.isDirectory()){
+                   List<String> dirFileList =  fileList(file1);
+                   fileList.addAll(dirFileList);
+                }else{
+                    fileList.add(file1.getAbsolutePath());
+                }
+            }
+        }else{
+            fileList.add(file.getAbsolutePath());
+            System.out.println(file.getAbsolutePath());
+        }
+        return fileList;
+    }
+
     /**
      * 解压RAR文件
      * @param rarFilePath RAR文件路径