From b3541e975898e17a6cbc1a9ea776f3ec7e91d39a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期六, 12 六月 2021 20:13:35 +0800
Subject: [PATCH] update 优化 使用 hutool 替换 ruoyi 自带工具类 解决部分方法过期与高版本JDK不兼容问题

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index c69cdf2..38913f5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -18,10 +18,12 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 閫氱敤璇锋眰澶勭悊
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -34,7 +36,7 @@
 
     /**
      * 閫氱敤涓嬭浇璇锋眰
-     * 
+     *
      * @param fileName 鏂囦欢鍚嶇О
      * @param delete 鏄惁鍒犻櫎
      */
@@ -52,10 +54,10 @@
 
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, realFileName);
-            FileUtils.writeBytes(filePath, response.getOutputStream());
+			FileUtils.writeToStream(filePath, response.getOutputStream());
             if (delete)
             {
-                FileUtils.deleteFile(filePath);
+				FileUtils.del(filePath);
             }
         }
         catch (Exception e)
@@ -77,10 +79,10 @@
             // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
             String fileName = FileUploadUtils.upload(filePath, file);
             String url = serverConfig.getUrl() + fileName;
-            AjaxResult ajax = AjaxResult.success();
+			Map<String,Object> ajax = new HashMap<>();
             ajax.put("fileName", fileName);
             ajax.put("url", url);
-            return ajax;
+            return AjaxResult.success(ajax);
         }
         catch (Exception e)
         {
@@ -109,7 +111,7 @@
             String downloadName = StrUtil.subAfter(downloadPath, "/",true);
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, downloadName);
-            FileUtils.writeBytes(downloadPath, response.getOutputStream());
+            FileUtils.writeToStream(downloadPath, response.getOutputStream());
         }
         catch (Exception e)
         {

--
Gitblit v1.9.3