fix: 无法删除行程的bug

This commit is contained in:
lulz1 2024-06-25 09:28:36 +08:00
parent 286aad6c14
commit 296bc287f0
1 changed files with 19 additions and 4 deletions

View File

@ -202,10 +202,25 @@ public class OrderApplicationService {
public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) { public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) {
RouteOrder order = Optional.ofNullable(routeRepository.queryById(deleteLegData.getRouteId())) String legNo = deleteLegData.getLegNo();
.orElseThrow(() -> new NotFoundException(NOT_FOUND)).reloadStatus(); RouteOrder routeOrder = null;
order.deleteLeg(deleteLegData.getLegNo()); if (legNo.contains("&")) {
return orderDomainService.saveOrder(order); String[] split = legNo.split("&");
routeOrder = routeRepository.findTempRouteOrderBySysCodeAndBillCode(split[1], split[2]);
}
if (routeOrder == null) {
routeOrder = Optional.ofNullable(routeRepository.queryById(deleteLegData.getRouteId()))
.orElseThrow(() -> new NotFoundException(NOT_FOUND)).reloadStatus();
}
if (routeOrder != null) {
routeOrder.reloadStatus();
if (!routeOrder.getApprovalStatusCode().equals(APPROVAL_EVENT_PREPARE)) {
return routeRepository.saveTempRouteOrder(routeOrder, 24L);
} else {
return routeRepository.save(routeOrder);
}
}
return null;
} }
@Transactional @Transactional