fix:轨迹删除引发的主表维护不完整

This commit is contained in:
李鹏军 2024-04-25 17:00:27 +08:00
parent 4cb5f465da
commit c6e99193c3
2 changed files with 4 additions and 4 deletions

View File

@ -109,13 +109,14 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
// 删除全部轨迹导致的重置行为
if (track == default)
{
if (order.LatestTrackTime == null) return;
if (order.LatestTrackTime == null) continue;
// tips:订单是支持从已完成态到未完成态的
order.ResetTrackInfo();
}
else
{
if (order.LatestTrackContent == track.TrackContent) continue;
// 删除引发的回退更新
order.LatestTrackContent = track.TrackContent;
order.LatestTrackEnContent = track.TrackEnContent;

View File

@ -236,17 +236,16 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
public async Task DeleteTrackAsync(int[] orderIds, List<string> trackCodes)
{
var r = await Context.DeleteByQueryAsync<TrackDetailsIndex>(x => x
.Conflicts(Conflicts.Abort)
.Conflicts(Conflicts.Proceed)
.Query(
q =>
q.Terms(t => t.Field(f => f.OrderId).Terms(orderIds))
&& q.Term(t => t.IsCanDelete, true)
&& q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes)))
.WaitForCompletion()
);
if (!r.IsValid)
throw new Exception($"轨迹数据删除失败,原因:{r.DebugInformation}");
throw new Exception($"轨迹数据删除失败,原因:{r.ServerError.Error}");
}
public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)