diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 61c44b5e..146d77a0 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -17,6 +17,7 @@ import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.OrderConstant.*; import static com.chint.infrastructure.constant.RouteConstant.APPROVAL_EVENT_PREPARE; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; +import static com.chint.infrastructure.constant.RouteRequestConstant.ROUTE_REQUEST_STATUS_SYNC; @Service public class LegDomainService { @@ -158,6 +159,16 @@ public class LegDomainService { if (supplierName.equals("CTrip")) { legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_TRAIN)).toList(); } + + List alreadySyncLegIds = routeOrder.getRouteRequestList() + .stream() + .filter(it -> it.reloadStatus().getStatus().equals(ROUTE_REQUEST_STATUS_SYNC)) + .flatMap(it -> it.getRouteRequestLegList().stream().map(RouteRequestLeg::getLegId)) + .toList(); + + legItems = legItems.stream() + .filter(it -> !alreadySyncLegIds.contains(it.getLegId())) + .toList(); return legItems; } }