修复脱敏银行卡号长度bug

This commit is contained in:
Looly 2023-07-18 00:21:24 +08:00
parent 1040d30500
commit d606236923
3 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@
* 【core 】 修复TypeUtil.getTypeArgument对实现接口获取不全面问题issue#I7CRIW@Gitee
* 【core 】 修复BeanUtil.isCommonFieldsEqual判空导致的问题
* 【extra 】 修复CompressUtil.createArchiver 将文件压缩为tgz时文件名规则无效问题issue#I7LLL7@Gitee
* 【core 】 修复脱敏银行卡号长度bugpr#3210@Github
-------------------------------------------------------------------------------------------------------------
# 5.8.20(2023-06-16)

View File

@ -321,7 +321,7 @@ public class DesensitizedUtil {
if (StrUtil.isBlank(bankCardNo)) {
return bankCardNo;
}
bankCardNo = StrUtil.replace(bankCardNo," ","");
bankCardNo = StrUtil.cleanBlank(bankCardNo);
if (bankCardNo.length() < 9) {
return bankCardNo;
}

View File

@ -31,7 +31,7 @@ public class DesensitizedUtilTest {
Assert.assertEquals("d*************@gmail.com.cn", DesensitizedUtil.desensitized("duandazhi-jack@gmail.com.cn", DesensitizedUtil.DesensitizedType.EMAIL));
Assert.assertEquals("**********", DesensitizedUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD));
Assert.assertEquals("1101 **** **** **** 3256", DesensitizedUtil.desensitized("11011111222233333256", DesensitizedUtil.DesensitizedType.BANK_CARD));
Assert.assertEquals("6227 **** **** *** 5123", DesensitizedUtil.desensitized("6227880100100105123", DesensitizedUtil.DesensitizedType.BANK_CARD));
Assert.assertEquals("6227 **** **** **** 123", DesensitizedUtil.desensitized("6227880100100105123", DesensitizedUtil.DesensitizedType.BANK_CARD));
Assert.assertEquals("192.*.*.*", DesensitizedUtil.desensitized("192.168.1.1", DesensitizedUtil.DesensitizedType.IPV4));
Assert.assertEquals("2001:*:*:*:*:*:*:*", DesensitizedUtil.desensitized("2001:0db8:86a3:08d3:1319:8a2e:0370:7344", DesensitizedUtil.DesensitizedType.IPV6));
}