diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java index 87c7429c4..b498079ab 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java @@ -9,7 +9,6 @@ package com.xdadan.erp.emis.service.impl; import java.util.List; -import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,9 +21,6 @@ public class EmisCustomsLevelServiceImpl implements IEmisCustomsLevelService { @Autowired private EmisCustomsLevelMapper emisCustomsLevelMapper; - private static final Pattern INVALID_NAME_PATTERN = Pattern - .compile("[\\s`~!@#$%^&*()+=|{}':;',\\[\\]\\.<>/?!¥…()—【】‘;:”“’。,、?]"); - /** * 将前端传来的name转换为对应的code * @@ -110,8 +106,8 @@ public class EmisCustomsLevelServiceImpl implements IEmisCustomsLevelService { if (StringUtils.isBlank(po.getCustomerName())) { throw new IllegalArgumentException("客户名称不能为空"); } - if (INVALID_NAME_PATTERN.matcher(po.getCustomerName()).find()) { - throw new IllegalArgumentException("客户名称不能包含空格或特殊符号"); + if (!po.getCustomerName().equals(po.getCustomerName().trim())) { + throw new IllegalArgumentException("客户名称头尾不能有空格"); } if (StringUtils.isBlank(po.getCategory()) || !("1".equals(po.getCategory()) || "2".equals(po.getCategory()) || "3".equals(po.getCategory()) || "4".equals(po.getCategory()))) {