试验管理修改
This commit is contained in:
parent
55981193d1
commit
69bffc0d6a
|
|
@ -384,8 +384,18 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
|||
list = samplesManageDao.getSamplesDevList(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
Map<Long, List<ContractsVo>> groupedItems = list.stream().collect(Collectors.groupingBy(ContractsVo::getConfigId));
|
||||
Map<Long, List<ContractsVo>> sortedMap = groupedItems.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
// 解决可能存在的键冲突问题,默认保留第一个值
|
||||
(oldValue, newValue) -> oldValue,
|
||||
// 提供一个新的TreeMap实例作为收集器,用于保持排序
|
||||
() -> new TreeMap<>()
|
||||
));
|
||||
Integer index = 1;
|
||||
for (Map.Entry<Long, List<ContractsVo>> entry : groupedItems.entrySet()) {
|
||||
for (Map.Entry<Long, List<ContractsVo>> entry : sortedMap.entrySet()) {
|
||||
List<ContractsVo> groupList = entry.getValue();
|
||||
for (ContractsVo vo : groupList) {
|
||||
vo.setIndex(index);
|
||||
|
|
@ -398,7 +408,7 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
|||
Integer sampleDevNum = samplesManageDao.getSampleNum(dto, vo.getDevCode());
|
||||
vo.setTestYj(handleData(experBasisList));
|
||||
vo.setNum(String.valueOf(sampleDevNum));
|
||||
vo.setSampleCode(handleSampleCode(vo.getConfigId(), vo.getSampleDate(), groupedItems));
|
||||
vo.setSampleCode(handleSampleCode(vo.getConfigId(), vo.getSampleDate(), sortedMap));
|
||||
}
|
||||
} else {
|
||||
ContractsVo vo = new ContractsVo();
|
||||
|
|
|
|||
Loading…
Reference in New Issue