diff --git a/backend/src/main/java/com/banben/modules/resource/service/VersionResourceExcelService.java b/backend/src/main/java/com/banben/modules/resource/service/VersionResourceExcelService.java index 5394ad5..8d07779 100644 --- a/backend/src/main/java/com/banben/modules/resource/service/VersionResourceExcelService.java +++ b/backend/src/main/java/com/banben/modules/resource/service/VersionResourceExcelService.java @@ -29,8 +29,8 @@ public class VersionResourceExcelService { private final VersionResourceService versionResourceService; - /** 单次导入的最大数据行数,防止超大文件拖垮服务 */ - private static final int MAX_ROWS = 5000; + /** 下拉校验覆盖的行数;只影响模板中下拉框的作用范围,不限制导入行数 */ + private static final int DROPDOWN_ROWS = 5000; private record Column(String header, String field, BiConsumer setter, int maxLen, String hint) { @@ -215,7 +215,7 @@ public class VersionResourceExcelService { DataValidationHelper helper = sheet.getDataValidationHelper(); DataValidationConstraint constraint = helper.createExplicitListConstraint(options); - CellRangeAddressList range = new CellRangeAddressList(2, MAX_ROWS, colIndex, colIndex); + CellRangeAddressList range = new CellRangeAddressList(2, DROPDOWN_ROWS, colIndex, colIndex); DataValidation validation = helper.createValidation(constraint, range); validation.setSuppressDropDownArrow(true); validation.setShowErrorBox(true); @@ -267,7 +267,7 @@ public class VersionResourceExcelService { List parsed = new ArrayList<>(); List rowNums = new ArrayList<>(); - int last = Math.min(sheet.getLastRowNum(), startRow + MAX_ROWS); + int last = sheet.getLastRowNum(); for (int r = startRow; r <= last; r++) { Row row = sheet.getRow(r); if (row == null) continue; diff --git a/frontend/src/api/resource.ts b/frontend/src/api/resource.ts index 79a6bf3..0fc62fd 100644 --- a/frontend/src/api/resource.ts +++ b/frontend/src/api/resource.ts @@ -101,5 +101,6 @@ export interface ImportResult { export function importResource(file: File) { const form = new FormData() form.append('file', file) - return request.post('/resource/import', form) + // 大文件解析耗时较长,单独放宽超时(默认 30s) + return request.post('/resource/import', form, { timeout: 300000 }) }