人口基本信息- 修改脱敏Bug

This commit is contained in:
java_cuibaocheng@163.com 2023-11-17 15:53:12 +08:00
parent c6a808fb1c
commit b20110d70f

View File

@ -100,6 +100,18 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if (dto.getIdcardType().contains("身份证")) {
String idCardNumber = IdCardVerifyUtil.desensitizeIdCardNumber(idcard);
dto.setIdcard(idCardNumber);
}else{
if (idcard.length() > 2) {
String xin = "";
for(int i = 0; i < idcard.length() - 2; i++) {
xin = xin + "*";
}
String newIdcard = idcard.substring(0, 1) + xin + idcard.substring(idcard.length()-1, idcard.length());
dto.setIdcard(newIdcard);
}else{
String newIdcard = idcard.substring(0, 1) + "*";
dto.setIdcard(newIdcard);
}
}
if (!StringUtil.isEmpty(phone) && phone.length() == 11) {
if(phone.startsWith("0")) {
@ -136,6 +148,18 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if (dto.getIdcardType().contains("身份证")) {
String idCardNumber = IdCardVerifyUtil.desensitizeIdCardNumber(idcard);
dto.setIdcard(idCardNumber);
}else{
if (idcard.length() > 2) {
String xin = "";
for(int i = 0; i < idcard.length() - 2; i++) {
xin = xin + "*";
}
String newIdcard = idcard.substring(0, 1) + xin + idcard.substring(idcard.length()-1, idcard.length());
dto.setIdcard(newIdcard);
}else{
String newIdcard = idcard.substring(0, 1) + "*";
dto.setIdcard(newIdcard);
}
}
if (!StringUtil.isEmpty(phone) && phone.length() == 11) {
if(phone.startsWith("0")) {
@ -256,6 +280,10 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
throw new SaveException("该证件号码错误");
}
}else{
if (populationInfoVO.getIdcard().length() < 5 || populationInfoVO.getIdcard().length() > 30) {
throw new SaveException("该证件号码错误");
}
}
if (populationInfoVO.getName().length() < 2 || populationInfoVO.getName().length() > 15) {
throw new SaveException("姓名错误");
@ -332,6 +360,10 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
throw new SaveException("该证件号码错误");
}
}else{
if (populationInfoVO.getIdcard().length() < 5 || populationInfoVO.getIdcard().length() > 30) {
throw new SaveException("该证件号码错误");
}
}
if (populationInfoVO.getName().length() < 2 || populationInfoVO.getName().length() > 15) {
throw new SaveException("姓名错误");