fix:修复删除轨迹引起的订单更新缺失轨迹状态

This commit is contained in:
hardstylewyl 2025-04-10 14:44:18 +08:00
parent 8c7a1c5fc1
commit 7b692553d2
2 changed files with 5 additions and 1 deletions

View File

@ -219,6 +219,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
x => new OrderEntity x => new OrderEntity
{ {
Id = x.Id, Id = x.Id,
LatestTrackStatus = x.LatestTrackStatus,
LatestTrackContent = x.LatestTrackContent, LatestTrackContent = x.LatestTrackContent,
LatestTrackEnContent = x.LatestTrackEnContent, LatestTrackEnContent = x.LatestTrackEnContent,
LatestTrackPlace = x.LatestTrackPlace, LatestTrackPlace = x.LatestTrackPlace,
@ -236,7 +237,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
.FirstOrDefault(x => x.OrderId == order.Id); .FirstOrDefault(x => x.OrderId == order.Id);
// 删除全部轨迹导致的重置行为 // 删除全部轨迹导致的重置行为
if (track == default) if (track == null)
{ {
if (order.LatestTrackTime == null) continue; if (order.LatestTrackTime == null) continue;
@ -247,6 +248,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
{ {
if (order.LatestTrackContent == track.TrackContent) continue; if (order.LatestTrackContent == track.TrackContent) continue;
// 删除引发的回退更新 // 删除引发的回退更新
order.LatestTrackStatus = track.TrackStatus;
order.LatestTrackContent = track.TrackContent; order.LatestTrackContent = track.TrackContent;
order.LatestTrackEnContent = track.TrackEnContent; order.LatestTrackEnContent = track.TrackEnContent;
order.LatestTrackPlace = track.TrackPlace; order.LatestTrackPlace = track.TrackPlace;
@ -261,6 +263,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
await _orderRepository.UpdateRangeAsync(orders, await _orderRepository.UpdateRangeAsync(orders,
x => new x => new
{ {
x.LatestTrackStatus,
x.LatestTrackContent, x.LatestTrackContent,
x.LatestTrackEnContent, x.LatestTrackEnContent,
x.LatestTrackPlace, x.LatestTrackPlace,

View File

@ -213,6 +213,7 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
public void ResetTrackInfo() public void ResetTrackInfo()
{ {
IsCompleted = false; IsCompleted = false;
LatestTrackStatus = null;
LatestTrackContent = null; LatestTrackContent = null;
LatestTrackEnContent = null; LatestTrackEnContent = null;
LatestTrackTime = null; LatestTrackTime = null;