fix: 无法删除行程的bug

This commit is contained in:
lulz1 2024-06-25 09:35:37 +08:00
parent 296bc287f0
commit dd98051feb
2 changed files with 15 additions and 1 deletions

View File

@ -81,7 +81,7 @@ public class OrderPublicController {
@ApiOperation("根据行程节点号删除") @ApiOperation("根据行程节点号删除")
@PostMapping("/leg/delete/legNo") @PostMapping("/leg/delete/legNo")
public Result<String> deleteLeg(@RequestBody DeleteLegData deleteLegData) { public Result<String> deleteLeg(@RequestBody DeleteLegData deleteLegData) {
legDomainService.deleteByLegNo(deleteLegData.getLegNo()); orderApplicationService.deleteByLegNo(deleteLegData);
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }

View File

@ -200,6 +200,19 @@ public class OrderApplicationService {
}; };
} }
public void deleteByLegNo(DeleteLegData deleteLegData) {
String legNo = deleteLegData.getLegNo();
RouteOrder routeOrder = null;
if (legNo.contains("&")) {
String[] split = legNo.split("&");
routeOrder = routeRepository.findTempRouteOrderBySysCodeAndBillCode(split[1], split[2]);
}
if (routeOrder != null && routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)){
routeOrder.deleteLeg(legNo);
routeRepository.saveTempRouteOrder(routeOrder, 24L);
}
}
public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) { public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) {
String legNo = deleteLegData.getLegNo(); String legNo = deleteLegData.getLegNo();
@ -214,6 +227,7 @@ public class OrderApplicationService {
} }
if (routeOrder != null) { if (routeOrder != null) {
routeOrder.reloadStatus(); routeOrder.reloadStatus();
routeOrder.deleteLeg(legNo);
if (!routeOrder.getApprovalStatusCode().equals(APPROVAL_EVENT_PREPARE)) { if (!routeOrder.getApprovalStatusCode().equals(APPROVAL_EVENT_PREPARE)) {
return routeRepository.saveTempRouteOrder(routeOrder, 24L); return routeRepository.saveTempRouteOrder(routeOrder, 24L);
} else { } else {