Untitled
wyc1230
plain_text
a year ago
629 B
9
Indexable
private static Long calculateFirstBoundTimeToNowSeconds(MultiShipmentDTO shipment, Long now) {
// shipment bound time is the earliest bound time of all its shipment items.
Optional<Date> firstBoundTime = shipment.getShipmentItemList().stream()
.map(shipmentItem -> shipmentItem.getBatchBoundTime())
.filter(Objects::nonNull).min(Comparator.naturalOrder());
if (firstBoundTime.isPresent()) {
return TimeUnit.SECONDS.convert(firstBoundTime.get().getTime() - now,
TimeUnit.MILLISECONDS);
}
else {
return -1L;
}
}Editor is loading...
Leave a Comment