Commit 2e021144510f4a084b7135196396dfa31af69017
1 parent
657723bb13
Exists in
master
and in
1 other branch
增加权限
Showing 1 changed file with 11 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java
View file @
2e02114
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.platform.common.result.BaseResponse; |
| 6 | 6 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 7 | 7 | import org.apache.commons.collections.CollectionUtils; |
| 8 | +import org.springframework.aop.AopInvocationException; | |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 10 | import org.springframework.dao.DataAccessResourceFailureException; |
| 10 | 11 | import org.springframework.http.HttpStatus; |
| ... | ... | @@ -48,6 +49,16 @@ |
| 48 | 49 | @ResponseBody |
| 49 | 50 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| 50 | 51 | public BaseResponse handException(DataAccessResourceFailureException e) { |
| 52 | + ExceptionUtils.catchException(e, e.getMessage()); | |
| 53 | + BaseResponse error = new BaseResponse(); | |
| 54 | + error.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 55 | + error.setErrormsg("错误"); | |
| 56 | + return error; | |
| 57 | + } | |
| 58 | + @ExceptionHandler(org.springframework.aop.AopInvocationException.class) | |
| 59 | + @ResponseBody | |
| 60 | + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) | |
| 61 | + public BaseResponse handException(AopInvocationException e) { | |
| 51 | 62 | ExceptionUtils.catchException(e, e.getMessage()); |
| 52 | 63 | BaseResponse error = new BaseResponse(); |
| 53 | 64 | error.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); |