From 6580831a4ad1425ae947e0ac420ec3601c81626b Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 11:54:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AE=A2=E5=8D=95id=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ITrackDetailsRepository.cs | 1 + .../Repositories/TrackDetailsRepository.cs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 444dd072..89d812a1 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -13,4 +13,5 @@ public interface ITrackDetailsRepository Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); + Task> GetListAsync(int orderId); } \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs index 2737c39d..c23a28fd 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs @@ -37,7 +37,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!response.IsValid) throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); @@ -73,6 +73,21 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract> GetListAsync(int orderId) + { + var data = await Context.SearchAsync(x => x + .Source(s => s.Includes(fd => fd + .Field(f => f.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TraceTimeZone) + )).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)))); + + return data?.Documents?.ToList(); + } + public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) { if (input.OrderNos.Count < 1) return default; From a54f071769f720133534afe85df5c1b3fad93f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 14:10:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 ++++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushContentDetailOutputVO.cs | 61 +++++++++++++++++++ .../Repositories/TrackPushConfigRepository.cs | 13 ++++ 4 files changed, 87 insertions(+) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index f303cc4c..a862e224 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -57,4 +57,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetDetailAsync(id); } + + /// + /// 轨迹推送配置内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackPushConfigRepository.GetContentDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 9050f090..39b19ad2 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -10,4 +10,6 @@ public interface ITrackPushConfigRepository : IBasicRepository> GetContentPageAsync(GetTrackPushContentPageInputVO input); Task GetDetailAsync(int id); + + Task GetContentDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs new file mode 100644 index 00000000..2bad0d5a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs @@ -0,0 +1,61 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentDetailOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsValue { get; set; } + + public int Id { get; set; } + + /// + /// 推送单号类型 + /// + public int OrderNoType { get; set; } + + /// + /// 推送轨迹排序 + /// + public int Sort { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 轨迹推送配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusValue { get; set; } + + /// + /// 推送轨迹时区 + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index d5180da1..d1ce352b 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -69,4 +69,17 @@ public class TrackPushConfigRepository : BasicRepository, }, true) .SingleAsync(); } + + public async Task GetContentDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) + .Where(pushContent => pushContent.Id == id) + .Select((pushContent, trackContent) => new GetTrackPushContentDetailOutputVO + { + Id = pushContent.Id, + Code = trackContent.Code + "-" + trackContent.Content, + }, true) + .SingleAsync(); + } } \ No newline at end of file