Prechádzať zdrojové kódy

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

chenjianhua 2 mesiacov pred
rodič
commit
745b691281

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

@@ -228,7 +228,7 @@ public class ExcelUtil {
                 if (!destFile.exists()) {
                     destFile.mkdirs();
                 }
-                logger.info("开始解压==================="+filePath);
+                logger.info("开始解压zip==================="+filePath);
                 BufferedInputStream fis = new BufferedInputStream(new FileInputStream(filePath));
                 ArchiveInputStream ais = new ArchiveStreamFactory().createArchiveInputStream(fis);
                 ArchiveEntry entry;
@@ -261,6 +261,7 @@ public class ExcelUtil {
                 fis.close();
             }
             if(ExcelUtil.isRAR(filePath)){
+                logger.info("开始解压RAR==================="+filePath);
                 String destPath = filePath.replaceAll(".rar", "").replaceAll(".RAR", "");
                 File destFile = new File(destPath);
                 if (!destFile.exists()) {
@@ -305,6 +306,10 @@ public class ExcelUtil {
                 //调用unrar命令解压
                 try{
                     unrar(inputFilePath,outputDirPath);
+                    File dir  = new File(outputDirPath);
+                    for (File file : dir.listFiles()) {
+                        fileList.add(file.getAbsolutePath());
+                    }
                 }catch (Exception e1){
                     logger.error(e.getMessage(),e1);
                 }