diff --git a/src/main/java/com/vverp/service/MaterialOrderService.java b/src/main/java/com/vverp/service/MaterialOrderService.java index fb789b6..27eb7c6 100644 --- a/src/main/java/com/vverp/service/MaterialOrderService.java +++ b/src/main/java/com/vverp/service/MaterialOrderService.java @@ -2504,27 +2504,28 @@ public class MaterialOrderService extends BaseOrderService } //确认供应商列表 Integer ind = indMap.getOrDefault(supplierProduct.getSupplier().getId(), null); + Integer supplierProductInd = Optional.ofNullable(supplierProduct.getInd()).orElse(Integer.MAX_VALUE); if (ind == null) { if (maxInd == null) { - indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd()); - maxInd = supplierProduct.getInd(); + indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd); + maxInd = supplierProductInd; maxIndSupplier = supplierProduct.getSupplier().getId(); } else { - if (indMap.size() >= number && supplierProduct.getInd().compareTo(maxInd) < 0) { + if (indMap.size() >= number && supplierProductInd.compareTo(maxInd) < 0) { indMap.remove(maxIndSupplier); - indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd()); - maxInd = supplierProduct.getInd(); + indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd); + maxInd = supplierProductInd; maxIndSupplier = supplierProduct.getSupplier().getId(); }else if(indMap.size()0){ - maxInd = supplierProduct.getInd(); + indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd); + if (supplierProductInd.compareTo(maxInd)>0){ + maxInd = supplierProductInd; maxIndSupplier = supplierProduct.getSupplier().getId(); } } } - } else if (ind.compareTo(supplierProduct.getInd()) > 0) { - indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd()); + } else if (ind.compareTo(supplierProductInd) > 0) { + indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd); } } }