diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 3577eceb..da6207a5 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -3,16 +3,15 @@ using SJZY.Track.Application.Dtos.TrackPull; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using Volo.Abp.AutoMapper; -namespace SJZY.Track.Application.AutoMapper +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPullAutoMapperProfile : Profile { - public class TrackPullAutoMapperProfile : Profile + public TrackPullAutoMapperProfile() { - public TrackPullAutoMapperProfile() - { - CreateMap(MemberList.None); - CreateMap(MemberList.None).Ignore(dest => dest.Id) - .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); - CreateMap(MemberList.None); - } + CreateMap(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs new file mode 100644 index 00000000..420b0e23 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -0,0 +1,10 @@ +using AutoMapper; + +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPushAutoMapperProfile : Profile +{ + public TrackPushAutoMapperProfile() + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index f76abe50..fcd56e92 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -2,7 +2,6 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Dtos.TrackPull; -using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs new file mode 100644 index 00000000..b04e1194 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackPush; + +/// +/// 轨迹推送 +/// +[ApiExplorerSettings(GroupName = "轨迹推送")] +[Route("/Track/PushConfig")] +public class TrackPushService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackPushConfigRepository _trackPushConfigRepository; + + public TrackPushService( + IStringLocalizer stringLocalizer, + ITrackPushConfigRepository trackPushConfigRepository) + { + _stringLocalizer = stringLocalizer; + _trackPushConfigRepository = trackPushConfigRepository; + } + + /// + /// 轨迹推送配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPushConfigRepository.GetPageAsync(input); + } +} \ 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 abceffa6..82866c1f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -1,5 +1,9 @@ -namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; + +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; public interface ITrackPushConfigRepository : IBasicRepository { + Task> GetPageAsync(KeywordsInputVO input); } \ 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 index e45b7de8..15d25401 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs @@ -7,7 +7,7 @@ public class GetTrackPullConfigPageOutputVO /// public DateTime? CreateTime { get; set; } - public int? Id { get; set; } + public int Id { get; set; } /// /// 服务商名称 diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs new file mode 100644 index 00000000..9b2e3a83 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -0,0 +1,26 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushConfigPageOutputVO +{ + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 客户名称 + /// + public string CustomName { get; set; } + + public int Id { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystem { get; set; } + + /// + /// 模板名称 + /// + public string TrackTemplate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index 32c71905..a69f2406 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,8 +1,37 @@ using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency { + public async Task> GetPageAsync(KeywordsInputVO input) + { + return await AsQueryable() + .LeftJoin((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, template) => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) + .Filter(null, true) + .Where(trackPush => !trackPush.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .OrderByDescending(trackPush => trackPush.CreateTime) + .Select((trackPush, system, externalSubject, template) => new GetTrackPushConfigPageOutputVO + { + Id = trackPush.Id, + SubSystem = system.CnName, + CustomName = externalSubject.Abbreviation, + TrackTemplate = SqlFunc.Subqueryable() + .Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) + .SelectStringJoin(template => template.Name, ","), + CreateTime = trackPush.CreateTime + }) + .Distinct() + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file