From cf9a5039e6db9d1d5963e3fe1a37d00169ec2ef7 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期三, 25 六月 2025 11:18:22 +0800
Subject: [PATCH] 验收报告修改

---
 src/main/java/com/whyc/service/ZipAndRarService.java |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/whyc/service/ZipAndRarService.java b/src/main/java/com/whyc/service/ZipAndRarService.java
index a6c63fe..cd140b3 100644
--- a/src/main/java/com/whyc/service/ZipAndRarService.java
+++ b/src/main/java/com/whyc/service/ZipAndRarService.java
@@ -3,12 +3,14 @@
 import com.whyc.dto.FileDirPath;
 import com.whyc.dto.Response;
 import com.whyc.pojo.FileMessage;
+import com.whyc.util.FileUtil;
 import com.whyc.util.ZipAndRarUtil;
+import org.apache.commons.compress.archivers.ArchiveException;
 import org.springframework.stereotype.Service;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 @Service
@@ -31,4 +33,20 @@
         }
         return new Response().setII(1,list!=null,list,"鍘嬬缉鏂囦欢淇℃伅");
     }
+
+    public Response decompress(String compressedFileUrl) throws ArchiveException, IOException, InterruptedException {
+        String fileSuffix = (compressedFileUrl.substring(compressedFileUrl.lastIndexOf(".")+1));
+        List<String> resList = new LinkedList<>();
+        if(fileSuffix.equals("zip")||fileSuffix.equals("rar")) {
+            List<String> decompressList = FileUtil.decompress(compressedFileUrl);
+            for (String decompress : decompressList) {
+                resList.add(decompress.substring(decompress.indexOf("doc_file")));
+            }
+        }else{
+            return new Response().set(1,false,fileSuffix+"绫诲瀷鍘嬬缉鍖呮殏涓嶆敮鎸佽В鍘�");
+        }
+
+
+        return new Response().setII(1,true, resList,null);
+    }
 }

--
Gitblit v1.9.1