This commit is contained in:
Leo
2026-02-04 23:59:36 +08:00
parent f928e778da
commit 7ed5a76d2f
3 changed files with 22 additions and 13 deletions

View File

@@ -292,7 +292,7 @@ public class TencentDocDelayedPushServiceImpl implements ITencentDocDelayedPushS
"AUTO",
"DELAYED_TIMER",
startRow,
startRow + 199 // 与 Controller API_MAX_ROWS_PER_REQUEST=200 一致(单批最多200行
startRow + 499 // 与 Controller API_MAX_ROWS_PER_REQUEST=500 一致(单批最多500行
);
log.info("✓ 创建批量推送记录批次ID: {}", batchId);

View File

@@ -11,6 +11,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -344,9 +345,15 @@ public class TencentDocApiUtil {
*/
public static JSONObject readSheetData(String accessToken, String appId, String openId, String fileId, String sheetId, String range, String apiBaseUrl) {
// V3版本API路径格式/openapi/spreadsheet/v3/files/{fileId}/{sheetId}/{range}
// range格式A1表示法Excel格式如 A10:D11
String apiUrl = String.format("%s/files/%s/%s/%s", apiBaseUrl, fileId, sheetId, range);
log.info("读取表格数据 - fileId: {}, sheetId: {}, range: {}, apiUrl: {}", fileId, sheetId, range, apiUrl);
// range 需 URL 编码,否则 path 中的 ":" 会导致网关/服务端报 range invalid (400001)
String encodedRange;
try {
encodedRange = URLEncoder.encode(range, StandardCharsets.UTF_8.name());
} catch (java.io.UnsupportedEncodingException e) {
encodedRange = range.replace(":", "%3A");
}
String apiUrl = String.format("%s/files/%s/%s/%s", apiBaseUrl, fileId, sheetId, encodedRange);
log.info("读取表格数据 - fileId: {}, sheetId: {}, range: {} (encoded: {}), apiUrl: {}", fileId, sheetId, range, encodedRange, apiUrl);
return callApi(accessToken, appId, openId, apiUrl, "GET", null);
}