完善:发版前配置梳理
This commit is contained in:
parent
f57d15793a
commit
c5b748fe52
@ -21,6 +21,7 @@ import java.lang.annotation.*;
|
|||||||
/**
|
/**
|
||||||
* 查询注解
|
* 查询注解
|
||||||
*
|
*
|
||||||
|
* @author Zheng Jie(ELADMIN)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/1/15 18:01
|
* @since 2023/1/15 18:01
|
||||||
*/
|
*/
|
||||||
|
@ -59,8 +59,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
LocalStorageProperties.LocalStoragePath path = localStorageProperties.getPath();
|
LocalStorageProperties.LocalStoragePath path = localStorageProperties.getPath();
|
||||||
String avatarUtl = "file:" + path.getAvatar().replace("\\", "/");
|
String avatarUtl = "file:" + path.getAvatar().replace(StringConsts.BACKSLASH, StringConsts.SLASH);
|
||||||
String fileUrl = "file:" + path.getFile().replace("\\", "/");
|
String fileUrl = "file:" + path.getFile().replace(StringConsts.BACKSLASH, StringConsts.SLASH);
|
||||||
registry.addResourceHandler(localStorageProperties.getFilePattern()).addResourceLocations(fileUrl)
|
registry.addResourceHandler(localStorageProperties.getFilePattern()).addResourceLocations(fileUrl)
|
||||||
.setCachePeriod(0);
|
.setCachePeriod(0);
|
||||||
registry.addResourceHandler(localStorageProperties.getAvatarPattern()).addResourceLocations(avatarUtl)
|
registry.addResourceHandler(localStorageProperties.getAvatarPattern()).addResourceLocations(avatarUtl)
|
||||||
|
@ -25,6 +25,7 @@ import cn.hutool.extra.spring.SpringUtil;
|
|||||||
/**
|
/**
|
||||||
* RSA 配置属性
|
* RSA 配置属性
|
||||||
*
|
*
|
||||||
|
* @author Zheng Jie(ELADMIN)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/21 20:21
|
* @since 2022/12/21 20:21
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +35,7 @@ import top.charles7c.cnadmin.common.exception.ServiceException;
|
|||||||
/**
|
/**
|
||||||
* 异步任务执行配置
|
* 异步任务执行配置
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/23 22:33
|
* @since 2022/12/23 22:33
|
||||||
*/
|
*/
|
||||||
@ -47,7 +48,7 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
|||||||
private final ScheduledExecutorService scheduledExecutorService;
|
private final ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步任务执行时,使用 Java 内置线程池
|
* 异步任务 @Async 执行时,使用 Java 内置线程池
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Executor getAsyncExecutor() {
|
public Executor getAsyncExecutor() {
|
||||||
|
@ -34,6 +34,7 @@ import top.charles7c.cnadmin.common.util.ExceptionUtils;
|
|||||||
/**
|
/**
|
||||||
* 线程池配置
|
* 线程池配置
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/23 23:13
|
* @since 2022/12/23 23:13
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* 线程池配置属性
|
* 线程池配置属性
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/23 23:06
|
* @since 2022/12/23 23:06
|
||||||
*/
|
*/
|
||||||
|
@ -52,6 +52,7 @@ import top.charles7c.cnadmin.common.util.holder.LogContextHolder;
|
|||||||
* 全局异常处理器
|
* 全局异常处理器
|
||||||
*
|
*
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @since 2022/12/21 21:01
|
* @since 2022/12/21 21:01
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -183,7 +184,6 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(NotLoginException.class)
|
@ExceptionHandler(NotLoginException.class)
|
||||||
public R handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
public R handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
||||||
log.error("请求地址 [{}],认证失败,无法访问系统资源。", request.getRequestURI(), e);
|
log.error("请求地址 [{}],认证失败,无法访问系统资源。", request.getRequestURI(), e);
|
||||||
|
|
||||||
String errorMsg;
|
String errorMsg;
|
||||||
switch (e.getType()) {
|
switch (e.getType()) {
|
||||||
case NotLoginException.KICK_OUT:
|
case NotLoginException.KICK_OUT:
|
||||||
@ -196,7 +196,6 @@ public class GlobalExceptionHandler {
|
|||||||
errorMsg = "登录状态已过期,请重新登录";
|
errorMsg = "登录状态已过期,请重新登录";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogContextHolder.setErrorMsg(errorMsg);
|
LogContextHolder.setErrorMsg(errorMsg);
|
||||||
return R.fail(HttpStatus.UNAUTHORIZED.value(), errorMsg);
|
return R.fail(HttpStatus.UNAUTHORIZED.value(), errorMsg);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import top.charles7c.cnadmin.common.constant.StringConsts;
|
|||||||
/**
|
/**
|
||||||
* 文件工具类
|
* 文件工具类
|
||||||
*
|
*
|
||||||
|
* @author Zheng Jie(ELADMIN)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/1/2 21:34
|
* @since 2023/1/2 21:34
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@ import cn.hutool.extra.spring.SpringUtil;
|
|||||||
/**
|
/**
|
||||||
* Redis 工具类
|
* Redis 工具类
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/11 12:00
|
* @since 2022/12/11 12:00
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@ import top.charles7c.cnadmin.common.constant.StringConsts;
|
|||||||
/**
|
/**
|
||||||
* Stream 工具类
|
* Stream 工具类
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/22 19:51
|
* @since 2022/12/22 19:51
|
||||||
*/
|
*/
|
||||||
|
@ -38,6 +38,7 @@ import top.charles7c.cnadmin.common.util.holder.LogContextHolder;
|
|||||||
/**
|
/**
|
||||||
* 登录助手
|
* 登录助手
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/24 12:58
|
* @since 2022/12/24 12:58
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +36,7 @@ import top.charles7c.cnadmin.common.util.ReflectUtils;
|
|||||||
/**
|
/**
|
||||||
* 查询助手
|
* 查询助手
|
||||||
*
|
*
|
||||||
|
* @author Zheng Jie(ELADMIN)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/1/15 18:17
|
* @since 2023/1/15 18:17
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
|||||||
/**
|
/**
|
||||||
* Sa-Token 配置
|
* Sa-Token 配置
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/19 22:13
|
* @since 2022/12/19 22:13
|
||||||
*/
|
*/
|
||||||
|
@ -27,17 +27,24 @@ import top.charles7c.cnadmin.common.util.helper.LoginHelper;
|
|||||||
/**
|
/**
|
||||||
* Sa-Token 权限认证适配
|
* Sa-Token 权限认证适配
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/3/1 22:28
|
* @since 2023/3/1 22:28
|
||||||
*/
|
*/
|
||||||
public class SaTokenPermissionImpl implements StpInterface {
|
public class SaTokenPermissionImpl implements StpInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单权限列表
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPermissionList(Object loginId, String loginType) {
|
public List<String> getPermissionList(Object loginId, String loginType) {
|
||||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
return new ArrayList<>(loginUser.getPermissions());
|
return new ArrayList<>(loginUser.getPermissions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色权限列表
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> getRoleList(Object loginId, String loginType) {
|
public List<String> getRoleList(Object loginId, String loginType) {
|
||||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
@ -29,6 +29,7 @@ import top.charles7c.cnadmin.common.util.RedisUtils;
|
|||||||
/**
|
/**
|
||||||
* Sa-Token 持久层本地 Redis 适配(参考:Sa-Token/sa-token-plugin/sa-token-dao-redisx/SaTokenDaoOfRedis.java)
|
* Sa-Token 持久层本地 Redis 适配(参考:Sa-Token/sa-token-plugin/sa-token-dao-redisx/SaTokenDaoOfRedis.java)
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/28 22:55
|
* @since 2022/12/28 22:55
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* Sa-Token 安全配置属性
|
* Sa-Token 安全配置属性
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2022/12/19 22:14
|
* @since 2022/12/19 22:14
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
import top.charles7c.cnadmin.common.constant.CacheConsts;
|
import top.charles7c.cnadmin.common.constant.CacheConsts;
|
||||||
|
import top.charles7c.cnadmin.common.constant.StringConsts;
|
||||||
import top.charles7c.cnadmin.common.model.dto.LoginUser;
|
import top.charles7c.cnadmin.common.model.dto.LoginUser;
|
||||||
import top.charles7c.cnadmin.common.model.query.PageQuery;
|
import top.charles7c.cnadmin.common.model.query.PageQuery;
|
||||||
import top.charles7c.cnadmin.common.model.vo.PageDataVO;
|
import top.charles7c.cnadmin.common.model.vo.PageDataVO;
|
||||||
@ -50,6 +51,7 @@ import top.charles7c.cnadmin.monitor.model.vo.*;
|
|||||||
/**
|
/**
|
||||||
* 在线用户 API
|
* 在线用户 API
|
||||||
*
|
*
|
||||||
|
* @author Lion Li(RuoYi-Vue-Plus)
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/1/20 21:51
|
* @since 2023/1/20 21:51
|
||||||
*/
|
*/
|
||||||
@ -64,9 +66,9 @@ public class OnlineUserController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
public R<PageDataVO<OnlineUserVO>> page(@Validated OnlineUserQuery query, @Validated PageQuery pageQuery) {
|
public R<PageDataVO<OnlineUserVO>> page(@Validated OnlineUserQuery query, @Validated PageQuery pageQuery) {
|
||||||
List<LoginUser> loginUserList = new ArrayList<>();
|
List<LoginUser> loginUserList = new ArrayList<>();
|
||||||
List<String> tokenKeyList = StpUtil.searchTokenValue("", 0, -1, false);
|
List<String> tokenKeyList = StpUtil.searchTokenValue(StringConsts.EMPTY, 0, -1, false);
|
||||||
for (String tokenKey : tokenKeyList) {
|
for (String tokenKey : tokenKeyList) {
|
||||||
String token = StrUtil.subAfter(tokenKey, ":", true);
|
String token = StrUtil.subAfter(tokenKey, StringConsts.COLON, true);
|
||||||
// 忽略已过期或失效 Token
|
// 忽略已过期或失效 Token
|
||||||
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < SaTokenDao.NEVER_EXPIRE) {
|
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < SaTokenDao.NEVER_EXPIRE) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user