diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackPushContentConfigDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushConfigDto.cs similarity index 96% rename from src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackPushContentConfigDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushConfigDto.cs index a019087f..1f129458 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackPushContentConfigDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushConfigDto.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; public class TrackPushConfigDto { diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs index ab34ac01..91b80c3e 100644 --- a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs +++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.TrackPush; namespace SJZY.Track.Application.Contract.Services; diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs index 6be69d46..213d7872 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -1,8 +1,8 @@ using AutoMapper; -using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.TrackPush; using Volo.Abp.AutoMapper; namespace SJZY.Track.Application.AutoMapper; @@ -15,7 +15,6 @@ public class TrackPushAutoMapperProfile : Profile CreateMap(MemberList.None).Ignore(dest => dest.Id) .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true)); CreateMap(MemberList.None); - CreateMap(MemberList.None) - .ForMember(dest => dest.OrderType, opt => opt.MapFrom(source => source.OrderNoType)); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 2da1fd9b..97a07e17 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -1,7 +1,7 @@ using DotNetCore.CAP; using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Events; using SJZY.Track.Application.Contract.Services; using SJZY.Track.Domain.Aggregates.OrderAggregate; diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs index 5dc319f8..fe72985a 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs @@ -1,9 +1,10 @@ using System.Linq.Expressions; using SJZY.Expand.ABP.Core; -using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Services; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Consts; +using SJZY.Track.Domain.Dtos.TrackPush; namespace SJZY.Track.Application.Services.TrackPush; @@ -74,16 +75,13 @@ public class TrackPushCacheService : ApplicationService, ITrackPushCacheService var trackPushConfigEntity = await _trackPushConfigRepository.GetFirstAsync(exp); if (trackPushConfigEntity == null) return data; - var trackPushContentList = - await _trackPushConfigRepository.GetContentListAsync(x => x.TrackPushConfigId == trackPushConfigEntity.Id); + var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfigEntity.Id); if (trackPushContentList.Count == 0) return data; - trackPushContentList = trackPushContentList.OrderBy(x => x.Sort).ToList(); - data.IsAutoPush = trackPushConfigEntity.IsAutoPush; data.ContentConfigs = - ObjectMapper.Map, List>(trackPushContentList); - + ObjectMapper.Map, List>(trackPushContentList); + ; await RedisHelper.Client.SetAsync( TrackPushContentKey(trackPushConfigEntity.SubSystemId, trackPushConfigEntity.CustomId), data); diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 80013967..641fb386 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -23,11 +23,16 @@ public interface ITrackPushConfigRepository : IBasicRepository UpdateContentAsync(TrackPushContentConfigEntity updateObj); - Task> GetContentListAsync(Expression> whereExpression); + Task> GetContentListAsync( + Expression> whereExpression); + + Task> GetContentListAsync(int configId); Task UpdateContentRangeAsync(List updateObjs); - Task ContentMaxAsync(Expression> columns, Expression> whereExpression); + Task ContentMaxAsync(Expression> columns, + Expression> whereExpression); - Task UpdateContentAsync(Expression> columns, Expression> whereExpression); + Task UpdateContentAsync(Expression> columns, + Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/TrackPushContentConfigVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/TrackPushContentConfigVO.cs new file mode 100644 index 00000000..1f67fb8d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/TrackPushContentConfigVO.cs @@ -0,0 +1,59 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class TrackPushContentConfigVO +{ + /// + /// 是否自动推送 + /// + public bool IsAutoPush { get; set; } + + /// + /// 是否支持更新 + /// + public bool IsCanUpdate { get; set; } + + /// + /// 服务商code + /// + public string ServiceProviderCode { get; set; } = null!; + + /// + /// 扩展字段参数值 + /// + public string? ExpandFieldsValue { get; set; } + + /// + /// 推送单号类型(主数据枚举TrackOrderType) + /// + public int OrderType { get; set; } + + /// + /// 轨迹代码参数值 + /// + public string? TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 轨迹内容参数值 + /// + public string? TrackContentValue { get; set; } + + /// + /// 轨迹内容英文参数值 + /// + public string? TrackEnContentValue { get; set; } + + /// + /// 轨迹状态参数值 + /// + public string? TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + public double? TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index e58b1020..74bfc0d3 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -1,14 +1,13 @@ -using SJZY.Expand.ABP.Core.PublicMethords; +using System.Linq.Expressions; +using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; 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.Enums; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.VData.Entitys; -using System.Linq.Expressions; namespace SJZY.Track.Repository.Repositories; @@ -19,11 +18,14 @@ public class TrackPushConfigRepository : BasicRepository, { 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) => + trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) .Filter(null, true) .Where(trackPush => !trackPush.IsDeleted) .WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId) - .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject) => externalSubject.Abbreviation.Contains(input.Keywords!) || externalSubject.Name.Contains(input.Keywords!)) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), + (trackPush, system, externalSubject) => externalSubject.Abbreviation.Contains(input.Keywords!) || + externalSubject.Name.Contains(input.Keywords!)) .OrderByDescending(trackPush => trackPush.CreateTime) .Select((trackPush, system, externalSubject) => new GetTrackPushConfigPageOutputVO { @@ -36,11 +38,14 @@ public class TrackPushConfigRepository : BasicRepository, .ToPagedListAsync(input.PageIndex, input.PageSize); } - public async Task> GetContentPageAsync(GetTrackPushContentPageInputVO input) + public async Task> GetContentPageAsync( + GetTrackPushContentPageInputVO input) { return await Context.Queryable() .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) - .LeftJoin((pushContent, trackContent, enumValue) => enumValue.Property == EnumPropertyEnums.单号类型.GetDescription() && pushContent.OrderNoType == enumValue.Enumkey && !enumValue.IsDeleted) + .LeftJoin((pushContent, trackContent, enumValue) => + enumValue.Property == EnumPropertyEnums.单号类型.GetDescription() && + pushContent.OrderNoType == enumValue.Enumkey && !enumValue.IsDeleted) .Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId) .OrderBy(pushContent => pushContent.Sort) .Select((pushContent, trackContent, enumValue) => new GetTrackPushContentPageOutputVO @@ -56,9 +61,12 @@ public class TrackPushConfigRepository : BasicRepository, { 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, service) => trackPush.ServiceProviderId == service.Id && !service.IsDeleted) - .InnerJoin((trackPush, system, externalSubject, service, paramsConfig) => trackPush.Id == paramsConfig.PullOrPushConfigId && paramsConfig.IsPush && !paramsConfig.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => + trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, service) => + trackPush.ServiceProviderId == service.Id && !service.IsDeleted) + .InnerJoin((trackPush, system, externalSubject, service, paramsConfig) => + trackPush.Id == paramsConfig.PullOrPushConfigId && paramsConfig.IsPush && !paramsConfig.IsDeleted) .Filter(null, true) .Where(trackPush => trackPush.Id == id && !trackPush.IsDeleted) .Select((trackPush, system, externalSubject, service, paramsConfig) => new GetTrackPushConfigDetailOutputVO @@ -112,7 +120,32 @@ public class TrackPushConfigRepository : BasicRepository, return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); } - public async Task> GetContentListAsync(Expression> whereExpression) + public async Task> GetContentListAsync(int configId) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.TrackPushConfigId) + .LeftJoin((a, b, c) => a.ServiceProviderId == c.Id) + .Where(a => a.Id == configId) + .OrderBy((a, b) => b.Sort) + .Select((a, b, c) => new TrackPushContentConfigVO + { + IsAutoPush = a.IsAutoPush, + IsCanUpdate = a.IsCanUpdate, + ServiceProviderCode = c.Code, + ExpandFieldsValue = b.ExpandFieldsValue, + OrderType = b.OrderNoType, + TrackContentCodeValue = b.TrackContentCodeValue, + TrackContentId = b.TrackContentId, + TrackContentValue = b.TrackContentValue, + TrackEnContentValue = b.TrackEnContentValue, + TrackStatusValue = b.TrackStatusValue, + TrackTimeZone = b.TrackTimeZone + }) + .ToListAsync(); + } + + public async Task> GetContentListAsync( + Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).ToListAsync(); } @@ -122,13 +155,16 @@ public class TrackPushConfigRepository : BasicRepository, return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); } - public async Task ContentMaxAsync(Expression> columns, Expression> whereExpression) + public async Task ContentMaxAsync(Expression> columns, + Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).MaxAsync(columns); } - public async Task UpdateContentAsync(Expression> columns, Expression> whereExpression) + public async Task UpdateContentAsync(Expression> columns, + Expression> whereExpression) { - return await Context.Updateable().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync(); + return await Context.Updateable().SetColumns(columns).Where(whereExpression) + .ExecuteCommandHasChangeAsync(); } } \ No newline at end of file