From 801952c971d4d474939de78ee037178681c43ed3 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 4 Jul 2024 15:56:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E5=A4=8D=E5=8F=98=E6=88=90?= =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E6=97=B6=EF=BC=8C=E6=97=A0=E6=B3=95=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E5=9C=B0=E7=82=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 --- .../services/OrderApplicationService.java | 2 -- .../com/chint/domain/aggregates/order/Leg.java | 16 +++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index ac42f029..bf1af66b 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -134,10 +134,8 @@ public class OrderApplicationService { .reloadStatus(); Leg oldLeg = leg.deepClone(); - oldLeg.setRouteId(null); // 对 leg 进行更新 leg.update(legData); - // 对更新的行程补充地理信息 legDomainService.queryLocation(List.of(oldLeg, leg)); diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java index 23120d37..4e14a468 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Leg.java +++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java @@ -121,6 +121,7 @@ public class Leg implements Serializable, EventManageable { if (this.legExtensionField != null) { clonedLeg.legExtensionField = new LegExtensionField(); BeanUtils.copyProperties(this.legExtensionField, clonedLeg.legExtensionField); + clonedLeg.legExtensionField.setLocationList(null); } // 深克隆 orderDetails if (this.orderDetails != null) { @@ -133,15 +134,9 @@ public class Leg implements Serializable, EventManageable { .toList(); } // 深克隆 originLocation - if (this.originLocation != null) { - clonedLeg.originLocation = new Location(); - BeanUtils.copyProperties(this.originLocation, clonedLeg.originLocation); - } - // 深克隆 destinationLocation - if (this.destinationLocation != null) { - clonedLeg.destinationLocation = new Location(); - BeanUtils.copyProperties(this.destinationLocation, clonedLeg.destinationLocation); - } + clonedLeg.originLocation = null; + clonedLeg.destinationLocation = null; + clonedLeg.setRouteId(null); return clonedLeg; } @@ -206,7 +201,9 @@ public class Leg implements Serializable, EventManageable { } // 更新起点和终点 this.originId = legData.getOriginId(); + this.originLocation = null; this.destinationId = legData.getDestinationId(); + this.destinationLocation = null; // 如果是酒店类型,起点和终点相同 if (LEG_TYPE_HOTEL == (this.legType)) { this.destinationId = legData.getOriginId(); @@ -238,6 +235,7 @@ public class Leg implements Serializable, EventManageable { this.legExtensionField.setEstimatedAmount(legExtensionFieldData.getEstimatedAmount()); } if (legExtensionFieldData.getLocationIds() != null) { + this.legExtensionField.setLocationList(new ArrayList<>()); this.legExtensionField.addLocationIdsAsString(legExtensionFieldData.getLocationIds()); } }