图片修改,必填的进行非空校验;非必填的可以更新为空
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.HttpMessage;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -24,6 +25,8 @@ import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.html.EscapeUtil;
|
||||
|
||||
import java.sql.DataTruncation;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
@@ -34,6 +37,31 @@ public class GlobalExceptionHandler
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* JSON入参序列化异常HttpMessageNotReadableException
|
||||
*/
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',JSON入参序列化异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库异常处理:DataTruncation
|
||||
*/
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
public AjaxResult handleDataIntegrityViolationException(DataIntegrityViolationException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',数据库异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user