update: 推送行为下拉列表只显示推送映射配置中的轨迹
update: 新增/更新轨迹,增加强制推送标识,此标识会影响推送行为使其变为, 1.明确调用推送轨迹接口 2.不受推送映射的顺序限制
This commit is contained in:
parent
cc32f5b2fd
commit
97bee1e3d9
@ -124,4 +124,9 @@ public class BatchUpsertTrackInput : OrderNosInfo
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public string? Extra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制推送
|
||||
/// </summary>
|
||||
public bool ForcedPush { get; set; }
|
||||
}
|
||||
|
||||
@ -128,4 +128,9 @@ public class UpsertTrackInput : OrderNoInfo
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public string? Extra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制推送
|
||||
/// </summary>
|
||||
public bool ForcedPush { get; set; }
|
||||
}
|
||||
|
||||
@ -41,6 +41,11 @@ public class TrackPushEvent
|
||||
/// 系统推送信息
|
||||
/// </summary>
|
||||
public SystemPushStruct SystemPushInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制推送
|
||||
/// </summary>
|
||||
public bool ForcedPush { get; set; }
|
||||
}
|
||||
|
||||
public struct SystemPushStruct
|
||||
|
||||
@ -146,6 +146,12 @@ public class TrackUpsertEvent
|
||||
/// </summary>
|
||||
public string? Extra { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制推送
|
||||
/// </summary>
|
||||
public bool ForcedPush { get; set; }
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return
|
||||
|
||||
@ -69,6 +69,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (orders.Count == 0) return;
|
||||
_orders = orders;
|
||||
|
||||
if (@event.ForcedPush)
|
||||
{
|
||||
await DoPushAsync(@event);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (@event.OptionType)
|
||||
{
|
||||
case OptionType.无:
|
||||
@ -97,12 +103,16 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
foreach (var order in _orders)
|
||||
{
|
||||
if (order.QuestionType == (int) TrackProblemType.Error) continue; // 系统不推异常单,只能人工操作
|
||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||
// 强制推送只需直接查出配置
|
||||
if (@event.ForcedPush)
|
||||
config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行,为了约束顺序
|
||||
else
|
||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||
if (config == null) continue;
|
||||
// 是否自动推送
|
||||
if (!config.IsAutoPush) continue;
|
||||
//配置的类型如何和订单类型不一致则不允许推送
|
||||
// 配置的类型如何和订单类型不一致则不允许推送
|
||||
if (config.OrderType != order.OrderType) continue;
|
||||
|
||||
var log = new TrackPushRecordIndex
|
||||
@ -138,8 +148,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
var order = _orders.First(x => x.Id == track.OrderId);
|
||||
if (config is { IsAllPush: true })
|
||||
{
|
||||
// 强制推送只需直接查出配置
|
||||
if (@event.ForcedPush)
|
||||
config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||
// 推断 本次推送 是否可行
|
||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||
else
|
||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||
}
|
||||
|
||||
if (config == null) continue;
|
||||
|
||||
@ -264,7 +264,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
TrackTime = @event.NewTrackTime ?? @event.TrackTime,
|
||||
TrackTimeZone = @event.TrackTimeZone,
|
||||
Extra = @event.Extra
|
||||
}
|
||||
},
|
||||
ForcedPush = @event.ForcedPush
|
||||
};
|
||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
||||
|
||||
|
||||
@ -473,7 +473,8 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
TrackPlacePostcode = input.TrackPlacePostcode,
|
||||
EstimatedDeliveryDate = input.EstimatedDeliveryDate,
|
||||
DestinationTimeZone = input.DestinationTimeZone,
|
||||
Extra = input.Extra
|
||||
Extra = input.Extra,
|
||||
ForcedPush = input.ForcedPush
|
||||
};
|
||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Expand.AliyunOSS;
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
@ -32,6 +33,7 @@ public class TrackContentService : ApplicationService
|
||||
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
|
||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||
|
||||
public TrackContentService(
|
||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||
@ -40,7 +42,7 @@ public class TrackContentService : ApplicationService
|
||||
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery,
|
||||
IOrderRepository orderRepository,
|
||||
ITrackDetailsEsRepository trackDetailsEsRepository,
|
||||
ITrackTemplateRepository trackTemplateRepository)
|
||||
ITrackTemplateRepository trackTemplateRepository, ITrackPushCacheService trackPushCacheService)
|
||||
{
|
||||
_stringLocalizer = stringLocalizer;
|
||||
_trackContentRepository = trackContentRepository;
|
||||
@ -49,6 +51,7 @@ public class TrackContentService : ApplicationService
|
||||
_orderRepository = orderRepository;
|
||||
_trackDetailsEsRepository = trackDetailsEsRepository;
|
||||
_trackTemplateRepository = trackTemplateRepository;
|
||||
_trackPushCacheService = trackPushCacheService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -305,7 +308,16 @@ public class TrackContentService : ApplicationService
|
||||
//进行推送时,匹配订单类型一致的轨迹
|
||||
if (input.TrackOptionType == TrackOptionType.推送)
|
||||
{
|
||||
trackDetails = trackDetails.Where(t => t.OrderType == order.OrderType).ToList();
|
||||
var pushConfigs = await _trackPushCacheService.GetPushContentConfigsAsync(order.SubSystemId, order.CustomId);
|
||||
//没有推送配置也不会展示任何下拉
|
||||
if (pushConfigs == null || pushConfigs.Count == 0) return res;
|
||||
//选订单类型和配置订单类型一致的配置的轨迹代码
|
||||
var trackCodes = pushConfigs.Where(m => m.OrderType == order.OrderType)
|
||||
.Select(x=>x.TrackCode)
|
||||
.Distinct()
|
||||
.ToHashSet();
|
||||
//根据配置过滤轨迹
|
||||
trackDetails = trackDetails.Where(m => trackCodes.Contains(m.TrackCode)).ToList();
|
||||
}
|
||||
|
||||
//进行删除和推送行为无任何轨迹内容,直接返回为空即可
|
||||
|
||||
Loading…
Reference in New Issue
Block a user