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 342fb23760..0b10e9fc61 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 @@ -630,44 +630,12 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } // ================== 数据补充 =================== - String year = null, month = null, day = null, sex = null; - - //if (idCard.length() == 15) { - // // 身份证 - // Matcher matcher = PATTERN_15_ID.matcher(idCard); - // if (matcher.matches()) { - // year = "19".concat(matcher.group("year")); - // month = matcher.group("month"); - // day = matcher.group("day"); - // sex = matcher.group("sex"); - // } else { - // String s = "证件号解析错误"; - // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); - // } - //} else if (idCard.length() == 18) { - // // 身份证 - // Matcher matcher = PATTERN_18_ID.matcher(idCard); - // if (matcher.matches()) { - // year = matcher.group("year"); - // month = matcher.group("month"); - // day = matcher.group("day"); - // sex = matcher.group("sex"); - // } else { - // String s = "证件号解析错误"; - // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); - // } - //} else if (idCard.length() == 9) { - // // 护照 - // Matcher matcher = PATTERN_9_PASSPORT.matcher(idCard); - // if (matcher.matches()) { - // idCardType = IdCardTypeEnum.PASSPORT.getType(); - // } - //} else { - // String s = "证件号解析错误"; - // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); - //} - IdCardRegexUtils regexUtilInstance = IdCardRegexUtils.parse(idCard); + if (regexUtilInstance == null) { + String s = "请输入正确的证件号"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); + } + IdCardTypeEnum idCardType = regexUtilInstance.getTypeEnum(); if (idCardType == null || IdCardTypeEnum.OTHERS == idCardType) { @@ -676,6 +644,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } IdCardRegexUtils.ParsedContent parsedResult = regexUtilInstance.getParsedResult(); + String year = null, month = null, day = null, sex = null; if (parsedResult != null) { year = parsedResult.getBirthdayYear(); month = parsedResult.getBirthdayMonth();