Explorar o código

修正alarmCategory类型;增加全局MP db异常捕获

taosj hai 12 horas
pai
achega
65252da98b

+ 9 - 0
forecast-backend-server/src/main/java/com/ufo/base/framework/web/exception/GlobalExceptionHandler.java

@@ -1,8 +1,11 @@
 package com.ufo.base.framework.web.exception;
 
+import java.util.UUID;
+
 import javax.servlet.http.HttpServletRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.validation.BindException;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
@@ -127,5 +130,11 @@ public class GlobalExceptionHandler
         return AjaxResult.error(message);
     }
 
+    @ExceptionHandler(DataAccessException.class)
+    public AjaxResult handleDbException(DataAccessException e){
+        String uuid = UUID.randomUUID().toString();
+        log.error("error happened, traceid# {}, error message {}", uuid, e);
+        return AjaxResult.error("系统异常,请联系管理员。TRACEID# " + uuid);
+    }
 
 }

+ 1 - 1
forecast-backend-server/src/main/java/com/ufo/project/alarm/vo/request/AlarmRecordQueryRequest.java

@@ -10,7 +10,7 @@ public class AlarmRecordQueryRequest {
     /**
      * 告警类别
      */
-    private Integer alarmCategory;
+    private String alarmCategory;
 
     /**
      *  告警等级