1
This commit is contained in:
@@ -1069,6 +1069,15 @@ public class TencentDocController extends BaseController {
|
||||
endRow = rowTotal;
|
||||
log.info("按 rowTotal={} 截断结束行: endRow={}", rowTotal, endRow);
|
||||
}
|
||||
} else {
|
||||
// 未取到 rowTotal 时:若 startRow 过高(如 348 超出实际 324 行)可能是 Redis 缓存过时,保守回溯
|
||||
final int START_ROW_SAFE_THRESHOLD = 350;
|
||||
if (startRow > START_ROW_SAFE_THRESHOLD) {
|
||||
int oldStart = startRow;
|
||||
startRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL, effectiveStartRow);
|
||||
endRow = startRow + READ_ROWS_WHEN_USE_ROW_TOTAL - 1;
|
||||
log.warn("rowTotal 未获取且 startRow={} 过高,保守回溯至 effectiveStartRow={},范围: {} ~ {}", oldStart, startRow, startRow, endRow);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("开始填充物流链接 - 文件ID: {}, 工作表ID: {}, 起始行: {}, 结束行: {}, rowTotal: {}",
|
||||
|
||||
@@ -589,6 +589,8 @@ public class TencentDocServiceImpl implements ITencentDocService {
|
||||
list = result.getJSONArray("sheets");
|
||||
}
|
||||
if (list == null) {
|
||||
log.debug("getSheetRowTotal 未找到 properties/sheets 列表 - fileId: {}, sheetId: {}, resultKeys: {}",
|
||||
fileId, sheetId, result != null ? result.keySet() : "null");
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -598,16 +600,21 @@ public class TencentDocServiceImpl implements ITencentDocService {
|
||||
continue;
|
||||
}
|
||||
String sid = props.getString("sheetId");
|
||||
if (!sheetId.equals(sid)) {
|
||||
if (sid == null || !sheetId.equals(sid)) {
|
||||
continue;
|
||||
}
|
||||
// rowTotal 可能为 rowTotal 或 row_total
|
||||
// rowTotal 可能为 rowTotal、row_total 或 rowCount(腾讯文档 API 多种返回格式)
|
||||
if (props.containsKey("rowTotal")) {
|
||||
return Math.max(0, props.getIntValue("rowTotal"));
|
||||
}
|
||||
if (props.containsKey("row_total")) {
|
||||
return Math.max(0, props.getIntValue("row_total"));
|
||||
}
|
||||
if (props.containsKey("rowCount")) {
|
||||
return Math.max(0, props.getIntValue("rowCount"));
|
||||
}
|
||||
log.debug("getSheetRowTotal 找到 sheetId 但无 rowTotal/rowCount - fileId: {}, sheetId: {}, propsKeys: {}",
|
||||
fileId, sheetId, props.keySet());
|
||||
}
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user