Browse Source

【居民信息】护照正则修改:8-9位字母数字的组合

master
wangxianzhang 3 years ago
parent
commit
99b9d0b46d
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java
  2. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

4
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);

2
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);
}

Loading…
Cancel
Save