|
@@ -2,15 +2,16 @@ package com.ym.mec.common.controller;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
-import com.ym.mec.common.exception.BizException;
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
+import org.springframework.security.access.AccessDeniedException;
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
|
|
|
@ControllerAdvice
|
|
@ControllerAdvice
|
|
public class BaseController {
|
|
public class BaseController {
|
|
@@ -69,8 +70,10 @@ public class BaseController {
|
|
}
|
|
}
|
|
logger.error("System Error", e);
|
|
logger.error("System Error", e);
|
|
// return failed(e.getMessage());
|
|
// return failed(e.getMessage());
|
|
- if(ex instanceof BizException){
|
|
|
|
|
|
+ if(e instanceof BizException){
|
|
return failed(e.getMessage());
|
|
return failed(e.getMessage());
|
|
|
|
+ }else if(e instanceof AccessDeniedException){
|
|
|
|
+ return failed("禁止访问");
|
|
}
|
|
}
|
|
return failed("系统繁忙");
|
|
return failed("系统繁忙");
|
|
}
|
|
}
|