|
|
@@ -15,7 +15,6 @@ import java.util.ArrayList;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
@@ -42,10 +41,7 @@ public final class AiRecordCleaner {
|
|
|
/** 类型化列的值清洗:只去控制字符,保留 + - . 供数字/日期解析 */
|
|
|
private static final Pattern VALUE_JUNK = Pattern.compile("[\\t\\r\\n'’‘\\u3000]+");
|
|
|
|
|
|
- /** 需要脱敏后再进日志/失败记录的类型 */
|
|
|
- private static final Set<String> SENSITIVE = Set.of("PHONE", "ACCT_CARD_NO", "ID_CARD_NUMBER");
|
|
|
-
|
|
|
- /** 失败记录里的值预览长度 */
|
|
|
+ /** 失败记录里的值预览长度:只做超长截断,不做脱敏 */
|
|
|
private static final int PREVIEW_LEN = 80;
|
|
|
|
|
|
private AiRecordCleaner() {
|
|
|
@@ -160,7 +156,7 @@ public final class AiRecordCleaner {
|
|
|
if (!coerced.isOk()) {
|
|
|
if (errors != null) {
|
|
|
errors.putIfAbsent(col.columnName(),
|
|
|
- "类型转换失败(" + type + ") 值=" + preview(v, type));
|
|
|
+ "类型转换失败(" + type + ") 值=" + preview(v));
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
@@ -200,18 +196,15 @@ public final class AiRecordCleaner {
|
|
|
|
|
|
private static ColumnError error(CompiledColumn col, AiRejectReason reason, String raw) {
|
|
|
return new ColumnError(col.colIndex(), col.columnName(), reason,
|
|
|
- preview(raw, normalizeType(col.fieldType())), reason.blocking());
|
|
|
+ preview(raw), reason.blocking());
|
|
|
}
|
|
|
|
|
|
- /** 失败记录/日志里的原值预览:敏感类型掩码,其余截断 */
|
|
|
- static String preview(String raw, String type) {
|
|
|
+ /** 失败记录/日志里的原值预览:只截断超长文本,不脱敏 */
|
|
|
+ static String preview(String raw) {
|
|
|
if (raw == null) {
|
|
|
return null;
|
|
|
}
|
|
|
String value = raw.trim();
|
|
|
- if (SENSITIVE.contains(type) && value.length() > 6) {
|
|
|
- value = value.substring(0, 3) + "***" + value.substring(value.length() - 2);
|
|
|
- }
|
|
|
return value.length() <= PREVIEW_LEN ? value
|
|
|
: StrUtil.subPre(value, PREVIEW_LEN) + "...";
|
|
|
}
|