diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisNotCalcAgingController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisNotCalcAgingController.java index 6691d6d2a..1cf6fae71 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisNotCalcAgingController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisNotCalcAgingController.java @@ -14,6 +14,7 @@ package com.xdadan.erp.web.emis; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -91,7 +92,12 @@ public class EmisNotCalcAgingController extends BaseController @PostMapping public AjaxResult add(@RequestBody EmisNotCalcAging emisNotCalcAging) { - return toAjax(emisNotCalcAgingService.insertEmisNotCalcAging(emisNotCalcAging)); + try { + return toAjax(emisNotCalcAgingService.insertEmisNotCalcAging(emisNotCalcAging)); + } catch (DuplicateKeyException e) { + e.printStackTrace(); + return AjaxResult.error("数据重复!"); + } } /** @@ -102,7 +108,12 @@ public class EmisNotCalcAgingController extends BaseController @PutMapping public AjaxResult edit(@RequestBody EmisNotCalcAging emisNotCalcAging) { - return toAjax(emisNotCalcAgingService.updateEmisNotCalcAging(emisNotCalcAging)); + try { + return toAjax(emisNotCalcAgingService.updateEmisNotCalcAging(emisNotCalcAging)); + } catch (DuplicateKeyException e) { + e.printStackTrace(); + return AjaxResult.error("数据重复!"); + } } /**