From 7148bfdc6bf3937223a9071592de92c2f402e0dc Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Fri, 27 Dec 2024 11:41:59 +0800 Subject: [PATCH 1/3] review --- .../CAP/EventHandlers/TrackDeleteEventHandler.cs | 16 +++++++++------- .../CAP/EventHandlers/TrackUpsertEventHandler.cs | 7 ++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/SJZY.Track.Application/CAP/EventHandlers/TrackDeleteEventHandler.cs b/src/SJZY.Track.Application/CAP/EventHandlers/TrackDeleteEventHandler.cs index 9a2c74f2..7d3c37bc 100644 --- a/src/SJZY.Track.Application/CAP/EventHandlers/TrackDeleteEventHandler.cs +++ b/src/SJZY.Track.Application/CAP/EventHandlers/TrackDeleteEventHandler.cs @@ -18,13 +18,13 @@ namespace SJZY.Track.Application.CAP.EventHandlers; public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe { private readonly ICapPublisher _capPublisher; - private readonly IOrderRepository _orderRepository; - private readonly ITrackStatusRepository _trackStatusRepository; - private readonly ITrackContentRepository _trackContentRepository; - private readonly IProvideQueries _provideQueries; - private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; - private readonly RabbitClientBus _rabbitClientBus; private readonly IOrderOperationRecordEsRepository _orderOperationRecordEsRepository; + private readonly IOrderRepository _orderRepository; + private readonly IProvideQueries _provideQueries; + private readonly RabbitClientBus _rabbitClientBus; + private readonly ITrackContentRepository _trackContentRepository; + private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; + private readonly ITrackStatusRepository _trackStatusRepository; public TrackDeleteEventHandler(IProvideQueries provideQueries, IOrderRepository orderRepository, ICapPublisher capPublisher, @@ -128,6 +128,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe private async Task PublicTrackTopicAsync(TrackDeleteEvent eto, List trackList) { + // // todo: review 这里查库太多了 if (trackList == null) return; @@ -167,7 +168,8 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe Option = 2 }; - _rabbitClientBus.Publish(GlobalConst.TrackChangeExchange, $"TrackChange.{content.SubSystemCode}", Encoding.UTF8.GetBytes(data.ToJson())); + _rabbitClientBus.Publish(GlobalConst.TrackChangeExchange, $"TrackChange.{content.SubSystemCode}", + Encoding.UTF8.GetBytes(data.ToJson())); } } diff --git a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs index a20ec106..b2d26a9a 100644 --- a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs @@ -15,12 +15,12 @@ namespace SJZY.Track.Application.CAP.EventHandlers; public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe { + private readonly BroadcastingService _broadcastingService; private readonly ICapPublisher _capPublisher; + private readonly IOrderOperationRecordEsRepository _orderOperationRecordEsRepository; private readonly IOrderRepository _orderRepository; private readonly IProvideQueries _provideQueries; private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; - private readonly BroadcastingService _broadcastingService; - private readonly IOrderOperationRecordEsRepository _orderOperationRecordEsRepository; public TrackUpsertEventHandler( IOrderRepository orderRepository, @@ -50,6 +50,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe // 处理广播事件 if (content is { IsToMq: true }) + // todo: review BroadcastingService抽一层接口,面向抽象编程 await _broadcastingService.TrackChangePublicTopicAsync(@event, content); if (canNextOrderIds.Count == 0) return; @@ -199,7 +200,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe DestinationTimeZone = @event.DestinationTimeZone, EstimatedDeliveryDate = @event.EstimatedDeliveryDate }); - + // 触发轨迹推送事件(异步) var trackPushEvent = new TrackPushEvent { From 987d533341b3eabfdf3a2fe56a2e424746a7fbca Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Fri, 27 Dec 2024 11:43:40 +0800 Subject: [PATCH 2/3] review --- .../CAP/EventHandlers/TrackUpsertEventHandler.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs index f521f11a..f1f3747d 100644 --- a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs @@ -50,6 +50,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe // 处理广播事件 if (content != null && (content.IsToMq || @event.IsToMq)) + // todo: review BroadcastingService抽一层接口,面向抽象编程 _broadcastingService.TrackChangePublicTopicAsync(@event, content); if (canNextOrderIds.Count == 0) return; From 750e96d7cf454a47fb7c1609a504b0de729b5924 Mon Sep 17 00:00:00 2001 From: hardstylewyl <827778732@qq.com> Date: Fri, 27 Dec 2024 15:04:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=97=B6=EF=BC=8C=E8=BD=A8=E8=BF=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E4=B8=8D=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackDetailsEsRepository.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsEsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsEsRepository.cs index f0c8f048..c6247003 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsEsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsEsRepository.cs @@ -378,18 +378,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract(x => x .Index(GlobalConst.TrackDetailsIndex) - .Source(s => s.Includes(fd => fd - .Field(f => f.OrderId) - .Field(f => f.OrderNo) - .Field(f => f.TrackStatus) - .Field(f => f.TrackCode) - .Field(f => f.TrackContent) - .Field(f => f.OriginTrackContent) - .Field(f => f.TrackPlace) - .Field(f => f.TrackTime) - .Field(f => f.ZeroTrackTime) - .Field(f => f.TrackTimeZone) - )) + .Source() .Query(q => q.Bool(b => b .Must(