refactor: 优化部分代码

修复 Sonar 扫描问题
This commit is contained in:
2024-01-27 14:33:15 +08:00
parent 9c0cd2fd9d
commit fe0bff3d3e
13 changed files with 56 additions and 44 deletions

View File

@@ -37,6 +37,9 @@ import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoC
@Slf4j
abstract class SaTokenDaoConfiguration {
private SaTokenDaoConfiguration() {
}
/**
* 自定义持久层实现类-Redis
*/

View File

@@ -40,7 +40,7 @@ public class GlobalSaTokenExceptionHandler {
* 认证异常-登录认证
*/
@ExceptionHandler(NotLoginException.class)
public R handleNotLoginException(NotLoginException e, HttpServletRequest request) {
public R<Void> handleNotLoginException(NotLoginException e, HttpServletRequest request) {
log.error("请求地址 [{}],认证失败,无法访问系统资源。", request.getRequestURI(), e);
String errorMsg = switch (e.getType()) {
case NotLoginException.KICK_OUT -> "您已被踢下线。";
@@ -54,7 +54,7 @@ public class GlobalSaTokenExceptionHandler {
* 认证异常-权限认证
*/
@ExceptionHandler(NotPermissionException.class)
public R handleNotPermissionException(NotPermissionException e, HttpServletRequest request) {
public R<Void> handleNotPermissionException(NotPermissionException e, HttpServletRequest request) {
log.error("请求地址 [{}],权限码校验失败。", request.getRequestURI(), e);
return R.fail(HttpStatus.FORBIDDEN.value(), "没有访问权限,请联系管理员授权");
}
@@ -63,7 +63,7 @@ public class GlobalSaTokenExceptionHandler {
* 认证异常-角色认证
*/
@ExceptionHandler(NotRoleException.class)
public R handleNotRoleException(NotRoleException e, HttpServletRequest request) {
public R<Void> handleNotRoleException(NotRoleException e, HttpServletRequest request) {
log.error("请求地址 [{}],角色权限校验失败。", request.getRequestURI(), e);
return R.fail(HttpStatus.FORBIDDEN.value(), "没有访问权限,请联系管理员授权");
}