修复变更行程bug
This commit is contained in:
parent
e12c5f4f0a
commit
49478aa83b
|
@ -86,13 +86,11 @@ public class OrderApplicationService {
|
|||
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
||||
.orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
|
||||
order.reloadStatus();
|
||||
|
||||
checkLegDataTime(addLegData, order);
|
||||
|
||||
LegData legData = addLegData.getLegData();
|
||||
List<Leg> legs = processLegData(legData, order);
|
||||
orderDomainService.queryLocation(legs);
|
||||
RouteOrder routeOrder = orderDomainService.saveOrder(order);
|
||||
|
||||
legs.forEach(leg -> {
|
||||
leg.reloadStatus();
|
||||
legDomainService.addPreEvent(leg);
|
||||
|
@ -108,14 +106,14 @@ public class OrderApplicationService {
|
|||
leg = legDomainService.addApproveEvent(leg);
|
||||
}
|
||||
|
||||
legRepository.save(leg);
|
||||
order.addLeg(leg);
|
||||
|
||||
if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
Command.of(BPMLegChangeCommand.class).routeOrder(order).newleg(leg.reloadStatus()).routeId(routeOrder.getRouteId()).changeType(0).sendToQueue();
|
||||
Command.of(BPMLegChangeCommand.class).routeOrder(order).newleg(leg.reloadStatus()).routeId(order.getRouteId()).changeType(0).sendToQueue();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
//异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次
|
||||
// if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) {
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
|
@ -125,7 +123,7 @@ public class OrderApplicationService {
|
|||
// .sendToQueue();
|
||||
// });
|
||||
// }
|
||||
return routeOrder; // 仅在所有操作完成后保存一次
|
||||
return orderDomainService.saveOrder(order); // 仅在所有操作完成后保存一次
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
@ -118,9 +118,7 @@ public class Leg {
|
|||
this.legStatus = LegConstant.LEG_STATUS_PREPARE;
|
||||
} else {
|
||||
// Find the latest event based on the maximum id
|
||||
LegEvent latestEvent = this.eventList.stream()
|
||||
.max(Comparator.comparingLong(LegEvent::getLegEventId))
|
||||
.orElse(null);
|
||||
LegEvent latestEvent = this.getLastLegEvent();
|
||||
|
||||
// Set the legStatus based on the type of the latest event
|
||||
this.legStatus = latestEvent.getEventType();
|
||||
|
|
Loading…
Reference in New Issue