diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java index d44e9bb3fb..96d7d02a62 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java @@ -25,7 +25,7 @@ public class IdCardRegexUtils { /** * 9位护照 */ - private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z]{2}\\d{7}$|^[a-zA-Z]{1}\\d{8}$"); + private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z0-9]{8,9}$"); private String inputText; @@ -86,7 +86,7 @@ public class IdCardRegexUtils { } } - if (input.length() == 9) { + if (input.length() == 9 || input.length() == 8) { Matcher matcher = PATTERN_9_PASSPORT.matcher(input); if (matcher.matches()) { return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 3976b304fc..2a57869b36 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -632,7 +632,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res // ================== 数据补充 =================== IdCardRegexUtils regexUtilInstance = IdCardRegexUtils.parse(idCard); if (regexUtilInstance == null) { - String s = "请输入正确的证件号"; + String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); }