疯狂的狮子Li
2021-11-28 d4e1d4ec3858c4cb4d677e183fea22ec23ea89bf
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
@@ -9,7 +9,6 @@
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -42,8 +41,7 @@
     * 角色校验异常
     */
    @ExceptionHandler(NotRoleException.class)
    public AjaxResult handleAccessDeniedException(NotRoleException e, HttpServletRequest request)
    {
    public AjaxResult<Void> handleAccessDeniedException(NotRoleException e, HttpServletRequest request) {
        String requestURI = request.getRequestURI();
        log.error("请求地址'{}',角色校验失败'{}'", requestURI, e.getMessage());
        return AjaxResult.error(HttpStatus.HTTP_FORBIDDEN, "没有角色,请联系管理员授权");
@@ -53,11 +51,10 @@
     * 认证失败
     */
    @ExceptionHandler(NotLoginException.class)
    public AjaxResult handleAccessDeniedException(NotLoginException e, HttpServletRequest request)
    {
    public AjaxResult<Void> handleAccessDeniedException(NotLoginException e, HttpServletRequest request) {
        String requestURI = request.getRequestURI();
        log.error("请求访问:{},认证失败,无法访问系统资源", requestURI, e.getMessage());
        return AjaxResult.error(HttpStatus.HTTP_UNAUTHORIZED, StringUtils.format("请求访问:{},认证失败,无法访问系统资源", requestURI));
        log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
        return AjaxResult.error(HttpStatus.HTTP_UNAUTHORIZED, StringUtils.format("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI));
    }
    /**