Browse Source

feat(all): 林氏工厂

1 修改回传时修改的状态不正确的问题
fix-sign
zhaoqiaobo 5 months ago
parent
commit
1a004b55cd
  1. 13
      blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java

13
blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java

@ -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);
}
}

Loading…
Cancel
Save