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();
Leg oldLeg = leg.deepClone();
oldLeg.setRouteId(null);
// leg 进行更新
leg.update(legData);
// 对更新的行程补充地理信息
legDomainService.queryLocation(List.of(oldLeg, leg));

View File

@ -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());
}
}