Merge remote-tracking branch 'origin/S03-轨迹中台优化项' into test

This commit is contained in:
dingenwen 2024-04-25 17:01:16 +08:00
commit 69518f45cb
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -236,17 +236,16 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
public async Task DeleteTrackAsync(int[] orderIds, List<string> trackCodes) public async Task DeleteTrackAsync(int[] orderIds, List<string> trackCodes)
{ {
var r = await Context.DeleteByQueryAsync<TrackDetailsIndex>(x => x var r = await Context.DeleteByQueryAsync<TrackDetailsIndex>(x => x
.Conflicts(Conflicts.Abort) .Conflicts(Conflicts.Proceed)
.Query( .Query(
q => q =>
q.Terms(t => t.Field(f => f.OrderId).Terms(orderIds)) q.Terms(t => t.Field(f => f.OrderId).Terms(orderIds))
&& q.Term(t => t.IsCanDelete, true) && q.Term(t => t.IsCanDelete, true)
&& q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))) && q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes)))
.WaitForCompletion()
); );
if (!r.IsValid) 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) public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)