|
|
|
@ -8,6 +8,7 @@ import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; |
|
|
|
import com.dreamchaser.depository_manage.security.pool.RedisPool; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
|
|
|
|
|
|
|
@ -34,11 +35,14 @@ public class UserInterceptor extends HandlerInterceptorAdapter { |
|
|
|
} |
|
|
|
}; |
|
|
|
private static RedisPool redisPool; |
|
|
|
private static RedisTemplate<String,String> redisTemplate; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
public void setRedisTemplate(RedisPool redisPool) { |
|
|
|
UserInterceptor.redisPool = redisPool; |
|
|
|
} |
|
|
|
@Autowired |
|
|
|
public void setRedisTemplate(RedisTemplate<String,String> redisTemplate){UserInterceptor.redisTemplate = redisTemplate;} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean preHandle(HttpServletRequest request, |
|
|
|
@ -66,7 +70,11 @@ public class UserInterceptor extends HandlerInterceptorAdapter { |
|
|
|
} |
|
|
|
System.out.println("redis请求key:"+PublicConfig.LoginRedisPrefix+userKey); |
|
|
|
token = (String) redisPool.getRedisTemplateByDb(5).opsForHash().get(PublicConfig.LoginRedisPrefix+userKey,"usertoken"); |
|
|
|
System.out.println("redis获取的token"+token); |
|
|
|
System.out.println("redisPool获取的token: "+token); |
|
|
|
System.out.println("redisTemplate获取的token: "+redisTemplate.opsForHash().get(PublicConfig.LoginRedisPrefix+userKey,"usertoken")); |
|
|
|
if(token == null){ |
|
|
|
redisPool.getRedisTemplateByDb(5).opsForHash().put("ces","wfdl","wfdl"); |
|
|
|
} |
|
|
|
if ( "/".equals(servletPath)) { |
|
|
|
// 如果是企业微信登录
|
|
|
|
try { |
|
|
|
|