From e1fcbc6476066fafa8214527a8386fcc8af7b54f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 04 八月 2021 17:27:33 +0800
Subject: [PATCH] update 移动文件存储 controller 到 admin 模块
---
ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java | 57 ++++++++++++++++++++++++++++-----------------------------
1 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
index e79f468..371a661 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
@@ -1,14 +1,13 @@
package com.ruoyi.framework.security.handle;
-import cn.hutool.core.lang.Validator;
import cn.hutool.http.HttpStatus;
-import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.JsonUtils;
import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.framework.manager.AsyncManager;
-import com.ruoyi.framework.manager.factory.AsyncFactory;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.web.service.AsyncService;
import com.ruoyi.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -22,33 +21,33 @@
/**
* 鑷畾涔夐��鍑哄鐞嗙被 杩斿洖鎴愬姛
- *
+ *
* @author ruoyi
*/
@Configuration
-public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
-{
- @Autowired
- private TokenService tokenService;
+public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
- /**
- * 閫�鍑哄鐞�
- *
- * @return
- */
- @Override
- public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
- throws IOException, ServletException
- {
- LoginUser loginUser = tokenService.getLoginUser(request);
- if (Validator.isNotNull(loginUser))
- {
- String userName = loginUser.getUsername();
- // 鍒犻櫎鐢ㄦ埛缂撳瓨璁板綍
- tokenService.delLoginUser(loginUser.getToken());
- // 璁板綍鐢ㄦ埛閫�鍑烘棩蹇�
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "閫�鍑烘垚鍔�"));
- }
- ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.HTTP_OK, "閫�鍑烘垚鍔�")));
- }
+ @Autowired
+ private TokenService tokenService;
+
+ @Autowired
+ private AsyncService asyncService;
+
+ /**
+ * 閫�鍑哄鐞�
+ */
+ @Override
+ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
+ throws IOException, ServletException {
+ LoginUser loginUser = tokenService.getLoginUser(request);
+ if (StringUtils.isNotNull(loginUser)) {
+ String userName = loginUser.getUsername();
+ // 鍒犻櫎鐢ㄦ埛缂撳瓨璁板綍
+ tokenService.delLoginUser(loginUser.getToken());
+ // 璁板綍鐢ㄦ埛閫�鍑烘棩蹇�
+ asyncService.recordLogininfor(userName, Constants.LOGOUT, "閫�鍑烘垚鍔�", request);
+ }
+ ServletUtils.renderString(response, JsonUtils.toJsonString(AjaxResult.error(HttpStatus.HTTP_OK, "閫�鍑烘垚鍔�")));
+ }
+
}
--
Gitblit v1.9.3