feat:修复变成行程时,无法变更地点的问题

This commit is contained in:
lulz1 2024-07-04 15:56:38 +08:00
parent 26872a42f3
commit 801952c971
2 changed files with 7 additions and 11 deletions

View File

@ -134,10 +134,8 @@ public class OrderApplicationService {
.reloadStatus(); .reloadStatus();
Leg oldLeg = leg.deepClone(); Leg oldLeg = leg.deepClone();
oldLeg.setRouteId(null);
// leg 进行更新 // leg 进行更新
leg.update(legData); leg.update(legData);
// 对更新的行程补充地理信息 // 对更新的行程补充地理信息
legDomainService.queryLocation(List.of(oldLeg, leg)); legDomainService.queryLocation(List.of(oldLeg, leg));

View File

@ -121,6 +121,7 @@ public class Leg implements Serializable, EventManageable {
if (this.legExtensionField != null) { if (this.legExtensionField != null) {
clonedLeg.legExtensionField = new LegExtensionField(); clonedLeg.legExtensionField = new LegExtensionField();
BeanUtils.copyProperties(this.legExtensionField, clonedLeg.legExtensionField); BeanUtils.copyProperties(this.legExtensionField, clonedLeg.legExtensionField);
clonedLeg.legExtensionField.setLocationList(null);
} }
// 深克隆 orderDetails // 深克隆 orderDetails
if (this.orderDetails != null) { if (this.orderDetails != null) {
@ -133,15 +134,9 @@ public class Leg implements Serializable, EventManageable {
.toList(); .toList();
} }
// 深克隆 originLocation // 深克隆 originLocation
if (this.originLocation != null) { clonedLeg.originLocation = null;
clonedLeg.originLocation = new Location(); clonedLeg.destinationLocation = null;
BeanUtils.copyProperties(this.originLocation, clonedLeg.originLocation); clonedLeg.setRouteId(null);
}
// 深克隆 destinationLocation
if (this.destinationLocation != null) {
clonedLeg.destinationLocation = new Location();
BeanUtils.copyProperties(this.destinationLocation, clonedLeg.destinationLocation);
}
return clonedLeg; return clonedLeg;
} }
@ -206,7 +201,9 @@ public class Leg implements Serializable, EventManageable {
} }
// 更新起点和终点 // 更新起点和终点
this.originId = legData.getOriginId(); this.originId = legData.getOriginId();
this.originLocation = null;
this.destinationId = legData.getDestinationId(); this.destinationId = legData.getDestinationId();
this.destinationLocation = null;
// 如果是酒店类型起点和终点相同 // 如果是酒店类型起点和终点相同
if (LEG_TYPE_HOTEL == (this.legType)) { if (LEG_TYPE_HOTEL == (this.legType)) {
this.destinationId = legData.getOriginId(); this.destinationId = legData.getOriginId();
@ -238,6 +235,7 @@ public class Leg implements Serializable, EventManageable {
this.legExtensionField.setEstimatedAmount(legExtensionFieldData.getEstimatedAmount()); this.legExtensionField.setEstimatedAmount(legExtensionFieldData.getEstimatedAmount());
} }
if (legExtensionFieldData.getLocationIds() != null) { if (legExtensionFieldData.getLocationIds() != null) {
this.legExtensionField.setLocationList(new ArrayList<>());
this.legExtensionField.addLocationIdsAsString(legExtensionFieldData.getLocationIds()); this.legExtensionField.addLocationIdsAsString(legExtensionFieldData.getLocationIds());
} }
} }