From 296bc287f0f789f28ced57f8d4fc7ca51cdca2e1 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 25 Jun 2024 09:28:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=B3=95=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/OrderApplicationService.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index 09b154d0..0b97aa55 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -202,10 +202,25 @@ public class OrderApplicationService { public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) { - RouteOrder order = Optional.ofNullable(routeRepository.queryById(deleteLegData.getRouteId())) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)).reloadStatus(); - order.deleteLeg(deleteLegData.getLegNo()); - return orderDomainService.saveOrder(order); + 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 = 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