This commit is contained in:
van
2026-04-04 16:39:46 +08:00
parent bce83f680c
commit 6fbfecf690
4 changed files with 184 additions and 118 deletions

View File

@@ -215,20 +215,36 @@ public class TencentDocDataParser {
}
/**
* 表头是否为「京东下单订单号」列(与第三方「单号」等列区分
* 表头规范化:去 BOM、首尾空白、不间断空格与全角空格后去掉中间空白再比较与腾讯表格展示列名一致
*/
public static String normalizeTencentDocHeader(String raw) {
if (raw == null) {
return "";
}
String t = raw.trim();
if (t.startsWith("\uFEFF")) {
t = t.substring(1).trim();
}
t = t.replace('\u00A0', ' ').replace('\u3000', ' ');
t = t.replaceAll("\\s+", "");
return t;
}
/**
* 表头是否与期望列名完全一致(规范化后)
*/
public static boolean headerEquals(String raw, String expectedName) {
if (expectedName == null) {
return false;
}
return expectedName.equals(normalizeTencentDocHeader(raw));
}
/**
* 表头是否为「京东下单订单号」列(列名须完全一致)
*/
public static boolean isJdPlaceOrderNoHeader(String cellValueTrim) {
if (cellValueTrim == null) {
return false;
}
String t = cellValueTrim.trim();
if (t.isEmpty()) {
return false;
}
if (t.contains("京东下单订单号")) {
return true;
}
return t.contains("京东") && t.contains("下单") && t.contains("订单号");
return headerEquals(cellValueTrim, "京东下单订单号");
}
}