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