From feba5232fa66fea5e7e7d040225dde157819d398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Fri, 8 Jan 2021 08:38:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E5=B1=80=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessExceptionHandlerAdvice.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java index e2c1781..6cbdfcc 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java @@ -55,7 +55,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(value = BusinessException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse serviceErrorException(HttpServletRequest request, BusinessException exception) { //堆栈信息转为字符串 log.info(ExceptionUtil.stacktraceToString(exception)); @@ -72,7 +72,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(value = MethodArgumentNotValidException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handleInvalidMethodArgException(HttpServletRequest request, MethodArgumentNotValidException exception) { //堆栈信息转为字符串 log.info(ExceptionUtil.stacktraceToString(exception)); @@ -91,7 +91,7 @@ public class BusinessExceptionHandlerAdvice { body.put("errors", JsonUtils.objectToJson(invalidArguments)); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); body.put("path", request.getRequestURI()); - return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数错误", Convert.toStr(body)); + return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数验证错误", Convert.toStr(body)); } /** @@ -102,7 +102,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(value = BindException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse methodArgumentNotValidHandler( HttpServletRequest request, BindException exception) { //按需重新封装需要返回的错误信息 @@ -147,7 +147,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(MissingServletRequestParameterException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handleMissingParameterException(HttpServletRequest request, MissingServletRequestParameterException exception) { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); @@ -166,7 +166,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(DataAccessException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handlerDataAccessException(HttpServletRequest request, DataAccessException exception) { log.error(ExceptionUtil.stacktraceToString(exception)); Map body = new HashMap<>(); @@ -184,7 +184,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(EmptyResultDataAccessException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handleDataEmptyException(HttpServletRequest request, EmptyResultDataAccessException exception) { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); @@ -201,7 +201,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(DuplicateKeyException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handleDataDualException(HttpServletRequest request, DuplicateKeyException exception) { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); @@ -218,7 +218,7 @@ public class BusinessExceptionHandlerAdvice { * @return 响应 */ @ExceptionHandler(MethodArgumentTypeMismatchException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseStatus(HttpStatus.OK) public BaseResponse handleMethodArgumentTypeException(HttpServletRequest request, MethodArgumentTypeMismatchException exception) { Map body = new HashMap<>(); body.put("errors", exception.getMessage());