完成 轨迹推送配置列表 接口

This commit is contained in:
柳文翔 2024-03-01 09:26:11 +08:00
parent 2998d69ed9
commit c3886b1d8b
8 changed files with 117 additions and 12 deletions

View File

@ -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<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None);
}
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None);
}
}

View File

@ -0,0 +1,10 @@
using AutoMapper;
namespace SJZY.Track.Application.AutoMapper;
public class TrackPushAutoMapperProfile : Profile
{
public TrackPushAutoMapperProfile()
{
}
}

View File

@ -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;

View File

@ -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;
/// <summary>
/// 轨迹推送
/// </summary>
[ApiExplorerSettings(GroupName = "轨迹推送")]
[Route("/Track/PushConfig")]
public class TrackPushService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
public TrackPushService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackPushConfigRepository trackPushConfigRepository)
{
_stringLocalizer = stringLocalizer;
_trackPushConfigRepository = trackPushConfigRepository;
}
/// <summary>
/// 轨迹推送配置列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("GetPage")]
public async Task<UnifyPageResultDto<GetTrackPushConfigPageOutputVO>> GetPageAsync([FromBody] KeywordsInputVO input)
{
return await _trackPushConfigRepository.GetPageAsync(input);
}
}

View File

@ -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<TrackPushConfigEntity>
{
Task<UnifyPageResultDto<GetTrackPushConfigPageOutputVO>> GetPageAsync(KeywordsInputVO input);
}

View File

@ -7,7 +7,7 @@ public class GetTrackPullConfigPageOutputVO
/// </summary>
public DateTime? CreateTime { get; set; }
public int? Id { get; set; }
public int Id { get; set; }
/// <summary>
/// 服务商名称

View File

@ -0,0 +1,26 @@
namespace SJZY.Track.Domain.Dtos.TrackPush;
public class GetTrackPushConfigPageOutputVO
{
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string CustomName { get; set; }
public int Id { get; set; }
/// <summary>
/// 子系统名称
/// </summary>
public string SubSystem { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TrackTemplate { get; set; }
}

View File

@ -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<TrackPushConfigEntity>, ITrackPushConfigRepository,
IScopedDependency
{
public async Task<UnifyPageResultDto<GetTrackPushConfigPageOutputVO>> GetPageAsync(KeywordsInputVO input)
{
return await AsQueryable()
.LeftJoin<VSystemEntity>((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted)
.LeftJoin<VExternalSubjectEntity>((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted)
.LeftJoin<TrackTemplateEntity>((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<TrackTemplateEntity>()
.Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
.SelectStringJoin(template => template.Name, ","),
CreateTime = trackPush.CreateTime
})
.Distinct()
.ToPagedListAsync(input.PageIndex, input.PageSize);
}
}