1
This commit is contained in:
parent
c76f8a9908
commit
3bc9b233d5
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
|
||||
public class TrackPushConfigDto
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Services;
|
||||
|
||||
|
||||
@ -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<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
||||
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true));
|
||||
CreateMap<EditTrackPushContentInput, TrackPushContentConfigEntity>(MemberList.None);
|
||||
CreateMap<TrackPushContentConfigEntity, TrackPushContentConfigDto>(MemberList.None)
|
||||
.ForMember(dest => dest.OrderType, opt => opt.MapFrom(source => source.OrderNoType));
|
||||
CreateMap<TrackPushContentConfigVO, TrackPushContentConfigDto>(MemberList.None);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -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<TrackPushContentConfigEntity>, List<TrackPushContentConfigDto>>(trackPushContentList);
|
||||
|
||||
ObjectMapper.Map<List<TrackPushContentConfigVO>, List<TrackPushContentConfigDto>>(trackPushContentList);
|
||||
;
|
||||
await RedisHelper.Client.SetAsync(
|
||||
TrackPushContentKey(trackPushConfigEntity.SubSystemId, trackPushConfigEntity.CustomId), data);
|
||||
|
||||
|
||||
@ -23,11 +23,16 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
|
||||
|
||||
Task<bool> UpdateContentAsync(TrackPushContentConfigEntity updateObj);
|
||||
|
||||
Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
Task<List<TrackPushContentConfigEntity>> GetContentListAsync(
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
|
||||
Task<List<TrackPushContentConfigVO>> GetContentListAsync(int configId);
|
||||
|
||||
Task<bool> UpdateContentRangeAsync(List<TrackPushContentConfigEntity> updateObjs);
|
||||
|
||||
Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns,
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
|
||||
Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns,
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPush;
|
||||
|
||||
public class TrackPushContentConfigVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否自动推送
|
||||
/// </summary>
|
||||
public bool IsAutoPush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持更新
|
||||
/// </summary>
|
||||
public bool IsCanUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商code
|
||||
/// </summary>
|
||||
public string ServiceProviderCode { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 扩展字段参数值
|
||||
/// </summary>
|
||||
public string? ExpandFieldsValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推送单号类型(主数据枚举TrackOrderType)
|
||||
/// </summary>
|
||||
public int OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹代码参数值
|
||||
/// </summary>
|
||||
public string? TrackContentCodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容参数值
|
||||
/// </summary>
|
||||
public string? TrackContentValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容英文参数值
|
||||
/// </summary>
|
||||
public string? TrackEnContentValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态参数值
|
||||
/// </summary>
|
||||
public string? TrackStatusValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹时区GMT
|
||||
/// </summary>
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -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<TrackPushConfigEntity>,
|
||||
{
|
||||
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<VExternalSubjectEntity>((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<TrackPushConfigEntity>,
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public async Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(GetTrackPushContentPageInputVO input)
|
||||
public async Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(
|
||||
GetTrackPushContentPageInputVO input)
|
||||
{
|
||||
return await Context.Queryable<TrackPushContentConfigEntity>()
|
||||
.InnerJoin<TrackContentEntity>((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id)
|
||||
.LeftJoin<VEnumValueInfoEntity>((pushContent, trackContent, enumValue) => enumValue.Property == EnumPropertyEnums.单号类型.GetDescription() && pushContent.OrderNoType == enumValue.Enumkey && !enumValue.IsDeleted)
|
||||
.LeftJoin<VEnumValueInfoEntity>((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<TrackPushConfigEntity>,
|
||||
{
|
||||
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<VServiceProviderEntity>((trackPush, system, externalSubject, service) => trackPush.ServiceProviderId == service.Id && !service.IsDeleted)
|
||||
.InnerJoin<TrackPushPullParamsConfigEntity>((trackPush, system, externalSubject, service, paramsConfig) => trackPush.Id == paramsConfig.PullOrPushConfigId && paramsConfig.IsPush && !paramsConfig.IsDeleted)
|
||||
.LeftJoin<VExternalSubjectEntity>((trackPush, system, externalSubject) =>
|
||||
trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted)
|
||||
.LeftJoin<VServiceProviderEntity>((trackPush, system, externalSubject, service) =>
|
||||
trackPush.ServiceProviderId == service.Id && !service.IsDeleted)
|
||||
.InnerJoin<TrackPushPullParamsConfigEntity>((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<TrackPushConfigEntity>,
|
||||
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
public async Task<List<TrackPushContentConfigVO>> GetContentListAsync(int configId)
|
||||
{
|
||||
return await Context.Queryable<TrackPushConfigEntity>()
|
||||
.LeftJoin<TrackPushContentConfigEntity>((a, b) => a.Id == b.TrackPushConfigId)
|
||||
.LeftJoin<VServiceProviderEntity>((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<List<TrackPushContentConfigEntity>> GetContentListAsync(
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
{
|
||||
return await Context.Queryable<TrackPushContentConfigEntity>().Where(whereExpression).ToListAsync();
|
||||
}
|
||||
@ -122,13 +155,16 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
||||
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
public async Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
public async Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns,
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
{
|
||||
return await Context.Queryable<TrackPushContentConfigEntity>().Where(whereExpression).MaxAsync(columns);
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
public async Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns,
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||
{
|
||||
return await Context.Updateable<TrackPushContentConfigEntity>().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync();
|
||||
return await Context.Updateable<TrackPushContentConfigEntity>().SetColumns(columns).Where(whereExpression)
|
||||
.ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user