1
This commit is contained in:
@@ -463,22 +463,46 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// 从参数或配置中获取文档信息
|
||||
String fileId = (String) params.get("fileId");
|
||||
String sheetId = (String) params.get("sheetId");
|
||||
|
||||
// 可选参数:表头行号
|
||||
Integer headerRow = params.get("headerRow") != null ?
|
||||
Integer.valueOf(params.get("headerRow").toString()) : 1; // 表头所在行(默认第1行,从1开始)
|
||||
|
||||
// 如果前端没有传fileId/sheetId,则从配置中读取
|
||||
final String CONFIG_KEY_PREFIX = "tencent:doc:auto:config:";
|
||||
if (fileId == null || fileId.isEmpty()) {
|
||||
fileId = redisCache.getCacheObject(CONFIG_KEY_PREFIX + "fileId");
|
||||
if (fileId == null || fileId.isEmpty()) {
|
||||
fileId = tencentDocConfig.getFileId();
|
||||
}
|
||||
}
|
||||
if (sheetId == null || sheetId.isEmpty()) {
|
||||
sheetId = redisCache.getCacheObject(CONFIG_KEY_PREFIX + "sheetId");
|
||||
if (sheetId == null || sheetId.isEmpty()) {
|
||||
sheetId = tencentDocConfig.getSheetId();
|
||||
}
|
||||
}
|
||||
|
||||
// 从配置中读取startRow(数据起始行号)
|
||||
Integer configStartRow = redisCache.getCacheObject(CONFIG_KEY_PREFIX + "startRow");
|
||||
if (configStartRow == null) {
|
||||
configStartRow = tencentDocConfig.getStartRow();
|
||||
}
|
||||
|
||||
// 表头行号 = 数据起始行 - 1(例如:数据从第3行开始,表头在第2行)
|
||||
Integer headerRow = configStartRow != null ? configStartRow - 1 : 2;
|
||||
|
||||
// 可选参数:是否强制从指定行开始(如果为true,则忽略Redis记录的最大行数)
|
||||
Boolean forceStart = params.get("forceStart") != null ?
|
||||
Boolean.valueOf(params.get("forceStart").toString()) : false;
|
||||
Integer forceStartRow = params.get("forceStartRow") != null ?
|
||||
Integer.valueOf(params.get("forceStartRow").toString()) : null;
|
||||
Integer.valueOf(params.get("forceStartRow").toString()) : configStartRow;
|
||||
|
||||
if (accessToken == null || fileId == null || sheetId == null) {
|
||||
return AjaxResult.error("accessToken、fileId和sheetId不能为空");
|
||||
return AjaxResult.error("文档配置不完整,请先配置 fileId 和 sheetId");
|
||||
}
|
||||
|
||||
log.info("同步物流配置 - fileId: {}, sheetId: {}, 数据起始行: {}, 表头行: {}",
|
||||
fileId, sheetId, configStartRow, headerRow);
|
||||
|
||||
// 生成Redis key,用于存储该文件的工作表的上次处理最大行数
|
||||
String redisKey = LAST_PROCESSED_ROW_KEY_PREFIX + fileId + ":" + sheetId;
|
||||
|
||||
Reference in New Issue
Block a user