1
This commit is contained in:
@@ -105,7 +105,7 @@ public class TencentDocConfigController extends BaseController {
|
||||
if (rowCount > 0) {
|
||||
config.put("currentProgress", rowCount);
|
||||
int effectiveStart = startRow != null ? startRow : 3;
|
||||
int nextStartRow = Math.max(effectiveStart, rowCount - 200);
|
||||
int nextStartRow = Math.max(effectiveStart, rowCount - 199); // 与填充逻辑一致,含最后一行共200行
|
||||
config.put("nextStartRow", nextStartRow);
|
||||
config.put("progressHint", String.format("表格当前有 %d 行数据(从接口获取),下次将从第 %d 行开始", rowCount, nextStartRow));
|
||||
} else {
|
||||
|
||||
@@ -998,9 +998,9 @@ public class TencentDocController extends BaseController {
|
||||
startRow = forceStartRow;
|
||||
endRow = Math.min(rowTotal, startRow + READ_ROWS_WHEN_USE_ROW_TOTAL - 1);
|
||||
} else {
|
||||
// startRow = rowTotal - 200,且必须大于 2(>= MIN_START_ROW_WHEN_USE_ROW_TOTAL)
|
||||
// startRow = rowCount - 199,使 endRow 能取到 rowCount,不漏最后一行(共 200 行含最后一行)
|
||||
startRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL,
|
||||
Math.max(effectiveStartRow, rowTotal - READ_ROWS_WHEN_USE_ROW_TOTAL));
|
||||
Math.max(effectiveStartRow, rowTotal - (READ_ROWS_WHEN_USE_ROW_TOTAL - 1)));
|
||||
endRow = Math.min(rowTotal, startRow + READ_ROWS_WHEN_USE_ROW_TOTAL - 1);
|
||||
}
|
||||
log.info("使用接口 rowCount={},本次范围: 第 {} ~ {} 行(共 {} 行,单次最多 {} 行)",
|
||||
@@ -1030,10 +1030,10 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
if (rowTotal > 0) {
|
||||
if (startRow > rowTotal) {
|
||||
// 配置/缓存的起始行超出表尾时,必须忽略 effectiveStartRow,按 rowTotal 回溯
|
||||
startRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL, rowTotal - READ_ROWS_WHEN_USE_ROW_TOTAL);
|
||||
// 按 rowCount 回溯,且保证 endRow=rowCount 不漏最后一行(rowCount - 199 起共 200 行)
|
||||
startRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL, rowTotal - (READ_ROWS_WHEN_USE_ROW_TOTAL - 1));
|
||||
endRow = Math.min(rowTotal, startRow + READ_ROWS_WHEN_USE_ROW_TOTAL - 1);
|
||||
log.info("按 rowCount={} 修正范围(忽略超出表尾的配置起始行): 第 {} ~ {} 行", rowTotal, startRow, endRow);
|
||||
log.info("按 rowCount={} 修正范围(含最后一行): 第 {} ~ {} 行", rowTotal, startRow, endRow);
|
||||
} else if (endRow > rowTotal) {
|
||||
endRow = rowTotal;
|
||||
log.info("按 rowTotal={} 截断结束行: endRow={}", rowTotal, endRow);
|
||||
|
||||
@@ -295,7 +295,7 @@ public class TencentDocDelayedPushServiceImpl implements ITencentDocDelayedPushS
|
||||
int rowTotal = tencentDocService.getSheetRowTotal(accessToken, fileId, sheetId);
|
||||
if (rowTotal > 0) {
|
||||
if (startRow > rowTotal) {
|
||||
batchStartRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL, rowTotal - READ_ROWS_WHEN_USE_ROW_TOTAL);
|
||||
batchStartRow = Math.max(MIN_START_ROW_WHEN_USE_ROW_TOTAL, rowTotal - (READ_ROWS_WHEN_USE_ROW_TOTAL - 1));
|
||||
batchEndRow = Math.min(rowTotal, batchStartRow + READ_ROWS_WHEN_USE_ROW_TOTAL - 1);
|
||||
log.info("配置起始行 {} 超出表尾 rowTotal={},修正为第 {} ~ {} 行", startRow, rowTotal, batchStartRow, batchEndRow);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user