|
|
@@ -3272,13 +3272,13 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
String filename = headList.stream().map(CostSurveyTemplateHeaders::getFieldName).collect(Collectors.joining(","));
|
|
|
String filenids = headList.stream().map(CostSurveyTemplateHeaders::getId).collect(Collectors.joining(","));
|
|
|
|
|
|
- // 按 orderNum 分组
|
|
|
- Map<Integer, List<CostSurveyTemplateItems>> groupedByHeadersId = items.stream()
|
|
|
- .collect(Collectors.groupingBy(CostSurveyTemplateItems::getOrderNum));
|
|
|
+ // 修复:按 rowid 分组,确保每个项目都能正确返回
|
|
|
+ Map<String, List<CostSurveyTemplateItems>> groupedByRowId = items.stream()
|
|
|
+ .collect(Collectors.groupingBy(CostSurveyTemplateItems::getRowid));
|
|
|
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
|
|
|
- for (Map.Entry<Integer, List<CostSurveyTemplateItems>> entry : groupedByHeadersId.entrySet()) {
|
|
|
+ for (Map.Entry<String, List<CostSurveyTemplateItems>> entry : groupedByRowId.entrySet()) {
|
|
|
List<CostSurveyTemplateItems> group = entry.getValue();
|
|
|
if (group.isEmpty()) continue;
|
|
|
|
|
|
@@ -3327,6 +3327,12 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
|
|
|
result.add(keyValueMap);
|
|
|
}
|
|
|
+
|
|
|
+ // 按 orderNum 排序结果,确保返回顺序正确
|
|
|
+ result.sort(Comparator.comparing(map ->
|
|
|
+ Integer.parseInt(map.getOrDefault("orderNum", "0"))
|
|
|
+ ));
|
|
|
+
|
|
|
CostItemData data = new CostItemData();
|
|
|
data.setFixedFields(filename);
|
|
|
data.setItemlist(result);
|
|
|
@@ -3338,13 +3344,13 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
String filename = headList.stream().map(CostSurveyFdTemplateHeaders::getFieldName).collect(Collectors.joining(","));
|
|
|
String filenids = headList.stream().map(CostSurveyFdTemplateHeaders::getId).collect(Collectors.joining(","));
|
|
|
|
|
|
- // 按 orderNum 分组
|
|
|
- Map<Integer, List<CostSurveyFdTemplateItems>> groupedByOrderNum = items.stream()
|
|
|
- .collect(Collectors.groupingBy(CostSurveyFdTemplateItems::getOrderNum));
|
|
|
+ // 修复:按 rowid 分组,确保每个项目都能正确返回
|
|
|
+ Map<String, List<CostSurveyFdTemplateItems>> groupedByRowId = items.stream()
|
|
|
+ .collect(Collectors.groupingBy(CostSurveyFdTemplateItems::getRowid));
|
|
|
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
|
|
|
- for (Map.Entry<Integer, List<CostSurveyFdTemplateItems>> entry : groupedByOrderNum.entrySet()) {
|
|
|
+ for (Map.Entry<String, List<CostSurveyFdTemplateItems>> entry : groupedByRowId.entrySet()) {
|
|
|
List<CostSurveyFdTemplateItems> group = entry.getValue();
|
|
|
if (group.isEmpty()) continue;
|
|
|
|
|
|
@@ -3393,6 +3399,11 @@ public class CostProjectTaskSurveyGenericController {
|
|
|
result.add(keyValueMap);
|
|
|
}
|
|
|
|
|
|
+ // 按 orderNum 排序结果,确保返回顺序正确
|
|
|
+ result.sort(Comparator.comparing(map ->
|
|
|
+ Integer.parseInt(map.getOrDefault("orderNum", "0"))
|
|
|
+ ));
|
|
|
+
|
|
|
CostItemData data = new CostItemData();
|
|
|
data.setFixedFields(filename);
|
|
|
data.setItemlist(result);
|