fix: 修复删除轨迹后主订单数据更新异常

fix: 增加轨迹新增/更新时缺失的验证:预计到达时间验证
This commit is contained in:
云龙 王 2024-12-04 09:46:08 +08:00
parent fd1328ba4c
commit 01c4503158
3 changed files with 11 additions and 3 deletions

View File

@ -232,6 +232,8 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
LatestTrackPlace = x.LatestTrackPlace, LatestTrackPlace = x.LatestTrackPlace,
LatestTrackTime = x.LatestTrackTime, LatestTrackTime = x.LatestTrackTime,
LatestTrackTimeZone = x.LatestTrackTimeZone, LatestTrackTimeZone = x.LatestTrackTimeZone,
EstimatedDeliveryDate = x.EstimatedDeliveryDate,
DestinationTimeZone = x.DestinationTimeZone
}); });
if (orders.Count == 0) return tracks; if (orders.Count == 0) return tracks;
@ -258,6 +260,8 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
order.LatestTrackPlace = track.TrackPlace; order.LatestTrackPlace = track.TrackPlace;
order.LatestTrackTime = track.TrackTime; order.LatestTrackTime = track.TrackTime;
order.LatestTrackTimeZone = track.TrackTimeZone; order.LatestTrackTimeZone = track.TrackTimeZone;
order.EstimatedDeliveryDate = track.EstimatedDeliveryDate;
order.DestinationTimeZone = track.DestinationTimeZone;
} }
@ -281,7 +285,9 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
x.LatestTrackEnContent, x.LatestTrackEnContent,
x.LatestTrackPlace, x.LatestTrackPlace,
x.LatestTrackTime, x.LatestTrackTime,
x.LatestTrackTimeZone x.LatestTrackTimeZone,
x.EstimatedDeliveryDate,
x.DestinationTimeZone
}); });
return tracks; return tracks;

View File

@ -62,7 +62,7 @@ public partial class TrackService : ApplicationService, ITrackService
//要求时间在当前时间的前后100年之间内 //要求时间在当前时间的前后100年之间内
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100)); bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime)) if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime) || ValidateTrackTime(input.EstimatedDeliveryDate))
{ {
throw new BusinessException(message: "轨迹时间不合法"); throw new BusinessException(message: "轨迹时间不合法");
} }
@ -330,7 +330,7 @@ public partial class TrackService : ApplicationService, ITrackService
//要求时间在当前时间的前后100年之间内 //要求时间在当前时间的前后100年之间内
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100)); bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime)) if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime) || ValidateTrackTime(input.EstimatedDeliveryDate))
{ {
throw new BusinessException(message: "轨迹时间不合法"); throw new BusinessException(message: "轨迹时间不合法");
} }

View File

@ -201,5 +201,7 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
LatestTrackTime = null; LatestTrackTime = null;
LatestTrackPlace = null; LatestTrackPlace = null;
LatestTrackTimeZone = null; LatestTrackTimeZone = null;
EstimatedDeliveryDate = null;
DestinationTimeZone = null;
} }
} }