分析样顺序调整

This commit is contained in:
2025-11-27 18:23:34 +08:00
parent 600e8bcd92
commit 171de4c8d4

View File

@@ -4,7 +4,9 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -172,7 +174,11 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
// projectDataSearch.setBusinessAssayTaskDataId(businessAssayTaskData.getId());
projectDataSearch.setBusinessAssayTaskDataIdList(businessAssayTaskDataIdList);
List<BusinessAssayProjectAndParameterRespVO> projectAndParameterList = businessAssayProjectDataMapper.selectProjectAndParameterBy(projectDataSearch);
Map<Long, List<BusinessAssayProjectAndParameterRespVO>> projectAndParameterMap = projectAndParameterList.stream().collect(Collectors.groupingBy(BusinessAssayProjectAndParameterRespVO::getDicId));
Map<Long, List<BusinessAssayProjectAndParameterRespVO>> projectAndParameterMap = projectAndParameterList.stream().sorted(Comparator.comparing(BusinessAssayProjectAndParameterRespVO::getParamNo)).collect(Collectors.groupingBy(BusinessAssayProjectAndParameterRespVO::getDicId,
LinkedHashMap::new, // 保持组首次出现的顺序(可选)
Collectors.toList() // ArrayList 保持组内顺序
));
for (Map.Entry<Long, List<BusinessAssayProjectAndParameterRespVO>> entry : projectAndParameterMap.entrySet()) {
BusinessAssayProjectAndParameterRespVO ep = entry.getValue().get(0);
String fieldIndex = "e" + ep.getDicId();
@@ -453,7 +459,10 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
// projectDataSearch.setBusinessAssayTaskDataId(businessAssayTaskData.getId());
projectDataSearch.setBusinessAssayTaskDataIdList(businessAssayTaskDataIdList);
List<BusinessAssayProjectAndParameterRespVO> projectAndParameterList = businessAssayProjectDataMapper.selectProjectAndParameterBy(projectDataSearch);
Map<Long, List<BusinessAssayProjectAndParameterRespVO>> projectAndParameterMap = projectAndParameterList.stream().collect(Collectors.groupingBy(BusinessAssayProjectAndParameterRespVO::getDicId));
Map<Long, List<BusinessAssayProjectAndParameterRespVO>> projectAndParameterMap = projectAndParameterList.stream().sorted(Comparator.comparing(BusinessAssayProjectAndParameterRespVO::getParamNo)).collect(Collectors.groupingBy(BusinessAssayProjectAndParameterRespVO::getDicId,
LinkedHashMap::new, // 保持组首次出现的顺序(可选)
Collectors.toList() // ArrayList 保持组内顺序
));
for (Map.Entry<Long, List<BusinessAssayProjectAndParameterRespVO>> entry : projectAndParameterMap.entrySet()) {
BusinessAssayProjectAndParameterRespVO ep = entry.getValue().get(0);
String fieldIndex = "e" + ep.getDicId();