Commit d3450601 by 刘鑫

fix(容量):最大空闲时间空指针处理

1 parent 9739deeb
......@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.OptionalLong;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
......@@ -244,11 +245,11 @@ public class CapacityUtils {
.flatMap(Collection::stream).collect(Collectors.toList());
timeSlots = calculateUnion(timeSlots);
long engineerMaxDuration = Optional.ofNullable(timeSlots).orElse(Collections.emptyList())
OptionalLong optionalEngineerMaxDuration = Optional.ofNullable(timeSlots).orElse(Collections.emptyList())
.stream()
.mapToLong(t1 -> Duration.between(t1.getBeginTime(), t1.getEndTime()).abs().toMinutes())
.max().getAsLong();
engineerMaxDurationList.add(engineerMaxDuration);
.max();
engineerMaxDurationList.add(optionalEngineerMaxDuration.orElse(0L));
});
long maxDuration = Collections.max(engineerMaxDurationList);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!