From afb74b6bb1dbb3ea0c0f4eb206d803f30c60ffc2 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 30 十二月 2022 16:15:17 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/helper/WebHelper.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/lf/server/helper/WebHelper.java b/src/main/java/com/lf/server/helper/WebHelper.java
index 5a43d7d..8fabfc5 100644
--- a/src/main/java/com/lf/server/helper/WebHelper.java
+++ b/src/main/java/com/lf/server/helper/WebHelper.java
@@ -277,6 +277,17 @@
     }
 
     /**
+     * 鍐欏搷搴斾俊鎭�
+     */
+    public static void writeInfo(HttpStatus status, String info, HttpServletResponse res) {
+        try {
+            WebHelper.write2Page(res, WebHelper.getErrJson(status, info));
+        } catch (Exception e) {
+            //
+        }
+    }
+
+    /**
      * 鑾峰彇闅忔満鏁存暟
      */
     public static int getRandomInt(int min, int max) {
@@ -286,12 +297,15 @@
     /**
      * 涓嬭浇鏂囦欢
      *
-     * @param file 鏂囦欢
-     * @param res  鍝嶅簲
+     * @param file     鏂囦欢
+     * @param fileName 鏂囦欢鍚�
+     * @param res      鍝嶅簲
      * @throws Exception 寮傚父
      */
-    public static void download(String file, HttpServletResponse res) throws Exception {
-        String fileName = URLEncoder.encode(FileHelper.getFileName(file), "UTF-8");
+    public static void download(String file, String fileName, HttpServletResponse res) throws Exception {
+        if (StringHelper.isNull(fileName)) {
+            fileName = URLEncoder.encode(FileHelper.getFileName(file), "UTF-8");
+        }
 
         // 璁剧疆鍝嶅簲澶翠腑鏂囦欢鐨勪笅杞芥柟寮忎负闄勪欢鏂瑰紡锛屼互鍙婅缃枃浠跺悕
         res.setHeader("Content-Disposition", "attachment; filename=" + fileName);

--
Gitblit v1.9.3