From 6f73edd3b122dfa8812cb50f846571a1918db569 Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Thu, 28 Aug 2025 16:15:16 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20=E6=96=B0=E5=A2=9E=E5=AF=84=E4=BB=B6?= =?UTF-8?q?=E4=BA=BA=E5=9C=B0=E5=9D=80=E4=B8=8D=E6=A0=A1=E9=AA=8C=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=90=8D=E7=A7=B0=E6=98=AF=E5=90=A6=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=AF=84=E4=BB=B6=E4=BA=BA=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=B7=BB=E5=8A=A0=E4=BC=81=E4=B8=9A=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../impl/EmisCustomerAddressServiceImpl.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomerAddressServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomerAddressServiceImpl.java index d695eaeb3..e58fdbee4 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomerAddressServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomerAddressServiceImpl.java @@ -16,6 +16,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType; import com.xdadan.erp.emis.domain.exception.EmisBizError; import com.xdadan.erp.emis.service.EmisBaseService; +import jodd.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.xdadan.erp.emis.domain.EmisCustomerAddress; @@ -71,15 +72,7 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I emisCustomerAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode()); emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName()); - // 验证企业名称格式 - if (!validateEnterpriseName(emisCustomerAddress.getEnterpriseName())) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业名称不能包含空格、回车、@、#、$、%、&、数字等特殊符号"); - } - - // 验证企业税号格式 - if (!validateEnterpriseTaxId(emisCustomerAddress.getEnterpriseTaxId())) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业税号必须为8-18位数字和大写字母组成,不能包含汉字、空格等特殊符号"); - } + checkEnterprise(emisCustomerAddress); List emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddress); if (CollectionUtil.isEmpty(emisCustomerAddressList)) { // 不重复的情况则 创建地址 @@ -100,16 +93,25 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I // emisCustomerAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode()); // emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName()); + checkEnterprise(emisCustomerAddress); + + return emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress); + } + + private void checkEnterprise(EmisCustomerAddress emisCustomerAddress) throws EmisBizError { // 验证企业名称格式 - if (!validateEnterpriseName(emisCustomerAddress.getEnterpriseName())) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业名称不能包含空格、回车、@、#、$、%、&、数字等特殊符号"); + if (StringUtil.isNotBlank(emisCustomerAddress.getEnterpriseName())) { + if (!validateEnterpriseName(emisCustomerAddress.getEnterpriseName())) { + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业名称不能包含空格、回车、@、#、$、%、&、数字等特殊符号"); + } } // 验证企业税号格式 - if (!validateEnterpriseTaxId(emisCustomerAddress.getEnterpriseTaxId())) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业税号必须为8-18位数字和大写字母组成,不能包含汉字、空格等特殊符号"); + if (StringUtil.isNotBlank(emisCustomerAddress.getEnterpriseTaxId())) { + if (!validateEnterpriseTaxId(emisCustomerAddress.getEnterpriseTaxId())) { + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业税号必须为8-18位数字和大写字母组成,不能包含汉字、空格等特殊符号"); + } } - return emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress); } /**