demand: 新增寄件人地址不校验企业名称是否为空 修改寄件人地址添加企业名称格式校验
committer: heyu
This commit is contained in:
parent
9196fe5996
commit
6f73edd3b1
@ -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<EmisCustomerAddress> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user