fix: 无法删除行程的bug
This commit is contained in:
parent
286aad6c14
commit
296bc287f0
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue