Переглянути джерело

feat:zip包解压问题优化

chenjianhua 1 тиждень тому
батько
коміт
bb5ea09bd9

+ 13 - 0
service-daq/src/main/java/com/simuwang/daq/service/EmailTemplateService.java

@@ -559,6 +559,19 @@ public class EmailTemplateService {
                     Optional.ofNullable(getRealFilePath(zipFilePath, null)).ifPresent(emailFileContentDTOList::addAll);
                 }
             }
+        }else if(ExcelUtil.isRAR(filePath)){
+            String destPath = filePath.replaceAll(".rar", "").replaceAll(".RAR", "");
+            List<String> dir = ExcelUtil.extractCompressedFiles(filePath, destPath);
+            for (String zipFilePath : dir) {
+                File file = new File(zipFilePath);
+                if (file.isDirectory()) {
+                    for (String navFilePath : Objects.requireNonNull(file.list())) {
+                        Optional.ofNullable(getRealFilePath(navFilePath, null)).ifPresent(emailFileContentDTOList::addAll);
+                    }
+                } else {
+                    Optional.ofNullable(getRealFilePath(zipFilePath, null)).ifPresent(emailFileContentDTOList::addAll);
+                }
+            }
         }
         return emailFileContentDTOList;
     }