## Opt - 脱敏增加最大长度

This commit is contained in:
sangelxiu1 2025-09-25 15:44:50 +08:00
parent 5a7b651726
commit 9b10b9aa9e
2 changed files with 8 additions and 1 deletions

View File

@ -74,7 +74,7 @@ public class MemberStatisticsServiceImpl implements IMemberStatisticsService {
for (DirectStatisticsTop30VO directStatisticsTop30VO : result) {
if(param.getFaker()){
directStatisticsTop30VO.setMemberCode(DataMaskingUtil.mask(directStatisticsTop30VO.getMemberCode(), 2, 2));
directStatisticsTop30VO.setMemberName(DataMaskingUtil.mask(directStatisticsTop30VO.getMemberName(), 1, 0));
directStatisticsTop30VO.setMemberName(DataMaskingUtil.mask(directStatisticsTop30VO.getMemberName(), 1, 0, 6));
}
directStatisticsTop30VO.setNumberOfAmount(directStatisticsTop30VO.getNumberOfAmount().divide(new BigDecimal(10000)));
}

View File

@ -51,6 +51,13 @@ public class DataMaskingUtil {
return result.toString();
}
public static String mask(String input, int keepPrefix, int keepSuffix, int maxLength) {
String str = mask(input, keepPrefix, keepSuffix);
if(str.length() > maxLength) {
str = str.substring(0, maxLength);
}
return str;
}
/**
* 对字符串进行脱敏处理可自定义脱敏字符