1
This commit is contained in:
@@ -903,12 +903,6 @@ public class TencentDocController extends BaseController {
|
||||
// 从参数获取批次ID(如果是批量调用会传入)
|
||||
String batchId = params.get("batchId") != null ? String.valueOf(params.get("batchId")) : null;
|
||||
|
||||
// 如果batchId为空,创建一个新的批次ID(用于日志记录)
|
||||
if (batchId == null || batchId.trim().isEmpty()) {
|
||||
batchId = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
log.info("未提供batchId,自动创建新的批次ID: {}", batchId);
|
||||
}
|
||||
|
||||
// 从参数或配置中获取文档信息
|
||||
String fileId = (String) params.get("fileId");
|
||||
String sheetId = (String) params.get("sheetId");
|
||||
@@ -953,8 +947,25 @@ public class TencentDocController extends BaseController {
|
||||
return AjaxResult.error("文档配置不完整,请先配置 fileId 和 sheetId");
|
||||
}
|
||||
|
||||
log.info("同步物流配置 - fileId: {}, sheetId: {}, 配置起始行: {}, 表头行: {}",
|
||||
fileId, sheetId, configStartRow, headerRow);
|
||||
// 如果batchId为空,创建一个新的批次ID和批量推送记录(用于日志记录)
|
||||
if (batchId == null || batchId.trim().isEmpty()) {
|
||||
// 计算起始行和结束行(用于创建批量推送记录)
|
||||
int estimatedStartRow = configStartRow != null ? configStartRow : (headerRow + 1);
|
||||
int estimatedEndRow = estimatedStartRow + 199;
|
||||
|
||||
batchId = batchPushService.createBatchPushRecord(
|
||||
fileId,
|
||||
sheetId,
|
||||
"MANUAL", // 手动触发
|
||||
"MANUAL_TRIGGER", // 手动触发来源
|
||||
estimatedStartRow,
|
||||
estimatedEndRow
|
||||
);
|
||||
log.info("未提供batchId,自动创建新的批次ID和批量推送记录: {}", batchId);
|
||||
}
|
||||
|
||||
log.info("同步物流配置 - fileId: {}, sheetId: {}, batchId: {}, 配置起始行: {}, 表头行: {}",
|
||||
fileId, sheetId, batchId, configStartRow, headerRow);
|
||||
|
||||
// 生成Redis key,用于存储该文件的工作表的动态处理进度
|
||||
String redisKey = LAST_PROCESSED_ROW_KEY_PREFIX + fileId + ":" + sheetId;
|
||||
@@ -1565,23 +1576,26 @@ public class TencentDocController extends BaseController {
|
||||
);
|
||||
result.put("message", message);
|
||||
|
||||
// 更新批量推送记录状态(如果batchId存在)
|
||||
// 更新批量推送记录状态(batchId 应该总是存在,因为如果没有会创建)
|
||||
if (batchId != null && !batchId.trim().isEmpty()) {
|
||||
try {
|
||||
String status = "SUCCESS";
|
||||
if (errorCount > 0 && filledCount == 0) {
|
||||
// 使用实际成功写入数量 successUpdates 而不是 filledCount
|
||||
if (errorCount > 0 && successUpdates == 0) {
|
||||
status = "FAILED";
|
||||
} else if (errorCount > 0) {
|
||||
status = "PARTIAL_SUCCESS";
|
||||
}
|
||||
batchPushService.updateBatchPushRecord(batchId, status, filledCount, skippedCount, errorCount,
|
||||
batchPushService.updateBatchPushRecord(batchId, status, successUpdates, skippedCount, errorCount,
|
||||
message, null);
|
||||
log.info("✓ 批量推送记录已更新 - batchId: {}, status: {}, 成功: {}, 跳过: {}, 错误: {}",
|
||||
batchId, status, filledCount, skippedCount, errorCount);
|
||||
log.info("✓ 批量推送记录已更新 - batchId: {}, status: {}, 实际成功: {}, 跳过: {}, 错误: {}",
|
||||
batchId, status, successUpdates, skippedCount, errorCount);
|
||||
} catch (Exception e) {
|
||||
log.error("更新批量推送记录失败", e);
|
||||
// 不影响主流程,继续执行
|
||||
}
|
||||
} else {
|
||||
log.warn("⚠️ batchId 为空,无法更新批量推送记录");
|
||||
}
|
||||
|
||||
// 如果有成功记录,发送微信推送
|
||||
|
||||
Reference in New Issue
Block a user