Kaynağa Gözat

fix: 估值表解析增加RAR文件格式读取

chenjianhua 2 ay önce
ebeveyn
işleme
ba14ac79fc

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

@@ -531,6 +531,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;
     }