|
@@ -2,6 +2,7 @@ package com.hfln.portal.infrastructure.gateway.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
|
|
import cn.hfln.framework.common.redis.service.RedisService;
|
|
|
import cn.hfln.framework.extension.BizException;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
@@ -32,6 +33,7 @@ import com.hfln.portal.infrastructure.service.DevInfoService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -62,6 +64,9 @@ public class AdminGatewayImpl implements AdminGateway {
|
|
|
@Autowired
|
|
|
private UserAuthService userAuthService;
|
|
|
|
|
|
+ @Value("${sa-token.admin.timeout}")
|
|
|
+ private long adminTimeout;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public UploadRes uploadDev(MultipartFile file) throws IOException {
|
|
@@ -155,8 +160,7 @@ public class AdminGatewayImpl implements AdminGateway {
|
|
|
// 1 需要保证 userId 和 adminUserId 不能一样
|
|
|
// 2 可以在 stputil.login 的 loginId 参数前加前缀 user_ or admin_
|
|
|
// 3 添加 SptAdminUtil,不过在不同地方,需要注意对 stputil sptadminutil 的不同引用
|
|
|
- StpUtil.login(adminUser.getUserId(), DeviceType.WEB.getCode());
|
|
|
-
|
|
|
+ StpUtil.login(adminUser.getUserId(), SaLoginParameter.create().setDeviceType(DeviceType.WEB.getCode()).setTimeout(adminTimeout));
|
|
|
|
|
|
// 当前用户登录后,需要将当前用户的权限保存到redis,用于网关校验权限
|
|
|
userAuthService.cacheRolesAndPermissions();
|