修复变更行程bug
This commit is contained in:
parent
5f96250f53
commit
4993beffc1
|
@ -101,9 +101,7 @@ public class Leg {
|
|||
}
|
||||
|
||||
public LegEvent getLastLegEvent() {
|
||||
return this.eventList.stream()
|
||||
.max(Comparator.comparing(LegEvent::getHappenTime))
|
||||
.orElse(null);
|
||||
return this.eventList.get(this.eventList.size() - 1);
|
||||
}
|
||||
|
||||
public OrderDetail getLastOrderDetail() {
|
||||
|
|
|
@ -111,10 +111,10 @@ public class OrderDetail {
|
|||
}
|
||||
|
||||
public OrderEvent getLastEvent() {
|
||||
return this.orderEventList
|
||||
.stream()
|
||||
.max(Comparator.comparingLong(OrderEvent::getOrderEventId))
|
||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
return this.orderEventList.get(this.orderEventList.size() - 1);
|
||||
// .stream()
|
||||
// .max(Comparator.comparingLong(OrderEvent::getOrderEventId))
|
||||
// .orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
}
|
||||
|
||||
public OrderDetail price(String price) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.springframework.data.relational.core.mapping.Table;
|
|||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -185,12 +184,9 @@ public class RouteOrder extends BaseEntity {
|
|||
}
|
||||
|
||||
if (this.approveEvents != null && !this.approveEvents.isEmpty()) {
|
||||
ApprovalEvent approvalEvent = this.approveEvents.stream()
|
||||
.max(Comparator.comparingLong(ApprovalEvent::getApprovalEventId))
|
||||
.get()
|
||||
.reloadStatus();
|
||||
this.approvalStatus = approvalEvent.getEventName();
|
||||
this.approvalStatusCode = approvalEvent.getEventType();
|
||||
ApprovalEvent lastApprovalEvent = getLastApprovalEvent();
|
||||
this.approvalStatus = lastApprovalEvent.getEventName();
|
||||
this.approvalStatusCode = lastApprovalEvent.getEventType();
|
||||
}
|
||||
|
||||
this.getOrderDetails().forEach(OrderDetail::reloadStatus);
|
||||
|
@ -198,6 +194,9 @@ public class RouteOrder extends BaseEntity {
|
|||
return this;
|
||||
}
|
||||
|
||||
private ApprovalEvent getLastApprovalEvent() {
|
||||
return this.approveEvents.get(this.approveEvents.size() - 1);
|
||||
}
|
||||
|
||||
public RouteOrder reloadStatus(OrderSaveData orderSaveData) {
|
||||
// 重新加载所有Leg的状态
|
||||
|
|
Loading…
Reference in New Issue