Commit 38ed34d1 authored by 赵啸非's avatar 赵啸非

添加资源自动刷新获取

parent 70a9c4d1
......@@ -14,6 +14,7 @@ import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.MenuEncodeUtil;
import com.mortals.xhx.module.user.model.UserEntity;
import com.mortals.xhx.module.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.ParameterResolutionDelegate;
......@@ -44,6 +45,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
private ICacheService cacheService;
@Autowired
private ResourceService resourceService;
@Autowired
private UserService userService;
@Override
public int getOrder() {
......@@ -104,7 +107,10 @@ public class AuthUserInterceptor extends BaseInterceptor {
IUser loginUser = authTokenService.getLoginUser(request);
if (ObjectUtils.isEmpty(loginUser)) return false;
String menuUrl = cacheService.hget(RedisKey.KEY_USER_MENU_CACHE, loginUser.getId().toString(), String.class);
UserEntity userCache = userService.getExtCache(loginUser.getLoginName());
if (ObjectUtils.isEmpty(userCache)) return false;
String menuUrl = cacheService.hget(RedisKey.KEY_USER_MENU_CACHE, userCache.getId().toString(), String.class);
if (ObjectUtils.isEmpty(menuUrl)) {
Set<String> urls = resourceService.findUrlSetByUserId(loginUser.getId());
menuUrl = MenuEncodeUtil.generateMenuUrlCode(urls);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment