|
|
|
@ -35,6 +35,7 @@ import java.util.Comparator;
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -234,10 +235,14 @@ public class FactoryNodePushServiceImpl extends BaseServiceImpl<FactoryNodePushM
|
|
|
|
|
} |
|
|
|
|
if (CollUtil.isNotEmpty(updateList)) { |
|
|
|
|
// id相同时,更新 workedNodeCode 最大的那一条数据
|
|
|
|
|
updateList = updateList.stream().collect(Collectors.groupingBy(PackageInfoEntity::getId)).values().stream() |
|
|
|
|
.map(data -> data.get(data.size() - 1)).collect(Collectors.toList()); |
|
|
|
|
// 按 workedNodeCode 正序
|
|
|
|
|
// updateList.sort(Comparator.comparingInt(PackageInfoEntity::getWorkedNodeCode));
|
|
|
|
|
updateList = updateList.stream() |
|
|
|
|
.collect(Collectors.groupingBy(PackageInfoEntity::getId)) |
|
|
|
|
.values().stream() |
|
|
|
|
.map(data -> data.stream() |
|
|
|
|
.max(Comparator.comparing(PackageInfoEntity::getWorkedNodeCode)) |
|
|
|
|
.orElse(null)) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
packageInfoService.updateBatchById(updateList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|