From 9242d2fef64674d48c00c8ee5a0672092b8d8383 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 22 Aug 2022 09:08:50 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/enums/IdCardTypeEnum.java | 27 ++++++++ .../com/epmet/entity/IcResiUserEntity.java | 7 +- .../impl/IcResiUserImportServiceImpl.java | 66 ++++++++++++------- 3 files changed, 74 insertions(+), 26 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java new file mode 100644 index 0000000000..7ca7f04641 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java @@ -0,0 +1,27 @@ +package com.epmet.commons.tools.enums; + +/** + * 唯一整件类型 + */ +public enum IdCardTypeEnum { + + OTHERS("0", "其他"), + SFZH("1", "身份证号"), + PASSPORT("2", "护照"); + + private String type; + private String name; + + IdCardTypeEnum(String type, String name) { + this.type = type; + this.name = name; + } + + public String getType() { + return type; + } + + public String getName() { + return name; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java index f787399b23..d7849f5592 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java @@ -96,10 +96,15 @@ public class IcResiUserEntity extends BaseEpmetEntity { private String gender; /** - * 身份证号 + * 证件号 */ private String idCard; + /** + * 证件类型。1:身份证号;2:护照 + */ + private String idCardType; + /** * 出生日期 */ 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 7f8921443f..adc9a94eb4 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 @@ -18,6 +18,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -98,6 +99,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res */ private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); + /** + * 9位护照 + */ + private final Pattern PATTERN_9_PASSPORT = Pattern.compile("^\\w{2}\\d{7}|\\w{1}\\d{8}$"); + /** * 日期解析,不含时间 */ @@ -623,14 +629,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res if (StringUtils.isBlank(idCard)) { log.debug("【居民信息导入】specifiedCheck身份证号为空的:{},{}", mobile, name); - String errorMsg = "身份证号不能为空"; + String errorMsg = "证件号不能为空"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } - if (idCard.length() != 18 && idCard.length() != 15) { - errors.add("身份证号长度错误"); - } - if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) { errors.add("手机号长度错误"); } @@ -642,12 +644,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } // ================== 数据补充 =================== - String year; - String month; - String day; - String sex; + String year = null, month = null, day = null, sex = null; + + // 证件类型,默认是1身份证号 + String idCardType = IdCardTypeEnum.SFZH.getType(); if (idCard.length() == 15) { + // 身份证 Matcher matcher = PATTERN_15_ID.matcher(idCard); if (matcher.matches()) { year = "19".concat(matcher.group("year")); @@ -655,10 +658,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res day = matcher.group("day"); sex = matcher.group("sex"); } else { - String s = "身份证号解析错误"; + 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"); @@ -666,28 +670,40 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res day = matcher.group("day"); sex = matcher.group("sex"); } else { - String s = "身份证号解析错误"; + 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 = "身份证号位数错误"; + String s = "证件号解析错误"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); } - // 出生日期 & 年龄 - LocalDate birthday = null; - try { - birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); - } catch (DateTimeException e) { - throw new EpmetException("身份证号中日期信息错误"); - } - int age = Period.between(birthday, LocalDate.now()).getYears(); + // 存储证件类型 + columnAndValues.put("ID_CARD_TYPE", idCardType); - // 性别 & 生日 & 老年人 - Boolean isMale = (Integer.parseInt(sex) % 2) == 1; - columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day))); - columnAndValues.put("GENDER", isMale ? "1" : "2"); - columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0"); + if (idCardType.equals(IdCardTypeEnum.SFZH.getType())) { + //只有证件类型是身份证号才做相关解析 + // 出生日期 & 年龄 + LocalDate birthday = null; + try { + birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); + } catch (DateTimeException e) { + throw new EpmetException("身份证号中日期信息错误"); + } + int age = Period.between(birthday, LocalDate.now()).getYears(); + + // 性别 & 生日 & 老年人 + Boolean isMale = (Integer.parseInt(sex) % 2) == 1; + columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month, day))); + columnAndValues.put("GENDER", isMale ? "1" : "2"); + columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0"); + } } /** From e5a08afb8c2718aaff10b15ab5075b8c32660d96 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 22 Aug 2022 10:18:31 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E5=B7=A5=E5=85=B7=E7=B1=BB=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E4=BF=AE=E6=94=B9=E5=B1=85=E6=B0=91=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=BA=E6=AD=A3=E5=88=99=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/utils/IdCardRegexUtils.java | 123 ++++++++++++++++++ .../impl/IcResiUserImportServiceImpl.java | 101 +++++++------- 2 files changed, 173 insertions(+), 51 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java 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 new file mode 100644 index 0000000000..deaf9997c1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java @@ -0,0 +1,123 @@ +package com.epmet.commons.tools.utils; + +import com.epmet.commons.tools.enums.IdCardTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 唯一整件正则工具 + */ +public class IdCardRegexUtils { + + /** + * 15位身份证号的正则表达式 + */ + private static final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?\\d{2})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)$"); + /** + * 18位身份证号的正则表达式 + */ + private static final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); + + /** + * 9位护照 + */ + private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^\\w{2}\\d{7}$|^\\w{1}\\d{8}$"); + + private String inputText; + + private Matcher matcher; + + private IdCardTypeEnum idCardType; + + private IdCardRegexUtils(IdCardTypeEnum idCardType, Matcher matcher, String inputText) { + this.idCardType = idCardType; + this.matcher = matcher; + this.inputText = inputText; + } + + /** + * 正则解析结果 + */ + @Data + @AllArgsConstructor + @NoArgsConstructor + public static class ParsedContent { + private String birthdayYear; + private String birthdayMonth; + private String birthdayDay; + private String sex; + } + + /** + * 解析正则 + * @param input + * @return + */ + public static IdCardRegexUtils parse(String input) { + if (input == null) { + return null; + } + + if (input.length() == 15) { + Matcher matcher = PATTERN_15_ID.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input); + } + } + + if (input.length() == 18) { + Matcher matcher = PATTERN_18_ID.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input); + } + } + + if (input.length() == 9) { + Matcher matcher = PATTERN_9_PASSPORT.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input); + } + } + return null; + } + + /** + * 获取解析结果 + * @return + */ + public ParsedContent getParsedResult() { + if (matcher == null || idCardType == null) { + return null; + } + + if (IdCardTypeEnum.SFZH == idCardType) { + //是身份证号,可以解析 + String year; + if (inputText.length() == 15) { + // 15位身份证号,years前需要拼上19 + year = "19".concat(matcher.group("year")); + } else { + year = matcher.group("year"); + } + String month = matcher.group("month"); + String day = matcher.group("day"); + String sex = matcher.group("sex"); + return new ParsedContent(year, month, day, sex); + } + + // 其他类型暂时不可解析 + return null; + } + + /** + * 获取类型枚举 + * @return + */ + public IdCardTypeEnum getTypeEnum() { + return idCardType; + } +} 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 adc9a94eb4..342fb23760 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 @@ -90,20 +90,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res public static final List controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange"); public static final List controlGroup2 = Arrays.asList("select", "radio", "cascader"); - /** - * 15位身份证号的正则表达式 - */ - private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?\\d{2})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)$"); - /** - * 18位身份证号的正则表达式 - */ - private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); - - /** - * 9位护照 - */ - private final Pattern PATTERN_9_PASSPORT = Pattern.compile("^\\w{2}\\d{7}|\\w{1}\\d{8}$"); - /** * 日期解析,不含时间 */ @@ -646,48 +632,61 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res // ================== 数据补充 =================== String year = null, month = null, day = null, sex = null; - // 证件类型,默认是1身份证号 - String idCardType = IdCardTypeEnum.SFZH.getType(); - - 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 = "证件号解析错误"; + //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); + IdCardTypeEnum idCardType = regexUtilInstance.getTypeEnum(); + + if (idCardType == null || IdCardTypeEnum.OTHERS == idCardType) { + String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); } + IdCardRegexUtils.ParsedContent parsedResult = regexUtilInstance.getParsedResult(); + if (parsedResult != null) { + year = parsedResult.getBirthdayYear(); + month = parsedResult.getBirthdayMonth(); + day = parsedResult.getBirthdayDay(); + sex = parsedResult.getSex(); + } + // 存储证件类型 - columnAndValues.put("ID_CARD_TYPE", idCardType); + columnAndValues.put("ID_CARD_TYPE", idCardType.getType()); - if (idCardType.equals(IdCardTypeEnum.SFZH.getType())) { + if (idCardType == IdCardTypeEnum.SFZH) { //只有证件类型是身份证号才做相关解析 // 出生日期 & 年龄 LocalDate birthday = null; From 9611fd719c2b882e44c6418afe7c75eec8f19cf5 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 22 Aug 2022 13:49:53 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=81=E5=AF=BC=E5=85=A5=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IcResiUserServiceImpl.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index d8f57e4e81..3734309c8c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -294,6 +294,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl Date: Mon, 22 Aug 2022 14:24:22 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=AF=81=E4=BB=B6?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/IdCardRegexUtils.java | 12 +++++++++++- .../form/resi/ResiVolunteerAuthenticateFormDTO.java | 2 +- .../epmet/controller/ResiVolunteerController.java | 8 ++++++++ .../mine/controller/PersonalCenterController.java | 10 ++++++++++ .../java/com/epmet/dto/form/EditInfoFormDTO.java | 2 +- .../java/com/epmet/dto/form/IcTripReportFormDTO.java | 2 +- .../controller/IcTripReportRecordController.java | 7 +++++++ 7 files changed, 39 insertions(+), 4 deletions(-) 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 deaf9997c1..bc56e52604 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 @@ -52,13 +52,23 @@ public class IdCardRegexUtils { private String sex; } + /** + * desc:校验输入的证件号是否合法 + * @param input + * @return + */ + public static boolean validateIdCard(String input){ + IdCardRegexUtils parse = IdCardRegexUtils.parse(input); + return parse != null; + } + /** * 解析正则 * @param input * @return */ public static IdCardRegexUtils parse(String input) { - if (input == null) { + if (input == null || input.trim().length() == 0) { return null; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java index 877abcb74c..2169dda0d8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java @@ -59,7 +59,7 @@ public class ResiVolunteerAuthenticateFormDTO implements Serializable { /** * 身份证号码 */ - @NotBlank(message = "身份证号码不能为空", groups = {AddUserShowGroup.class }) + @NotBlank(message = "证件号能为空", groups = {AddUserShowGroup.class }) private String idNum; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index b54acc67ec..22e724e5a1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.SystemMessageType; @@ -38,6 +39,7 @@ import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.send.SendMqMsgUtil; import com.epmet.service.VolunteerInfoService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -72,6 +74,12 @@ public class ResiVolunteerController { formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class); + if (StringUtils.isNotBlank(formDTO.getIdNum())){ + boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdNum()); + if (!b){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号"); + } + } volunteerInfoService.authenticate(formDTO); //发送志愿者人员消息变动 diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java index 48ea31f06b..8666aca88c 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java @@ -1,7 +1,10 @@ package com.epmet.modules.mine.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.EditInfoFormDTO; @@ -10,6 +13,7 @@ import com.epmet.dto.form.SendCodeFormDTO; import com.epmet.modules.mine.service.PersonalCenterService; import com.epmet.resi.mine.dto.result.InitInfoResultDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -55,6 +59,12 @@ public class PersonalCenterController { formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO,EditInfoFormDTO.AddUserShowGroup.class,EditInfoFormDTO.AddUserInternalGroup.class); + if (StringUtils.isNotBlank(formDTO.getIdNum())){ + boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdNum()); + if (!b){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号"); + } + } personalCenterService.editInfo(tokenDto, formDTO); return new Result(); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java index 7917113509..6ef7eb715e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java @@ -47,7 +47,7 @@ public class EditInfoFormDTO implements Serializable { private String name; //@NotBlank(message = "身份证号不能为空") - @Length(max=18,message = "身份证号不能超过18位",groups = AddUserShowGroup.class) + @Length(max=18,message = "证件号不能超过18位",groups = AddUserShowGroup.class) //别的小程序不统一升级,没办法限制必填。 private String idNum; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index d9a7f4d565..5c7a53e335 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java @@ -57,7 +57,7 @@ public class IcTripReportFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) + @NotBlank(message = "证件号能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String idCard; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 6e1aff48ff..cfc1313c69 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; @@ -159,6 +160,12 @@ public class IcTripReportRecordController implements ResultDataResolver { formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserType(IcResiUserConstant.USER_TYPE_RESI); ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.ResiUserRequired.class,IcTripReportFormDTO.ResiUserInternalGroup.class); + if (StringUtils.isNotBlank(formDTO.getIdCard())){ + boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdCard()); + if (!b){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号"); + } + } return new Result().ok(icTripReportRecordService.resiSave(formDTO)); } From e6b392d988d3f07466abe126c975e424ef98dabf Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 22 Aug 2022 15:25:03 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E5=87=BA=E7=94=9F=E3=80=81=E8=BF=81=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IcBirthRecordServiceImpl.java | 12 ++++++++++++ .../service/impl/IcMoveInRecordServiceImpl.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java index 163d15c563..37a65965d7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java @@ -7,12 +7,15 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.GenderEnum; import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.enums.RelationshipEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcBirthRecordDao; import com.epmet.dao.IcResiUserDao; @@ -144,6 +147,15 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl Date: Mon, 22 Aug 2022 16:51:11 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E8=AE=BF=E5=AE=A2?= =?UTF-8?q?=E3=80=81=E4=BF=A1=E6=81=AF=E9=87=87=E9=9B=86=E3=80=81=E6=88=BF?= =?UTF-8?q?=E5=B1=8B=E7=A7=9F=E8=B5=81=E3=80=81=E5=85=9A=E5=91=98=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E3=80=81=E5=B1=85=E6=B0=91=E6=B3=A8=E5=86=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=8C=EF=BC=8C=E5=BE=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PartyMemberConfirmServiceImpl.java | 9 +++++++++ .../controller/IcResiCollectController.java | 16 ++++++++++++++++ .../IcResiCollectVisitorController.java | 9 +++++++++ .../controller/IcResiUserController.java | 18 ++++++++++++++++++ .../service/impl/UserResiInfoServiceImpl.java | 13 +++++++++++++ .../excel/ic_resi_import_template.xls | Bin 74240 -> 74240 bytes 6 files changed, 65 insertions(+) diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index 74b9ba9844..961197076d 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -10,6 +10,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.*; import com.epmet.dto.*; @@ -167,6 +168,14 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService @Transactional(rollbackFor = Exception.class) public Result submit(PartymemberInfoDTO partyMemberInfoDTO) { log.info("submit param:{}",JSON.toJSONString(partyMemberInfoDTO)); + + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(partyMemberInfoDTO.getIdCard()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + // 证件类型判断----end---- + Result result = new Result(); //校验手机验证码是否正常 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index cca091439f..d508f670e8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -4,15 +4,19 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.IcResiCollectService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -180,6 +184,18 @@ public class IcResiCollectController { //效验数据 ValidatorUtils.validateEntity(formDTO); formDTO.setOrigin("internal");//固定为内部 + + // 证件类型判断----start---- + for (IcResiCollectMemFormDTO member : formDTO.getMemberList()) { + if (StringUtils.isNotBlank(member.getIdNum())) { + IdCardRegexUtils regex = IdCardRegexUtils.parse(member.getIdNum()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + } + } + // 证件类型判断----end---- + return icResiCollectService.saveCollectInfo(formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java index 60995a0211..a3f86c1c28 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java @@ -3,9 +3,12 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -117,6 +120,12 @@ public class IcResiCollectVisitorController { public Result saveInfo(@RequestBody SaveCollectVisitorFormDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto); + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(dto.getIdCard()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + // 证件类型判断----end---- return icResiCollectVisitorService.saveInfo(dto); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 7604ebc5c7..7ac26844dd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -307,12 +307,30 @@ public class IcResiUserController implements ResultDataResolver { */ @PostMapping("rent/updateimage") public Result updateImage(@LoginUser TokenDto tokenDto, @RequestBody RentTenantFormDTO formDTO) { + + // 身份证号验证 + if (StringUtils.isNotBlank(formDTO.getUser().getIdCard())) { + checkIdCard(formDTO.getUser().getIdCard()); + } + + if (StringUtils.isNotBlank(formDTO.getIdCard())) { + checkIdCard(formDTO.getIdCard()); + } + String resiUserId = icResiUserService.updateImage(tokenDto, formDTO); //推送MQ事件 editResiMq(formDTO.getCustomerId(), resiUserId); return new Result(); } + private void checkIdCard(String idCard) { + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(idCard); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + } + private void editResiMq(String customerId, String userId) { //推送MQ事件 IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index 44cd7c12a3..8e9af036e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -26,10 +26,13 @@ import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserConstant; @@ -243,6 +246,16 @@ public class UserResiInfoServiceImpl extends BaseServiceImplcms;EPk z@#w>-R!hQ-q_mTa8BMG8o-t7s>`=-yozPP42tD8K=F*OCX76`@-~W8)`=4{ayA#iG z*>hYjlXW@(Afs+nVy=YV@oB>oA&O@Jo)m3FF&6*tJgw99rfa$`)J5;2?{qH8;n6Ke z(IeSKFUm1w=W&tVPIi4f&6X4Brrey$d48b2Iql;6(R_bawySIOQF`iUbx}Wa1jShl zRIWtO6~z$QocF)~#1638;qaM#W{^A6RZDCjuAMn95I07Q7FXbYmpQN&yHTm)q|<^d zE{vplvs38CF7em6x+sbbcLs7iwi>V*4P)wLjWE6tQ0=rV+}WZ<)6V4p?s#`R$S()f z2-?r8wMk`P)h(-Af*cl59aIL1lNIiw-c|$MU?tz$9$g|^lTZ4Z`@=P067?}V)yLKYvV3XTor!8$xLgq{kIwe$|Ul;<1lMe zax9*pIKI|XPri<$Oul|bi;`oLP8|>#Ojw)UCs*%zHoFTZe;d@$Ge7HS>a$uj{79#h zVF`ZsYiJh?ax>yv3-f2|}{%a{3_TLPu?K8f4j_SW1RP%D5r|RqJ zqm&rQB~x{Z3%k=r-m`!nqzrSqBpX13T@tGe4Zn!<-2l*2&Fs4uTO^Cw&_^f^{)(}) zZ@CTIP}}~kjnfP}c&3C>``lSXIqQq^ulV^BJjsHP3`n$ST0FPd2uPy+jiQBhQBOj4LMCWoWzfdWd3NU*nK-^qmnQmpLs*zLf zNti>1sU<=4Nx7WlsrfvOg!zdY3G5&s?J<6O~%P|X|XTV zmML1iXiI@cB6FceA~V|zc@UYWX(ZY*T_e$!85)VUaA~1+kxa9gP%?l7dKd(#MlY#w z;41ap`gu(~@s<=SKWzrMz7-&S2lwP}_2I@G9nPkV%}uW7XgP)Jxf%)A^E48!=W8Tf zFVIN1ep4gidZ9+b^&*Xg>%~mZy56>>CQRwK8(`>OfU13L@}Zjh;d#mORwz)M-3&_f zFA28UwnR%O3@=r^Te_m!e$QGH=Bo$yhiczRPx2KyS!Pn^eF^YYHNV?6f%-2Vye8o? zI#Mp`A9=U~zD-LGr==H#l1jYUSnz0MVOp+{mFXRgY)pI-0#8H&JJU*y989a!HWh;- zm35~8Hk|{IF9d3v^?hrdr8pGG#~Vga!=yRE+HiHSni*$K8l{BG^m^@JF|4i~DkaEt zp?0kpaxQvskLtg;BKVX`r4yIcGkF71&8q7t-cbLIQmOuGV2ZNpCX;8w@z89m>%qWJ zuJ;H9Vt@6$pF=Gxl@{M-eJ~!n)4eIr&R?JAao-B&89=*#D^zyg2Wa~U;2io|8StTM zZ8$IC8uH&0@0sZ9TH5}5pQLqKN5Ww!cr~&xt=GuP^sYuWrVVQ3ANOsN`z-gMtFM=g zPI14wwxiD@V{6GB#ofs8HOjcv?B@RvL?5g0HF9{{`D*l-foCh@4Vcdz@)eu#hy+Sy zav07RTw!MJV$qoO5s_B@tr1zQ{AV(4<5%hj+EtR^TWG_A_wDGCKhRfKRL0n`m+a`5 gd$eNYd35svPsa9ZJu51wM&SknZms+)8jZ$(0MJ-;DF6Tf delta 2282 zcmZvc3s96*6vxl~_S^S+SzSPuhdP?3V2Kr$3W#q7-w#5>RS-l|O!9?+h6;j!9&N4B zMspk;^Fi~WC}U!cW|o>cHK-FQqvNDWQHqaD?c80wV7WWrcfa5FzvtZlIeYIGoRAAn z$d$56)edy1RgJ|sRUp3@;96CGyh`+qsuvc?fjFP8SlNjw>JU6HN8(_0dvwzCVzmvA zt8^RGP8?5Ds^k!SKw-T|?ji@{Hrb{Wshw&}umoa)(Sf064OST(_=`ak-~xc=r#66% zcDvW;HG&+4SIlnTye`I2-@J)@G*e=V`NZgpWqt5~!G-5InIo{-XyvN5SNK(MLIAo= zE?W$N;j!T$_w=b2+()YMnM$r|!)n7o*89|U zSZ{JM8=f_Hqbgp*E#xTDq`^7luGFH(on|X@a#b7Un{U9aG;_Z}gDIq{EmohaR8t`K zw`lOXIgqu-sg@{a=6Rnv#-r3Hs)ohj0HaHJV%aat<86++N@c)LJ=hnxIyRzjz*KSw zT9!O!^7w|Nd1(`-rH{!hS_Q$dGmR^HmY7tZRFn9;8Ui$f4!&30ob-Ou1# zbblR_>0X43WO_wx)oRyS?Hbag@7?13=olwV^73sY+n+iJmZ7|+GIrQ4UVF)oC9 zWQcdOXnZN&osxNt2kBW!_OaamS_+2J8-BIxl#?$|kKgpGp6M@AuiwV)@gdTE71qWF zG8bN?HHYB6_)#v9tN=|97?0L8o#*3qfEXot;4T)_j=ydBaK%m+A65A3pq^TfW(z?X zW(=y-%fLP>dz|=XiQ*otQ7MtbK9zK3FlHct3Gle53qBd4lTMGrCQqU=abyUSDox75 zQ6;+0l+6IKbe~BV|G2>lsvywOBZDCN>U2t{i7|SqPZ~w4x&*>maC8{GYg;b~$#zKF|0f*=vodp1# z=gDU)ls`Nu`3!|&V?$Rwot|YFG8-W29ZHnLEu$_iQHh@Qm&B%F*V*NM^D$|Zq}BX% zLEOAY5H~+V5H~+l3Cf;p&|@AzhYtW2DdoA@GE2utOS~;@$q@5-TV@I3nKK3P%vpkX zW-{I4h_@wM5O2#ILA)(<1qBdMp}-^!NT7ycz?3(a9kNR^*C|b&p$zluGf>}fqD_PL zmS-7iHUfOL86bKKHRx|8XnmTB&BLV|pOr9QEWk_15yVSaAc&Xnt{`5*LP5NQTtU2q z_XP10775}dEGBAOLd~YH^@dJ60AAh&uyqfae4wn{c0poGaKer?{ytlmiWJ=BGG*_k z-b@*~vsfo3>~Agp*i0w78!ANu-pB9^12$Ib3}X)id|V6g>q%b|9)5mRVtIJEiZ@}w z!ES6hZaFw^!uu_&NVLf(LB1d}QGp-}(F#FUqLqSdM6^?UzpX@PcoGyU35SLU7_!a+ z8aHfp9{D%LS@>5YE?f%)<5hcIAd)wD%uJ~U6ZRR8n0iAEO z1{`T@-BuOS!V$NgTR89bivqU(USZ5@29W;&sALTP^xRjXn&|gkgVG&-LV5p- z@aUZZF~y>DCKw581(}IT1X+km1zCyKDbaVEt&;OR^{TfwRc0>!yt}Tuce~6wN=_$r zZHhNk%{DWqw_44L*@5af4NIs067Mb@JEFRx=e{0Rrx@5$YJs=T$c`{;^?DP_ZJE;- zpH65W;Ar_60AHJ7VHY^ Date: Mon, 22 Aug 2022 17:45:20 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7=E6=AD=A3=E5=88=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/commons/tools/utils/IdCardRegexUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bc56e52604..d44e9bb3fb 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("^\\w{2}\\d{7}$|^\\w{1}\\d{8}$"); + private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z]{2}\\d{7}$|^[a-zA-Z]{1}\\d{8}$"); private String inputText; From 45788748033717b86b78871d999b1b32633a5e75 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 10:55:55 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E6=8A=A4=E7=85=A7-=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E5=AF=BC=E5=85=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcResiUserImportServiceImpl.java | 43 +++---------------- 1 file changed, 6 insertions(+), 37 deletions(-) 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(); From bc9858976661d746d5fc319075631995063aff4d Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 14:52:03 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=91=E8=AF=81=E4=BB=B6=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java | 2 +- .../src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java | 2 +- .../src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java | 2 +- .../main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java | 4 ++-- .../src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java | 2 +- .../src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java | 2 +- .../src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java | 4 ++-- .../com/epmet/service/impl/IcResiUserImportServiceImpl.java | 2 +- .../java/com/epmet/service/impl/IcResiUserServiceImpl.java | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java index 3414805602..74dce9f16f 100644 --- a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java +++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java @@ -31,7 +31,7 @@ public class SaveOrUpdateParyMemberFormDTO implements Serializable { @NotBlank(message = "姓名不能为空", groups = {AddUserShowGroup.class}) private String name; - @NotBlank(message = "身份证不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String idCard; @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java index aba428a576..89950e63c0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java @@ -67,7 +67,7 @@ public class IcFollowUpRecordDTO implements Serializable { */ @ColumnWidth(25) @ExcelProperty("身份证号") - @NotBlank(message = "身份证号不能为空", groups = {AddUserRequired.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserRequired.class}) private String idCard; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java index 482ef97839..cca2734f9c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java @@ -56,7 +56,7 @@ public class AddIcVaccineFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = Vaccine.class) + @NotBlank(message = "证件号不能为空", groups = Vaccine.class) private String idCard; /** * 接种时间 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java index bcb62d6b45..083658ffda 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java @@ -71,8 +71,8 @@ public class IcMoveInAddEditFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {AddGroup.class}) - @Length(min = 15, max = 18, message = "身份证号位数不正确", groups = AddGroup.class) + @NotBlank(message = "证件号不能为空", groups = {AddGroup.class}) + @Length(min = 9, max = 18, message = "证件号位数不正确", groups = AddGroup.class) private String idCard; /** * 性别(1男2女0未知) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java index 09919051b9..7cc5c08b82 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java @@ -17,6 +17,6 @@ public class IcNoticeFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 7392894573654015338L; private String customerId; private String noticeId; - @NotBlank(message = "身份证号不能为空", groups = DefaultGroup.class) + @NotBlank(message = "证件号不能为空", groups = DefaultGroup.class) private String idCard; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java index c99a96878c..3ce4110f4c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java @@ -57,7 +57,7 @@ public class InfoSubmitFromDTO implements Serializable { private String name; //@NotBlank(message = "身份证号不能为空") - @Length(max=18,message = "身份证号不能超过18位") + @Length(max=18,message = "证件号不能超过18位") //别的小程序不统一升级,没办法限制必填。 private String idNum; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java index ab4a416d9e..1a1de84a5e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java @@ -12,10 +12,10 @@ public class PageFollowUpFormDTO extends PageFormDTO { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String idCard; - @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String name; /** 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 0b10e9fc61..3976b304fc 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 @@ -225,7 +225,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res private String tableName; - @Excel(name = "身份证号", width = 40) + @Excel(name = "证件号", width = 40) private String idCard; @Excel(name = "姓名", width = 25) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 3734309c8c..2ec5c5d783 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -258,7 +258,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { - String errorMsg = "修改居民信息失败,身份证号已存在!"; + String errorMsg = "修改居民信息失败,证件号已存在!"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } } From 254c311ece0cd32a5e15e6a2e1e322439d018dc9 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 17:03:34 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E3=80=90=E5=94=AF=E4=B8=80=E6=95=B4?= =?UTF-8?q?=E4=BB=B6=E5=8F=B7=E3=80=91@MaskResponseAspect#maskIdCard?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=8A=A4?= =?UTF-8?q?=E7=85=A7=E7=9A=84=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/processor/MaskProcessor.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java index 1ce0a85c54..586dadec3c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java @@ -2,8 +2,10 @@ package com.epmet.commons.tools.processor; import cn.hutool.core.util.StrUtil; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -13,6 +15,7 @@ import java.lang.reflect.Field; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; /** * desc:脱敏处理器 @@ -136,21 +139,29 @@ public class MaskProcessor { } /** + * 唯一整件号打码,可能是身份证号或者是护照号 * 将明文字符串打码变为掩码。保留前6,后面打码 * @param originString * @return */ private String maskIdCard(String originString) { - int clearTextLength = 12; - // 仅将6位之后的全都打码 - int length = originString.length(); - if (length <= clearTextLength) { + + IdCardRegexUtils regexUtil = IdCardRegexUtils.parse(originString); + if (regexUtil.getTypeEnum() == IdCardTypeEnum.SFZH) { + // 身份证号 + // 仅将6位之后的全都打码 + int maskedTextLength = 12; + int length = originString.length(); + String maskStr = StrUtil.repeatByLength("*", length - maskedTextLength); + return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + } else if (regexUtil.getTypeEnum() == IdCardTypeEnum.PASSPORT) { + // 护照,前两位,后两位为明文,其他* + String maskStr = StrUtil.repeatByLength("*", originString.length() - 4); + return originString.replaceAll("^([a-zA-Z0-9]{2})\\d+(\\d{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + } else { + // 其他情况,不码 return originString; } - - String maskStr = StrUtil.repeatByLength("*", length - clearTextLength); - - return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); } /** From 8ba820114d88f4d0870336f324affca29d35bf8a Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 17:18:11 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E3=80=90=E5=94=AF=E4=B8=80=E6=95=B4?= =?UTF-8?q?=E4=BB=B6=E5=8F=B7=E3=80=91@MaskResponseAspect#maskIdCard?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8Cfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/processor/MaskProcessor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java index 586dadec3c..24bce5bff3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java @@ -147,6 +147,11 @@ public class MaskProcessor { private String maskIdCard(String originString) { IdCardRegexUtils regexUtil = IdCardRegexUtils.parse(originString); + if (regexUtil == null) { + // 不匹配任何类型,不码 + return originString; + } + if (regexUtil.getTypeEnum() == IdCardTypeEnum.SFZH) { // 身份证号 // 仅将6位之后的全都打码 From 89fbd663dfd75507d55e2335ca856e4340bb01b3 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 24 Aug 2022 14:03:34 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/excel/ChangeDeathExcel.java | 2 +- .../src/main/java/com/epmet/excel/ChangeRelocationExcel.java | 2 +- .../src/main/java/com/epmet/excel/ChangeWelfareExcel.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java index a198ceee2d..5ad2165e88 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java @@ -23,7 +23,7 @@ public class ChangeDeathExcel { @Excel(name = "姓名") private String name; - @Excel(name = "身份证") + @Excel(name = "证件号") private String idCard; @Excel(name = "手机号") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java index 1823d569e2..554d776ac9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java @@ -32,7 +32,7 @@ public class ChangeRelocationExcel { @Excel(name = "手机号") private String mobile; - @Excel(name = "身份证号") + @Excel(name = "证件号号") private String idCard; @Excel(name = "性别") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java index 99437aa726..acb7705b2f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java @@ -24,7 +24,7 @@ public class ChangeWelfareExcel { @Excel(name = "姓名") private String name; - @Excel(name = "身份证") + @Excel(name = "证件号") private String idCard; @Excel(name = "手机号") From b3316e2209be51514bca08b704d6873c35a94252 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 24 Aug 2022 14:50:56 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/CollectListMemberExcelResultDTO.java | 2 +- .../src/main/java/com/epmet/excel/ChangeRelocationExcel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java index 89742845fa..f94a7dc803 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java @@ -24,7 +24,7 @@ public class CollectListMemberExcelResultDTO implements Serializable { /** * 成员身份证 */ - @Excel(name = "成员身份证号", width = 30) + @Excel(name = "成员证件号", width = 30) private String memberIdNum; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java index 554d776ac9..3b875fd0cd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java @@ -32,7 +32,7 @@ public class ChangeRelocationExcel { @Excel(name = "手机号") private String mobile; - @Excel(name = "证件号号") + @Excel(name = "证件号") private String idCard; @Excel(name = "性别") From abac113a5e56d3589ef0326d37ef703ff86065b7 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 24 Aug 2022 16:37:00 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E3=80=90=E8=AF=81=E4=BB=B6=E3=80=91fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IcResiUserServiceImpl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 2ec5c5d783..0f55cab634 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -631,14 +631,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl