| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.converter.HttpMessageNotReadableException; |
| | | import org.springframework.security.access.AccessDeniedException; |
| | | import org.springframework.validation.BindException; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | |
| | | @ExceptionHandler(HttpMessageNotReadableException.class) |
| | | public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',参数异常'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通用异常 |
| | |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) |
| | | { |
| | | log.error(e.getMessage(), e); |
| | | //log.error(e.getMessage(), e); |
| | | //log.error(e.getBindingResult().getFieldError()+""); |
| | | String message = e.getBindingResult().getFieldError().getDefaultMessage(); |
| | | return AjaxResult.error(message); |
| | | return AjaxResult.error(ResultConstants.PARAM_ERROR.getCode(),message); |
| | | } |
| | | |
| | | /** |