demand: 新增寄件人地址不校验企业名称是否为空 修改寄件人地址添加企业名称格式校验

committer: heyu
This commit is contained in:
aike 2025-08-28 16:10:22 +08:00
parent f5991f7076
commit 9196fe5996
3 changed files with 30 additions and 9 deletions

View File

@ -141,8 +141,7 @@ public class EmisCustomerAddressController extends EmisBaseController
@Log(title = "更新客户收寄件地址", businessType = BusinessType.UPDATE)
@PostMapping("/editAddress")
public AjaxResult editAddress(@RequestBody EmisCustomerAddress emisCustomerAddress)
{
public AjaxResult editAddress(@RequestBody EmisCustomerAddress emisCustomerAddress) throws EmisBizError {
return toAjax(emisCustomerAddressService.updateEmisCustomerAddress(emisCustomerAddress));
}
@ -153,8 +152,7 @@ public class EmisCustomerAddressController extends EmisBaseController
@PreAuthorize("@ss.hasPermi('emis:emisCustomerAddress:edit')")
@Log(title = "客户收寄件地址", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmisCustomerAddress emisCustomerAddress)
{
public AjaxResult edit(@RequestBody EmisCustomerAddress emisCustomerAddress) throws EmisBizError {
return toAjax(emisCustomerAddressService.updateEmisCustomerAddress(emisCustomerAddress));
}

View File

@ -50,7 +50,7 @@ public interface IEmisCustomerAddressService
* @param emisCustomerAddress 客户收寄件地址
* @return 结果
*/
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress);
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress) throws EmisBizError;
/**
* 批量删除客户收寄件地址

View File

@ -12,6 +12,8 @@ package com.xdadan.erp.emis.service.impl;
import java.util.List;
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 org.springframework.beans.factory.annotation.Autowired;
@ -69,8 +71,21 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I
emisCustomerAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode());
emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName());
// 创建用户
return createCustomerAddressNew(emisCustomerAddress);
// 验证企业名称格式
if (!validateEnterpriseName(emisCustomerAddress.getEnterpriseName())) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业名称不能包含空格、回车、@、#、$、%、&、数字等特殊符号");
}
// 验证企业税号格式
if (!validateEnterpriseTaxId(emisCustomerAddress.getEnterpriseTaxId())) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业税号必须为8-18位数字和大写字母组成,不能包含汉字、空格等特殊符号");
}
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddress);
if (CollectionUtil.isEmpty(emisCustomerAddressList)) {
// 不重复的情况则 创建地址
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddress);
}
return 1;
}
/**
@ -80,12 +95,20 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I
* @return 结果
*/
@Override
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress)
{
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress) throws EmisBizError {
// emisCustomerAddress.preUpdate();
// 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位数字和大写字母组成,不能包含汉字、空格等特殊符号");
}
return emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
}