From e3241a8a2b867fb60cd63edd64744a1fbfae0d1d Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: 星期三, 11 十二月 2024 17:14:30 +0800
Subject: [PATCH] 更改查询方式

---
 assess-framework/src/main/java/com/gkhy/assess/framework/exception/GlobalExceptionHandler.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/assess-framework/src/main/java/com/gkhy/assess/framework/exception/GlobalExceptionHandler.java b/assess-framework/src/main/java/com/gkhy/assess/framework/exception/GlobalExceptionHandler.java
index 6d6083b..a92ec25 100644
--- a/assess-framework/src/main/java/com/gkhy/assess/framework/exception/GlobalExceptionHandler.java
+++ b/assess-framework/src/main/java/com/gkhy/assess/framework/exception/GlobalExceptionHandler.java
@@ -4,6 +4,7 @@
 import com.gkhy.assess.common.exception.ApiException;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -79,6 +80,16 @@
     /**
      * 拦截未知的运行时异常
      */
+    @ExceptionHandler(UnauthorizedException.class)
+    public CommonResult handleUnauthorizedException(RuntimeException ex, HttpServletRequest request)
+    {
+        writeExceptionLogFile(ex);
+        return CommonResult.failed("权限不足,无权操作!");
+    }
+
+    /**
+     * 拦截未知的运行时异常
+     */
     @ExceptionHandler(RuntimeException.class)
     public CommonResult handleRuntimeException(RuntimeException ex, HttpServletRequest request)
     {
@@ -105,7 +116,7 @@
         if (request!=null) {
             url=request.getRequestURI();
         }
-        log.error("error={}",ex);
+        log.error("error:",ex);
         log.error(ex.getMessage()+",url={}",url);
     }
 }

--
Gitblit v1.9.2