diff --git a/src/main/java/com/dragon/gateway/filter/impl/CacheRequestGatewayFilter.java b/src/main/java/com/dragon/gateway/filter/impl/CacheRequestGatewayFilter.java index db0f65f..e19605a 100644 --- a/src/main/java/com/dragon/gateway/filter/impl/CacheRequestGatewayFilter.java +++ b/src/main/java/com/dragon/gateway/filter/impl/CacheRequestGatewayFilter.java @@ -30,15 +30,19 @@ public class CacheRequestGatewayFilter implements GatewayFilter { String userId = exchange.getRequest().getHeaders().getFirst(SecurityConstants.DETAILS_USER_ID); log.info("经过公司过滤器,{}", userId); log.info("请求的uri是:{}",exchange.getRequest().getPath().toString()); - // GET DELETE 不过滤 - RedisService redisService = SpringUtils.getBean(RedisService.class); - FirmInfoCache firmInfoCache = redisService.getCacheObject("company:" + userId); - log.info("企业对象是{}:", JSONObject.toJSONString(firmInfoCache)); + if ("/firm/firm/by/userId".equals(exchange.getRequest().getPath().toString())){ + // GET DELETE 不过滤 + RedisService redisService = SpringUtils.getBean(RedisService.class); + FirmInfoCache firmInfoCache = redisService.getCacheObject("company:" + userId); + log.info("企业对象是{}:", JSONObject.toJSONString(firmInfoCache)); - if (firmInfoCache == null) { - log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath()); - return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "您还未进行企业认证", HttpStatus.UNAUTHORIZED); + if (firmInfoCache == null) { + log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath()); + return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "您还未进行企业认证", HttpStatus.UNAUTHORIZED); + } + return chain.filter(exchange); } + return chain.filter(exchange); } }