diff --git a/blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java index 1eed9bfbb..18e137817 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-linsy/src/main/java/com/logpm/factorydata/linsy/service/impl/FactoryNodePushServiceImpl.java @@ -33,10 +33,12 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; /** @@ -54,7 +56,7 @@ public class FactoryNodePushServiceImpl extends BaseServiceImpl updateList = new ArrayList<>(); + Set billCodeSet = new HashSet<>(); for (Map.Entry> entry : groupByOrder.entrySet()) { String orderCode = entry.getKey(); Integer code = NodeMappingEnums.getFactoryByNodeAndStatus(workNodeEnums).getCode(); @@ -206,15 +209,16 @@ public class FactoryNodePushServiceImpl extends BaseServiceImpl collect.contains(data.getBarcode())) - .map(packageInfoEntity -> { - PackageInfoEntity entity = new PackageInfoEntity(); - entity.setId(packageInfoEntity.getId()); - entity.setWorkedNodeCode(FactoryNodeEnums.END_WAREHOUSE_UNLOADING.getCode()); - return entity; - }) - .collect(Collectors.toList())); + billCodeSet.add(orderCode); + // updateList.addAll(entities.stream() + // .filter(data -> collect.contains(data.getBarcode())) + // .map(packageInfoEntity -> { + // PackageInfoEntity entity = new PackageInfoEntity(); + // entity.setId(packageInfoEntity.getId()); + // entity.setWorkedNodeCode(FactoryNodeEnums.END_WAREHOUSE_UNLOADING.getCode()); + // return entity; + // }) + // .collect(Collectors.toList())); } } } @@ -222,7 +226,8 @@ public class FactoryNodePushServiceImpl extends BaseServiceImpl collect1 = entities.stream() + .filter(packageInfoEntity -> !CollUtil.contains(billCodeSet, packageInfoEntity.getOrderCode())) .filter(data -> collect.contains(data.getBarcode())) .map(packageInfoEntity -> { PackageInfoEntity entity = new PackageInfoEntity(); @@ -230,21 +235,20 @@ public class FactoryNodePushServiceImpl extends BaseServiceImpl data.stream() - .max(Comparator.comparing(PackageInfoEntity::getWorkedNodeCode)) - .orElse(null)) - .filter(Objects::nonNull) - .collect(Collectors.toList()); packageInfoService.updateBatchById(updateList); } + if (CollUtil.isNotEmpty(billCodeSet)) { + packageInfoService.update(Wrappers.lambdaUpdate().set(PackageInfoEntity::getWorkedNodeCode, FactoryNodeEnums.END_WAREHOUSE_UNLOADING.getCode()) + .in(PackageInfoEntity::getOrderCode, billCodeSet) + ); + } } }