数据的脱敏
- 脱敏的规则
public class DesensitizationStringUtil {
// 银行账户:显示前五后五,范例:62284******84568
public static String encryptBankAcct(String bankAcct) {
if (StringUtils.isBlank(bankAcct)) {
return bankAcct;
}
if (bankAcct.length() > 10) {
bankAcct = replaceBetween(bankAcct, 5, bankAcct.length() - 5, null);
}
return bankAcct;
}
// 身份证号码:显示前五后四,范例:11060*********2015
public static String encryptIdCard(String idCard) {
if (StringUtils.isBlank(idCard)) {
return idCard;
}
if (idCard.length() == 15 || idCard.length() == 18) {
idCard = replaceBetween(idCard, 5, idCard.length() - 4, null);
}
return idCard;
}
// 手机:显示前三后四,范例:189****3684
public static String encryptPhone(String phone) {
if (Strin