diff --git a/system/pom.xml b/system/pom.xml
index 0201fed2..e9df93ef 100644
--- a/system/pom.xml
+++ b/system/pom.xml
@@ -39,6 +39,11 @@
1.9.6
compile
+
+ com.alibaba
+ fastjson
+ 1.2.83
+
diff --git a/system/src/main/java/com/njcn/gather/system/auth/controller/AuthController.java b/system/src/main/java/com/njcn/gather/system/auth/controller/AuthController.java
index 9a3f47fe..e91b8634 100644
--- a/system/src/main/java/com/njcn/gather/system/auth/controller/AuthController.java
+++ b/system/src/main/java/com/njcn/gather/system/auth/controller/AuthController.java
@@ -3,6 +3,7 @@ package com.njcn.gather.system.auth.controller;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.fastjson.JSON;
import com.njcn.common.bean.CustomCacheUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
@@ -12,7 +13,6 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.JwtUtil;
import com.njcn.common.utils.LogUtil;
-import com.njcn.db.mybatisplus.constant.UserConstant;
import com.njcn.gather.system.auth.pojo.Token;
import com.njcn.gather.user.pojo.constant.UserValidMessage;
import com.njcn.gather.user.user.pojo.param.SysUserParam;
@@ -81,8 +81,7 @@ public class AuthController extends BaseController {
map.put("name", user.getName());
token.setUserInfo(map);
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
- customCacheUtil.putWithExpireTime(UserConstant.USER_ID, user.getId(), DateUnit.DAY.getMillis());
- customCacheUtil.putWithExpireTime(UserConstant.USER_NAME, user.getName(), DateUnit.DAY.getMillis());
+ customCacheUtil.putWithExpireTime(tokenStr, JSON.toJSONString(user), DateUnit.DAY.getMillis());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, token, methodDescribe);
}
}
@@ -95,10 +94,10 @@ public class AuthController extends BaseController {
LogUtil.njcnDebug(log, "{},注销登录", methodDescribe);
String authorization = request.getHeader(SecurityConstants.AUTHORIZATION_KEY);
if (StrUtil.isNotBlank(authorization)) {
- String token = authorization.replace(SecurityConstants.AUTHORIZATION_PREFIX, Strings.EMPTY);
+ String tokenStr = authorization.replace(SecurityConstants.AUTHORIZATION_PREFIX, Strings.EMPTY);
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
- customCacheUtil.remove(UserConstant.USER_ID);
- JwtUtil.invalidateToken(token);
+ customCacheUtil.remove(tokenStr);
+ JwtUtil.invalidateToken(tokenStr);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
diff --git a/system/src/main/java/com/njcn/gather/system/log/aop/LogAdvice.java b/system/src/main/java/com/njcn/gather/system/log/aop/LogAdvice.java
index 6d3677eb..b8029b90 100644
--- a/system/src/main/java/com/njcn/gather/system/log/aop/LogAdvice.java
+++ b/system/src/main/java/com/njcn/gather/system/log/aop/LogAdvice.java
@@ -46,7 +46,7 @@ public class LogAdvice implements ApplicationListener {
@Around("logPointcut()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
- String username = customCacheUtil.get(UserConstant.USER_NAME, false);
+ //String username = customCacheUtil.get(UserConstant.USER_NAME, false);
// String operationType = "";
// String operateResult = "成功";
// Integer level = 0;
@@ -55,9 +55,9 @@ public class LogAdvice implements ApplicationListener {
Object result = null;
try {
result = joinPoint.proceed();
- addLogToQueue(joinPoint, username, "操作日志", "成功", 0, 0);
+ //addLogToQueue(joinPoint, username, "操作日志", "成功", 0, 0);
} catch (Throwable e) {
- addLogToQueue(joinPoint, username, "告警日志", "失败", 1, 1);
+ //addLogToQueue(joinPoint, username, "告警日志", "失败", 1, 1);
throw e;
}
return result;