|
|
@@ -928,9 +928,9 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
Cell cell = headerRowForWidth.getCell(i);
|
|
|
String headerText = cell != null ? cell.getStringCellValue() : "";
|
|
|
int charWidth = ExcelStyleUtil.calculateCharWidth(headerText);
|
|
|
- // 每个字符约256单位,再加一些边距
|
|
|
- int columnWidth = (charWidth + 4) * 256;
|
|
|
- sheet.setColumnWidth(i, Math.max(columnWidth, 3500));
|
|
|
+ // 每个字符约300单位,再加边距,最小宽度5000(约18个字符)
|
|
|
+ int columnWidth = (charWidth + 6) * 300;
|
|
|
+ sheet.setColumnWidth(i, Math.max(columnWidth, 5000));
|
|
|
}
|
|
|
|
|
|
// 隐藏行ID和父行ID列
|
|
|
@@ -1140,9 +1140,9 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
Cell cell = headerRowForWidth.getCell(i);
|
|
|
String headerText = cell != null ? cell.getStringCellValue() : "";
|
|
|
int charWidth = ExcelStyleUtil.calculateCharWidth(headerText);
|
|
|
- // 每个字符约256单位,再加一些边距
|
|
|
- int columnWidth = (charWidth + 4) * 256;
|
|
|
- sheet.setColumnWidth(i, Math.max(columnWidth, 3500));
|
|
|
+ // 每个字符约300单位,再加边距,最小宽度5000(约18个字符)
|
|
|
+ int columnWidth = (charWidth + 6) * 300;
|
|
|
+ sheet.setColumnWidth(i, Math.max(columnWidth, 5000));
|
|
|
}
|
|
|
|
|
|
// 隐藏行ID和父行ID列
|
|
|
@@ -1276,9 +1276,9 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
Cell cell = headerRowForWidth.getCell(i);
|
|
|
String headerText = cell != null ? cell.getStringCellValue() : "";
|
|
|
int charWidth = ExcelStyleUtil.calculateCharWidth(headerText);
|
|
|
- // 每个字符约256单位,再加一些边距
|
|
|
- int columnWidth = (charWidth + 4) * 256;
|
|
|
- sheet.setColumnWidth(i, Math.max(columnWidth, 3500));
|
|
|
+ // 每个字符约300单位,再加边距,最小宽度5000(约18个字符)
|
|
|
+ int columnWidth = (charWidth + 6) * 300;
|
|
|
+ sheet.setColumnWidth(i, Math.max(columnWidth, 5000));
|
|
|
}
|
|
|
|
|
|
sheet.setColumnHidden(rowIdColIndex, true);
|
|
|
@@ -2168,6 +2168,11 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
List<String> structureErrors = validateFixedTableStructure(rowDataMap, headersList, surveyTemplateId, type);
|
|
|
errors.addAll(structureErrors);
|
|
|
|
|
|
+ // 如果结构校验失败,直接返回,不再进行公式校验
|
|
|
+ if (!structureErrors.isEmpty()) {
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+
|
|
|
// 根据类型获取模板项
|
|
|
List<? extends Object> itemsList = getTemplateItems(type, surveyTemplateId);
|
|
|
if (itemsList != null && !itemsList.isEmpty()) {
|
|
|
@@ -2200,14 +2205,8 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
Map<String, String> rowData = rowEntry.getValue();
|
|
|
String cellCode = rowidToCellCodeMap.get(rowid);
|
|
|
|
|
|
+ // 结构校验已通过,cellCode 不应为空,跳过异常数据
|
|
|
if (StringUtil.isEmpty(cellCode)) {
|
|
|
- // rowid 不匹配说明导入的Excel不是从当前模板导出的,添加到错误列表
|
|
|
- Integer excelRowNum = rowIdToExcelRowMap.get(rowid);
|
|
|
- if (excelRowNum != null) {
|
|
|
- errors.add(String.format("第%d行的数据在当前模板中不存在,请使用系统导出的最新模板文件", excelRowNum));
|
|
|
- } else {
|
|
|
- errors.add("存在无法识别的数据行,请使用系统导出的最新模板文件");
|
|
|
- }
|
|
|
continue;
|
|
|
}
|
|
|
|