xucaiqin 3 hónapja
szülő
commit
c08ab4c467

+ 16 - 14
sckw-gateway/src/main/java/com/sckw/gateway/filter/AuthenticationFilter.java

@@ -93,20 +93,22 @@ public class AuthenticationFilter implements GlobalFilter, Ordered {
 //        String accessSpecial = request.getHeader(RequestConstant.ACCESS_SPECIAL);
         String requestUri = request.getPath().value();
         /*1、非token校验接口放行*/
-        if (EXCLUDEPATH.contains(requestUri)&& StrUtil.isNotBlank(token)) {
-            Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, token);
-            if (tokenMap != null) {
-                Long userId = StringUtils.isNotBlank(tokenMap.get("userId")) ? NumberUtils.parseLong(tokenMap.get("userId")) : null;
-                String key = Global.getFullUserLoginKey(systemType, userId);
-
-                String userInfoStr = RedissonUtils.getString(key);
-                LoginUserInfo loginUserInfo = StringUtils.isNotBlank(userInfoStr) ? com.alibaba.fastjson.JSON.parseObject(userInfoStr, LoginUserInfo.class) : null;
-                if (Objects.nonNull(loginUserInfo)) {
-                    loginUserInfo.setClientType(clientType);
-                    String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(loginUserInfo.getEntId()));
-                    LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? com.alibaba.fastjson.JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
-                    ServerWebExchange build = buildNewExchange(exchange,loginUserInfo,loginEntInfo);
-                    return chain.filter(build);
+        if (EXCLUDEPATH.contains(requestUri)) {
+            if (StrUtil.isNotBlank(token)) {
+                Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, token);
+                if (tokenMap != null) {
+                    Long userId = StringUtils.isNotBlank(tokenMap.get("userId")) ? NumberUtils.parseLong(tokenMap.get("userId")) : null;
+                    String key = Global.getFullUserLoginKey(systemType, userId);
+
+                    String userInfoStr = RedissonUtils.getString(key);
+                    LoginUserInfo loginUserInfo = StringUtils.isNotBlank(userInfoStr) ? com.alibaba.fastjson.JSON.parseObject(userInfoStr, LoginUserInfo.class) : null;
+                    if (Objects.nonNull(loginUserInfo)) {
+                        loginUserInfo.setClientType(clientType);
+                        String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(loginUserInfo.getEntId()));
+                        LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? com.alibaba.fastjson.JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
+                        ServerWebExchange build = buildNewExchange(exchange,loginUserInfo,loginEntInfo);
+                        return chain.filter(build);
+                    }
                 }
             }
             return chain.filter(exchange);