This commit is contained in:
Leo
2026-02-08 11:20:30 +08:00
parent c1484ecbfd
commit 549224a83f
2 changed files with 18 additions and 2 deletions

View File

@@ -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 可能为 rowTotalrow_total
// rowTotal 可能为 rowTotalrow_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) {