|
@@ -397,6 +397,26 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
data.setType(type);
|
|
data.setType(type);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 构建行号映射(新增时使用序号作为行号)
|
|
|
|
|
+ Map<String, Integer> rowIdToExcelRowMap = new HashMap<>();
|
|
|
|
|
+ Set<String> uniqueRowIds = new HashSet<>();
|
|
|
|
|
+ int rowNum = 1;
|
|
|
|
|
+ for (CostSurveyTemplateUploadData data : dataList) {
|
|
|
|
|
+ String rowid = data.getRowid();
|
|
|
|
|
+ if (StringUtil.isNotEmpty(rowid) && !uniqueRowIds.contains(rowid)) {
|
|
|
|
|
+ rowIdToExcelRowMap.put(rowid, rowNum++);
|
|
|
|
|
+ uniqueRowIds.add(rowid);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 校验数据(和导入时一样的校验)
|
|
|
|
|
+ List<String> errors = verifyImportData(dataList, type, surveyTemplateId, rowIdToExcelRowMap);
|
|
|
|
|
+ if (!errors.isEmpty()) {
|
|
|
|
|
+ CommonResult<String> result = CommonResult.<String>error().message("保存失败,发现以下问题:<br>" + String.join("<br>", errors));
|
|
|
|
|
+ result.setCode(250);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 计算并设置 orderNum(仅针对核定表 type=3)
|
|
// 计算并设置 orderNum(仅针对核定表 type=3)
|
|
|
if ("3".equals(type) && StringUtil.isNotEmpty(surveyTemplateId)) {
|
|
if ("3".equals(type) && StringUtil.isNotEmpty(surveyTemplateId)) {
|
|
|
// 收集所有 rowId 和 parentId
|
|
// 收集所有 rowId 和 parentId
|