add-interface: 查询推送映射订单类型选项卡
/Track/PushConfig/GetConfigTags add-interface: 查询订单类型名称字典 /Track/Order/GetOrderTypeDict
This commit is contained in:
parent
7c3e458642
commit
52b9a46147
@ -0,0 +1,14 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
|
public class TrackPushConfigTagDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型值
|
||||||
|
/// </summary>
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型名称
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
@ -60,6 +60,15 @@ public class TrackOrderService : ApplicationService
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取订单类型字典
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetOrderTypeDict")]
|
||||||
|
public async Task<Dictionary<string, string>> GetOrderTypeDict()
|
||||||
|
{
|
||||||
|
return await _orderRepository.GetTrackOrderTypeDict();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新订单状态
|
/// 更新订单状态
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
|||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.Common;
|
using SJZY.Track.Domain.Dtos.Common;
|
||||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||||
@ -22,15 +23,18 @@ public class TrackPushService : ApplicationService, ISingletonDependency
|
|||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
||||||
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
|
||||||
public TrackPushService(
|
public TrackPushService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackPushConfigRepository trackPushConfigRepository,
|
ITrackPushConfigRepository trackPushConfigRepository,
|
||||||
ITrackPushCacheService trackPushCacheService)
|
ITrackPushCacheService trackPushCacheService,
|
||||||
|
IOrderRepository orderRepository)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackPushConfigRepository = trackPushConfigRepository;
|
_trackPushConfigRepository = trackPushConfigRepository;
|
||||||
_trackPushCacheService = trackPushCacheService;
|
_trackPushCacheService = trackPushCacheService;
|
||||||
|
_orderRepository = orderRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -44,6 +48,26 @@ public class TrackPushService : ApplicationService, ISingletonDependency
|
|||||||
return await _trackPushConfigRepository.GetPageAsync(input);
|
return await _trackPushConfigRepository.GetPageAsync(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取推送配置类型标签卡列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetConfigTags")]
|
||||||
|
public async Task<List<TrackPushConfigTagDto>> GetConfigTags([FromBody] GetConfigTagsInputVO inputVo)
|
||||||
|
{
|
||||||
|
var orderTypes = await _trackPushConfigRepository.GetConfigTags(inputVo);
|
||||||
|
if (orderTypes.Count == 0) return new List<TrackPushConfigTagDto>();
|
||||||
|
var trackOrderTypes = await _orderRepository.GetTrackOrderTypeDict();
|
||||||
|
|
||||||
|
return orderTypes.Select(x => new TrackPushConfigTagDto
|
||||||
|
{
|
||||||
|
Type = x,
|
||||||
|
Name = trackOrderTypes[x.ToString()]
|
||||||
|
})
|
||||||
|
.OrderBy(x => x.Type)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹推送配置内容列表
|
/// 轨迹推送配置内容列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -5,6 +5,13 @@ namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
|||||||
|
|
||||||
public interface IOrderRepository : IBasicRepository<OrderEntity>
|
public interface IOrderRepository : IBasicRepository<OrderEntity>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取订单类型字典
|
||||||
|
/// key:OrderType value:TypeName
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<Dictionary<string, string>> GetTrackOrderTypeDict();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取分页的轨迹订单
|
/// 获取分页的轨迹订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -39,4 +39,5 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
|
|||||||
Task<List<QueryTrackPullMappingsInfoVO>> QueryTrackPullMappingsAsync(QueryTrackPullMappingsInputVO input);
|
Task<List<QueryTrackPullMappingsInfoVO>> QueryTrackPullMappingsAsync(QueryTrackPullMappingsInputVO input);
|
||||||
Task<List<GetTrackPushContentListVo>> GetTrackPushContentListAsync(int subSystemId, int customerId);
|
Task<List<GetTrackPushContentListVo>> GetTrackPushContentListAsync(int subSystemId, int customerId);
|
||||||
Task<string?> GetServiceCodeByCustomerIdAsync(int customerId);
|
Task<string?> GetServiceCodeByCustomerIdAsync(int customerId);
|
||||||
|
Task<HashSet<int>> GetConfigTags(GetConfigTagsInputVO inputVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,4 +71,9 @@ public partial class GlobalConst
|
|||||||
/// 轨迹推送预警redis key前缀
|
/// 轨迹推送预警redis key前缀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackPushWaringKeyPrefix = "TrackPushWaring";
|
public const string TrackPushWaringKeyPrefix = "TrackPushWaring";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹订单类型redis key前缀(hash类型)
|
||||||
|
/// </summary>
|
||||||
|
public const string TrackOrderTypeKey = "TrackOrderType";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
namespace SJZY.Track.Domain.Dtos.TrackPush;
|
||||||
|
|
||||||
|
public class GetConfigTagsInputVO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹推送配置id
|
||||||
|
/// </summary>
|
||||||
|
public int TrackPushConfigId { get; set; }
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
private static readonly Dictionary<string, Dictionary<int, string>> _empty2 = new();
|
private static readonly Dictionary<string, Dictionary<int, string>> _empty2 = new();
|
||||||
private static readonly TimeSpan _thirdPartyOrderNumberCacheTimeSpan = TimeSpan.FromMinutes(3);
|
private static readonly TimeSpan _thirdPartyOrderNumberCacheTimeSpan = TimeSpan.FromMinutes(3);
|
||||||
private static readonly TimeSpan _mainDataEnumCacheTimeSpan = TimeSpan.FromMinutes(5);
|
private static readonly TimeSpan _mainDataEnumCacheTimeSpan = TimeSpan.FromMinutes(5);
|
||||||
|
private static readonly TimeSpan _orderTypeCacheTimeSpan = TimeSpan.FromMinutes(1);
|
||||||
|
|
||||||
private async Task<Dictionary<int, string>> GetThirdPartyOrderNumberForCacheAsync(int[] orderIds)
|
private async Task<Dictionary<int, string>> GetThirdPartyOrderNumberForCacheAsync(int[] orderIds)
|
||||||
{
|
{
|
||||||
@ -99,6 +100,28 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Dictionary<string, string>> GetTrackOrderTypeDict()
|
||||||
|
{
|
||||||
|
const string key = "TrackOrderType";
|
||||||
|
var orderTypes = await _memoryCache.GetOrCreateAsync(key, async (entry) =>
|
||||||
|
{
|
||||||
|
// 固定时间周期后强制更新
|
||||||
|
entry.AbsoluteExpirationRelativeToNow = _orderTypeCacheTimeSpan;
|
||||||
|
// 查询主数据
|
||||||
|
return await Context.Queryable<VEnumValueInfoEntity>()
|
||||||
|
.Where(x => x.Property == GlobalConst.MainDataKey_OrderType)
|
||||||
|
.ToDictionaryAsync(x => x.Enumkey, x => x.Disp);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新redis缓存
|
||||||
|
await RedisHelper.Client.HMSetAsync(GlobalConst.TrackOrderTypeKey, orderTypes);
|
||||||
|
|
||||||
|
// redis内数据只更新不清理
|
||||||
|
var dict = RedisHelper.Client.HGetAll<string>(GlobalConst.TrackOrderTypeKey);
|
||||||
|
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<UnifyPageResultDto<TrackOrderVO>> GetTrackOrderPagedList(GetPageTrackOrderInputVO input)
|
public async Task<UnifyPageResultDto<TrackOrderVO>> GetTrackOrderPagedList(GetPageTrackOrderInputVO input)
|
||||||
{
|
{
|
||||||
//查询完去重
|
//查询完去重
|
||||||
|
|||||||
@ -228,4 +228,14 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
.Select(x => x.ApiServiceCode)
|
.Select(x => x.ApiServiceCode)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<HashSet<int>> GetConfigTags(GetConfigTagsInputVO input)
|
||||||
|
{
|
||||||
|
var orderTypes = await Context.Queryable<TrackPushContentConfigEntity>()
|
||||||
|
.Where(x => x.TrackPushConfigId == input.TrackPushConfigId)
|
||||||
|
.Select(x => x.OrderNoType)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return new HashSet<int>(orderTypes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user