Merge branch 'S06' into test
This commit is contained in:
commit
1abe484a14
@ -124,4 +124,9 @@ public class BatchUpsertTrackInput : OrderNosInfo
|
|||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否强制推送
|
||||||
|
/// </summary>
|
||||||
|
public bool ForcedPush { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,4 +128,9 @@ public class UpsertTrackInput : OrderNoInfo
|
|||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否强制推送
|
||||||
|
/// </summary>
|
||||||
|
public bool ForcedPush { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,11 @@ public class TrackPushEvent
|
|||||||
/// 系统推送信息
|
/// 系统推送信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SystemPushStruct SystemPushInfo { get; set; }
|
public SystemPushStruct SystemPushInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否强制推送
|
||||||
|
/// </summary>
|
||||||
|
public bool ForcedPush { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct SystemPushStruct
|
public struct SystemPushStruct
|
||||||
|
|||||||
@ -146,6 +146,12 @@ public class TrackUpsertEvent
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否强制推送
|
||||||
|
/// </summary>
|
||||||
|
public bool ForcedPush { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|||||||
@ -69,6 +69,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
if (orders.Count == 0) return;
|
if (orders.Count == 0) return;
|
||||||
_orders = orders;
|
_orders = orders;
|
||||||
|
|
||||||
|
if (@event.ForcedPush)
|
||||||
|
{
|
||||||
|
await DoPushAsync(@event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (@event.OptionType)
|
switch (@event.OptionType)
|
||||||
{
|
{
|
||||||
case OptionType.无:
|
case OptionType.无:
|
||||||
@ -97,12 +103,16 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
foreach (var order in _orders)
|
foreach (var order in _orders)
|
||||||
{
|
{
|
||||||
if (order.QuestionType == (int) TrackProblemType.Error) continue; // 系统不推异常单,只能人工操作
|
if (order.QuestionType == (int) TrackProblemType.Error) continue; // 系统不推异常单,只能人工操作
|
||||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
// 强制推送只需直接查出配置
|
||||||
|
if (@event.ForcedPush)
|
||||||
|
config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||||
|
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行,为了约束顺序
|
||||||
|
else
|
||||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||||
if (config == null) continue;
|
if (config == null) continue;
|
||||||
// 是否自动推送
|
// 是否自动推送
|
||||||
if (!config.IsAutoPush) continue;
|
if (!config.IsAutoPush) continue;
|
||||||
//配置的类型如何和订单类型不一致则不允许推送
|
// 配置的类型如何和订单类型不一致则不允许推送
|
||||||
if (config.OrderType != order.OrderType) continue;
|
if (config.OrderType != order.OrderType) continue;
|
||||||
|
|
||||||
var log = new TrackPushRecordIndex
|
var log = new TrackPushRecordIndex
|
||||||
@ -138,7 +148,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
var order = _orders.First(x => x.Id == track.OrderId);
|
var order = _orders.First(x => x.Id == track.OrderId);
|
||||||
if (config is { IsAllPush: true })
|
if (config is { IsAllPush: true })
|
||||||
{
|
{
|
||||||
|
// 强制推送只需直接查出配置
|
||||||
|
if (@event.ForcedPush)
|
||||||
|
config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||||
// 推断 本次推送 是否可行
|
// 推断 本次推送 是否可行
|
||||||
|
else
|
||||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -264,7 +264,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTime = @event.NewTrackTime ?? @event.TrackTime,
|
TrackTime = @event.NewTrackTime ?? @event.TrackTime,
|
||||||
TrackTimeZone = @event.TrackTimeZone,
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
Extra = @event.Extra
|
Extra = @event.Extra
|
||||||
}
|
},
|
||||||
|
ForcedPush = @event.ForcedPush
|
||||||
};
|
};
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
||||||
|
|
||||||
|
|||||||
@ -473,7 +473,8 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
TrackPlacePostcode = input.TrackPlacePostcode,
|
TrackPlacePostcode = input.TrackPlacePostcode,
|
||||||
EstimatedDeliveryDate = input.EstimatedDeliveryDate,
|
EstimatedDeliveryDate = input.EstimatedDeliveryDate,
|
||||||
DestinationTimeZone = input.DestinationTimeZone,
|
DestinationTimeZone = input.DestinationTimeZone,
|
||||||
Extra = input.Extra
|
Extra = input.Extra,
|
||||||
|
ForcedPush = input.ForcedPush
|
||||||
};
|
};
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
|||||||
using SJZY.Expand.AliyunOSS;
|
using SJZY.Expand.AliyunOSS;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
|
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.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
@ -32,6 +33,7 @@ public class TrackContentService : ApplicationService
|
|||||||
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery;
|
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
|
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
|
||||||
|
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||||
|
|
||||||
public TrackContentService(
|
public TrackContentService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
@ -40,7 +42,7 @@ public class TrackContentService : ApplicationService
|
|||||||
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery,
|
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery,
|
||||||
IOrderRepository orderRepository,
|
IOrderRepository orderRepository,
|
||||||
ITrackDetailsEsRepository trackDetailsEsRepository,
|
ITrackDetailsEsRepository trackDetailsEsRepository,
|
||||||
ITrackTemplateRepository trackTemplateRepository)
|
ITrackTemplateRepository trackTemplateRepository, ITrackPushCacheService trackPushCacheService)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackContentRepository = trackContentRepository;
|
_trackContentRepository = trackContentRepository;
|
||||||
@ -49,6 +51,7 @@ public class TrackContentService : ApplicationService
|
|||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_trackDetailsEsRepository = trackDetailsEsRepository;
|
_trackDetailsEsRepository = trackDetailsEsRepository;
|
||||||
_trackTemplateRepository = trackTemplateRepository;
|
_trackTemplateRepository = trackTemplateRepository;
|
||||||
|
_trackPushCacheService = trackPushCacheService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -305,7 +308,16 @@ public class TrackContentService : ApplicationService
|
|||||||
//进行推送时,匹配订单类型一致的轨迹
|
//进行推送时,匹配订单类型一致的轨迹
|
||||||
if (input.TrackOptionType == TrackOptionType.推送)
|
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