diff --git a/pom.xml b/pom.xml index f69df198..285c7937 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,11 @@ 1.0 + + org.springframework.boot + spring-boot-starter-cache + + diff --git a/src/main/java/com/chint/application/out/LocationController.java b/src/main/java/com/chint/application/out/LocationController.java index 0e77f31d..b9405863 100644 --- a/src/main/java/com/chint/application/out/LocationController.java +++ b/src/main/java/com/chint/application/out/LocationController.java @@ -89,6 +89,5 @@ public class LocationController { dto.setInternationalCitys(internationalLocationRes); return Result.Success(SUCCESS, dto); - } } \ No newline at end of file diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index f7cfc534..a28fb6f1 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -90,7 +90,7 @@ public class OrderApplicationService { LegData legData = addLegData.getLegData(); List legs = processLegData(legData, order); orderDomainService.queryLocation(legs); - + RouteOrder routeOrder = orderDomainService.saveOrder(order); legs.forEach(leg -> { leg.reloadStatus(); legDomainService.addPreEvent(leg); @@ -106,24 +106,13 @@ public class OrderApplicationService { leg = legDomainService.addApproveEvent(leg); } - order.addLeg(leg); + legRepository.save(leg); if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { Command.of(BPMLegChangeCommand.class).routeOrder(order).newleg(leg.reloadStatus()).routeId(order.getRouteId()).changeType(0).sendToQueue(); } - - }); - //异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次 -// if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) { -// CompletableFuture.runAsync(() -> { -// Command -// .of(LegSyncCommand.class) -// .data(SyncLegData.of(routeOrder.getRouteId(), routeOrder.getSupplierName())) -// .sendToQueue(); -// }); -// } - return orderDomainService.saveOrder(order); // 仅在所有操作完成后保存一次 + return routeOrder; // 仅在所有操作完成后保存一次 } @Transactional diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index f582a908..4bf43e07 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -234,18 +234,9 @@ class RouteApplicationTests { locationRepository.saveAll(all); } - // @Test +// @Test void deleteRouteOrder() { - routeRepository.deleteById(15L); - routeRepository.deleteById(17L); - routeRepository.deleteById(18L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); - routeRepository.deleteById(19L); + routeRepository.deleteById(785L); } // @Test