diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 58d32d12..e8f1425c 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -8,8 +8,11 @@ + + + @@ -26,8 +29,4 @@ - - - - diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs new file mode 100644 index 00000000..5bd82b7f --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPull; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackPull; + +/// +/// 轨迹拉取 +/// +[ApiExplorerSettings(GroupName = "轨迹拉取")] +[Route("/Track/PullConfig")] +public class TrackPullService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; + + public TrackPullService( + IStringLocalizer stringLocalizer, + ITrackPullConfigRepository trackPullConfigRepository) + { + _stringLocalizer = stringLocalizer; + _trackPullConfigRepository = trackPullConfigRepository; + } + + /// + /// 轨迹拉取配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPullConfigRepository.GetPageAsync(input); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 3b0b8441..0b8173e3 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -1,5 +1,14 @@ -namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPull; + +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; public interface ITrackPullConfigRepository : IBasicRepository { + /// + /// 轨迹拉取配置列表 + /// + /// + /// + Task> GetPageAsync(KeywordsInputVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs new file mode 100644 index 00000000..9cf11c60 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.Common; + +public class KeywordsInputVO : PageInfoInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + + /// + /// 选中项 + /// + public int? SelectedId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs new file mode 100644 index 00000000..e45b7de8 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs @@ -0,0 +1,26 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullConfigPageOutputVO +{ + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + public int? Id { get; set; } + + /// + /// 服务商名称 + /// + public string ServiceProvider { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystem { get; set; } + + /// + /// 模板名称 + /// + public string TrackTemplate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..0354af7d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index d63120b7..3082bafe 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -1,8 +1,33 @@ using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPull; +using SJZY.Track.Domain.VEntities; namespace SJZY.Track.Repository; public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency { + public async Task> GetPageAsync(KeywordsInputVO input) + { + 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) + .Filter(null, true) + .Where(trackPull => !trackPull.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, trackPull => trackPull.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPull, system, service, template) => service.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .OrderByDescending(trackPull => trackPull.CreateTime) + .Select((trackPull, system, service, template) => new GetTrackPullConfigPageOutputVO + { + Id = trackPull.Id, + SubSystem = system.CnName, + ServiceProvider = service.Name, + TrackTemplate = template.Name, + CreateTime = trackPull.CreateTime + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index d853725a..f26d606c 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -54,7 +54,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId>0, (a, b) => SqlFunc.IIF(a.Id==input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -90,6 +90,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .Filter(null, true) .Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) + .OrderByDescending(templateContent => templateContent.CreateTime) .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO {