From a4b0a7c0bb07255f4408e5087608e0c6ac0c495f Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 16 Aug 2020 11:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=BA=E9=80=80=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BC=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/common/CommonController.java | 4 ---- .../controller/monitor/SysUserOnlineController.java | 3 +-- .../java/com/ruoyi/common/utils/file/FileUtils.java | 11 ++++++----- 3 files changed, 7 insertions(+), 11 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 3cf7c38a1..85ded810b 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 @@ -19,10 +19,6 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; -import java.io.File; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; - /** * 通用请求处理 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 4d76ef4fb..8d17731a9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -78,8 +78,7 @@ public class SysUserOnlineController extends BaseController { return error("当前登陆用户无法强退"); } - onlineSession.setStatus(OnlineStatus.off_line); - onlineSessionDAO.update(onlineSession); + onlineSessionDAO.delete(onlineSession); online.setStatus(OnlineStatus.off_line); userOnlineService.saveOnline(online); userOnlineService.removeUserCache(online.getLoginName(), sessionId); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index f36a35d65..c4f7e0584 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -149,7 +149,8 @@ public class FileUtils extends org.apache.commons.io.FileUtils * @param realFileName 真实文件名 * @return */ - public static void setAttachmentResponseHeader(HttpServletResponse response,String realFileName) throws UnsupportedEncodingException { + public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException + { String percentEncodedFileName = percentEncode(realFileName); StringBuilder contentDispositionValue = new StringBuilder(); @@ -160,8 +161,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils .append("utf-8''") .append(percentEncodedFileName); - response.setHeader("Content-disposition", - contentDispositionValue.toString()); + response.setHeader("Content-disposition", contentDispositionValue.toString()); } /** @@ -170,8 +170,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils * @param s 需要百分号编码的字符串 * @return 百分号编码后的字符串 */ - public static String percentEncode(String s) throws UnsupportedEncodingException { + public static String percentEncode(String s) throws UnsupportedEncodingException + { String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); - return encode .replaceAll("\\+", "%20"); + return encode.replaceAll("\\+", "%20"); } }