From 249a77851b12a43eaef90ff4b37f985c4230fb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 09:44:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 11 +++ .../TrackTemplates/TrackTemplateService.cs | 8 +- .../ITrackPullConfigRepository.cs | 7 ++ .../ITrackTemplateRepository.cs | 8 +- .../GetTrackPullConfigDetailOutputVO.cs | 82 +++++++++++++++++++ .../TrackPullConfigRepository.cs | 19 +++++ .../TrackTemplateRepository.cs | 8 +- 7 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 08e8406c..e9300b88 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -46,4 +46,15 @@ public class TrackPullService : ApplicationService, ITransientDependency { return await _trackPullConfigRepository.GetContentPageAsync(input); } + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int id) + { + return await _trackPullConfigRepository.GetDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 4716c2ba..422aafde 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -164,7 +164,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); - if (await _trackTemplateRepository.IsAnyAsync(isAnyExp)) + if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); } @@ -174,18 +174,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var entity = ObjectMapper.Map(input); - await _trackTemplateRepository.InsertAsync(entity); + await _trackTemplateRepository.InsertContentAsync(entity); break; case OptionTypeNoNull.修改: - var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? + var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); ObjectMapper.Map(input, oldEntity); - await _trackTemplateRepository.UpdateAsync(oldEntity); + await _trackTemplateRepository.UpdateContentAsync(oldEntity); break; diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 8229f27c..98bb4822 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -18,4 +18,11 @@ public interface ITrackPullConfigRepository : IBasicRepository /// Task> GetContentPageAsync(GetTrackPullContentPageInputVO input); + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + Task GetDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index a20f2ced..ac26857b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -25,13 +25,13 @@ public interface ITrackTemplateRepository : IBasicRepository Task GetContentDetailAsync(int id); - Task IsAnyAsync(Expression> whereExpression); + Task IsContentAnyAsync(Expression> whereExpression); - Task InsertAsync(TrackTemplateContentEntity insertObj); + Task InsertContentAsync(TrackTemplateContentEntity insertObj); - Task GetByIdAsync(int id); + Task GetContentByIdAsync(int id); - Task UpdateAsync(TrackTemplateContentEntity updateObj); + Task UpdateContentAsync(TrackTemplateContentEntity updateObj); Task SoftDeleteContentAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs new file mode 100644 index 00000000..76fbdaf4 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs @@ -0,0 +1,82 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull +{ + public class GetTrackPullConfigDetailOutputVO + { + public int Id { get; set; } + + /// + /// 拉取轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 返参解析对象 + /// + public int ParseMethod { get; set; } + + /// + /// 定时任务(分钟) + /// + public int PullInterval { get; set; } + + /// + /// 服务商 + /// + public string ServiceProvider { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 拉取轨迹时区 + /// + public string TackTimeZoneName { get; set; } + + /// + /// 拉取轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } + + /// + /// 拉取轨迹内容 + /// + public string TrackContentName { get; set; } + + /// + /// 拉取轨迹发生地 + /// + public string TrackPlaceName { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板 + /// + public string TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } + + /// + /// 拉取轨迹发生时间 + /// + public string TrackTimeName { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 43b0d367..289552b0 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -51,4 +51,23 @@ public class TrackPullConfigRepository : BasicRepository, }) .ToPagedListAsync(input.PageIndex, input.PageSize); } + + public async Task GetDetailAsync(int id) + { + return await AsQueryable() + .LeftJoin((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted) + .LeftJoin((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted) + .InnerJoin((trackPull, system, service, template, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted) + .Filter(null, true) + .Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted) + .Select((trackPull, system, service, template, paramsConfig) => new GetTrackPullConfigDetailOutputVO + { + Id = trackPull.Id, + SubSystem = system.CnName, + ServiceProvider = service.Name, + TrackTemplate = template.Name + }, true) + .SingleAsync(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index f26d606c..ee2ee76f 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -126,25 +126,25 @@ public class TrackTemplateRepository : BasicRepository, ITr } /// - public async Task IsAnyAsync(Expression> whereExpression) + public async Task IsContentAnyAsync(Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).AnyAsync(); } /// - public async Task InsertAsync(TrackTemplateContentEntity insertObj) + public async Task InsertContentAsync(TrackTemplateContentEntity insertObj) { return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; } /// - public async Task GetByIdAsync(int id) + public async Task GetContentByIdAsync(int id) { return await Context.Queryable().InSingleAsync(id); } /// - public async Task UpdateAsync(TrackTemplateContentEntity updateObj) + public async Task UpdateContentAsync(TrackTemplateContentEntity updateObj) { return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); }