From 4d730af0447c686133130d0116a0fa3dd82c2dca Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Tue, 10 Nov 2026 01:41:03 +0000
Subject: [PATCH] Merge branch 'wcd-2411-update' into wcd

---
 eladmin-master/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/eladmin-master/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java b/eladmin-master/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
index 0d8d5fb..a650f69 100644
--- a/eladmin-master/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
+++ b/eladmin-master/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
@@ -22,6 +22,7 @@
 import me.zhengjie.exception.BadRequestException;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.xssf.streaming.SXSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.multipart.MultipartFile;
@@ -350,6 +351,24 @@
         }
     }
 
+    /**
+     * 下载ZIP
+     */
+    public static void downloadZip(ByteArrayOutputStream byteArrayOutputStream, HttpServletResponse response) throws IOException {
+        // response为HttpServletResponse对象
+        response.setContentType("application/zip");
+        // test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
+        response.setHeader("Content-Disposition", "attachment;filename=file.zip");
+        // ServletOutputStream
+        ServletOutputStream out = response.getOutputStream();
+        // 写入
+        out.write(byteArrayOutputStream.toByteArray());
+        // flush
+        out.flush();
+        //此处记得关闭输出Servlet流
+        IoUtil.close(out);
+    }
+
     public static String getMd5(File file) {
         return getMd5(getByte(file));
     }

--
Gitblit v1.9.3