From 38a66b10377f190d85ac90716c500471280b3181 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 4 Jul 2024 16:40:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=9B=A0=E5=9C=B0?= =?UTF-8?q?=E7=90=86=E4=BF=A1=E6=81=AF=E7=A1=AE=E5=AE=9E=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=AE=A1=E6=89=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aggregates/approval/platform/ApprovalPlatformAN.java | 1 - .../java/com/chint/domain/repository/RouteRepository.java | 2 ++ .../java/com/chint/domain/service/LegDomainService.java | 7 +++++-- .../infrastructure/repository/RouteRepositoryImpl.java | 5 +++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java index 46201b78..2a7efea4 100644 --- a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java +++ b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java @@ -122,7 +122,6 @@ public class ApprovalPlatformAN implements ApprovalPlatform { .filter(it -> it.getApprovalRecordNo().equals(approvalData.getApprovalRecordNo())) .findFirst() .ifPresent(it -> approvalScheduleParam.setRemark(it.getApprovalReason())); - List scheduleItemList = new ArrayList<>(); for (Pair legPair : approvalData.getChangeLegList()) { Leg newLeg = legPair.getFirst(); diff --git a/src/main/java/com/chint/domain/repository/RouteRepository.java b/src/main/java/com/chint/domain/repository/RouteRepository.java index b4fb4cf7..5fab658e 100644 --- a/src/main/java/com/chint/domain/repository/RouteRepository.java +++ b/src/main/java/com/chint/domain/repository/RouteRepository.java @@ -11,6 +11,8 @@ import java.util.List; public interface RouteRepository { RouteOrder queryById(Long orderId); + RouteOrder queryById(Long orderId, boolean ifUpdateCache); + List queryByIdIn(List routeIds); List queryAllInOneDayAndEffective(LocalDateTime start, LocalDateTime end); diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 5051af23..842eaaae 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR; import static com.chint.infrastructure.constant.LegConstant.*; @@ -170,11 +171,13 @@ public class LegDomainService { legExtensionField.setLocationList(byNameList); } } - if (leg.getOriginId() != null && leg.getOriginLocation() == null) { + if (leg.getOriginId() != null && (leg.getOriginLocation() == null || + !Objects.equals(leg.getOriginLocation().getLocationId(), leg.getOriginId()))) { leg.setOriginLocation(locationRepository.findByLocationId(leg.getOriginId())); } - if (leg.getDestinationId() != null && leg.getDestinationLocation() == null) { + if (leg.getDestinationId() != null && (leg.getDestinationLocation() == null || + !Objects.equals(leg.getDestinationLocation().getLocationId(), leg.getDestinationId()))) { leg.setDestinationLocation(locationRepository.findByLocationId(leg.getDestinationId())); } }); diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index 9b004a13..b5054264 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -44,6 +44,11 @@ public class RouteRepositoryImpl implements RouteRepository { return routeOrder; } + @Override + public RouteOrder queryById(Long orderId, boolean ifUpdateCache) { + return null; + } + @Override public List queryByIdIn(List routeIds) { List routeOrders = new java.util.ArrayList<>(routeCacheService.queryByIdIn(routeIds)