This commit is contained in:
linfso 2024-07-23 12:06:18 +08:00
parent 2de12b6f9f
commit 2f0990962c
2 changed files with 30 additions and 2 deletions

View File

@ -13,7 +13,10 @@ package com.xdadan.erp.web.emis;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -107,7 +110,19 @@ public class EmisBaseInvoiceInfoController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody EmisBaseInvoiceInfo emisBaseInvoiceInfo) public AjaxResult add(@RequestBody EmisBaseInvoiceInfo emisBaseInvoiceInfo)
{ {
return toAjax(emisBaseInvoiceInfoService.insertEmisBaseInvoiceInfo(emisBaseInvoiceInfo));
try {
return toAjax(emisBaseInvoiceInfoService.insertEmisBaseInvoiceInfo(emisBaseInvoiceInfo));
}
catch (DuplicateKeyException e) {
e.printStackTrace();
return AjaxResult.error("税号重复");
}
catch (Exception ex){
ex.printStackTrace();
return AjaxResult.error("系统异常");
}
} }
/** /**

View File

@ -14,6 +14,7 @@ package com.xdadan.erp.web.emis;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -107,7 +108,19 @@ public class EmisCustomerInvoiceInfoController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody EmisCustomerInvoiceInfo emisCustomerInvoiceInfo) public AjaxResult add(@RequestBody EmisCustomerInvoiceInfo emisCustomerInvoiceInfo)
{ {
return toAjax(emisCustomerInvoiceInfoService.insertEmisCustomerInvoiceInfo(emisCustomerInvoiceInfo));
try {
return toAjax(emisCustomerInvoiceInfoService.insertEmisCustomerInvoiceInfo(emisCustomerInvoiceInfo));
}
catch (DuplicateKeyException e) {
e.printStackTrace();
return AjaxResult.error("税号重复");
}
catch (Exception ex){
ex.printStackTrace();
return AjaxResult.error("系统异常");
}
} }
/** /**