## Opt - 脱敏增加最大长度
This commit is contained in:
parent
ba603b38f6
commit
df547f70f1
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对字符串进行脱敏处理,可自定义脱敏字符
|
||||
|
|
Loading…
Reference in New Issue