1
This commit is contained in:
@@ -799,11 +799,15 @@ public class TencentDocController extends BaseController {
|
||||
*/
|
||||
private String extractPhoneFromRemark(String text) {
|
||||
if (text == null || text.trim().isEmpty()) {
|
||||
log.debug("文本为空,无法提取手机号码");
|
||||
return null;
|
||||
}
|
||||
|
||||
log.debug("原始文本: [{}]", text);
|
||||
|
||||
// 移除所有空格、横线、括号等分隔符
|
||||
String cleanedText = text.replaceAll("[\\s\\-\\(\\)\\[\\]()\\【\\】]", "");
|
||||
log.debug("清理后文本: [{}]", cleanedText);
|
||||
|
||||
// 匹配11位手机号码(1开头的11位数字)
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("1[3-9]\\d{9}");
|
||||
@@ -811,10 +815,11 @@ public class TencentDocController extends BaseController {
|
||||
|
||||
if (matcher.find()) {
|
||||
String phone = matcher.group();
|
||||
log.debug("从文本中提取到手机号码: {}", phone);
|
||||
log.info("成功提取手机号码: [{}] <- 原文本: [{}]", phone, text);
|
||||
return phone;
|
||||
}
|
||||
|
||||
log.debug("未找到匹配的手机号码,文本: [{}]", text);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -999,10 +1004,12 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
|
||||
// 查找所有相关列
|
||||
log.info("开始识别表头列,共 {} 列", headerRowData.size());
|
||||
for (int i = 0; i < headerRowData.size(); i++) {
|
||||
String cellValue = headerRowData.getString(i);
|
||||
if (cellValue != null) {
|
||||
String cellValueTrim = cellValue.trim();
|
||||
log.debug("列 {} 内容: [{}]", i, cellValueTrim);
|
||||
|
||||
// 识别"单号"列
|
||||
if (orderNoColumn == null && cellValueTrim.contains("单号")) {
|
||||
@@ -1029,12 +1036,13 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
|
||||
// 识别"下单电话"列(可选)
|
||||
if (phoneColumn == null && (cellValueTrim.contains("下单电话") || cellValueTrim.contains("电话") || cellValueTrim.contains("手机"))) {
|
||||
if (phoneColumn == null && (cellValueTrim.contains("下单电话"))) {
|
||||
phoneColumn = i;
|
||||
log.info("✓ 识别到 '下单电话' 列:第 {} 列(索引{})", i + 1, i);
|
||||
log.info("✓ 识别到 '下单电话' 列:第 {} 列(索引{}),列名: [{}]", i + 1, i, cellValueTrim);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("表头列识别完成");
|
||||
|
||||
// 检查必需的列是否都已识别
|
||||
if (orderNoColumn == null) {
|
||||
@@ -1188,10 +1196,16 @@ public class TencentDocController extends BaseController {
|
||||
// 从status字段中提取手机号码
|
||||
String phone = null;
|
||||
if (phoneColumn != null) {
|
||||
phone = extractPhoneFromRemark(order.getStatus());
|
||||
String statusValue = order.getStatus();
|
||||
log.debug("准备从status字段提取手机号 - 单号: {}, status内容: [{}]", orderNo, statusValue);
|
||||
phone = extractPhoneFromRemark(statusValue);
|
||||
if (phone != null) {
|
||||
log.info("✓ 从status字段提取手机号码 - 单号: {}, 手机号: {}", orderNo, phone);
|
||||
log.info("✓ 从status字段提取手机号码 - 单号: {}, status: [{}], 手机号: {}", orderNo, statusValue, phone);
|
||||
} else {
|
||||
log.debug("未能从status字段提取手机号码 - 单号: {}, status: [{}]", orderNo, statusValue);
|
||||
}
|
||||
} else {
|
||||
log.debug("phoneColumn为null,跳过手机号提取 - 单号: {}", orderNo);
|
||||
}
|
||||
|
||||
// 构建更新请求
|
||||
|
||||
Reference in New Issue
Block a user