Merge branch 'S07' into test
This commit is contained in:
commit
79561f0685
@ -58,17 +58,24 @@ public class TrackChangeAfterUpdateOrderEventHandler : ITransientDependency, ICa
|
||||
warningCalcOrders.Add(order);
|
||||
}
|
||||
|
||||
order.LatestTrackStatus = @event.TrackStatus;
|
||||
order.LatestTrackContent = @event.TrackContent;
|
||||
order.LatestTrackEnContent = @event.TrackEnContent;
|
||||
order.LatestTrackPlace = @event.TrackPlace;
|
||||
order.LatestTrackTime = @event.TrackTime;
|
||||
order.LatestTrackTimeZone = @event.TrackTimeZone;
|
||||
//当【预计签收时间】【签收地时区】同时存在时则更新主表
|
||||
if (@event.EstimatedDeliveryDate.HasValue && @event.DestinationTimeZone.HasValue)
|
||||
// 当轨迹发生时间大于订单上的最新的轨迹发生时间时,才更新订单冗余的轨迹信息
|
||||
if (order.LatestTrackTime == null ||
|
||||
(@event.TrackTime.Subtract(TimeSpan.FromHours(@event.TrackTimeZone)) >
|
||||
order.LatestTrackTime.Value.Subtract(TimeSpan.FromHours(order.LatestTrackTimeZone ?? 0)))
|
||||
)
|
||||
{
|
||||
order.EstimatedDeliveryDate = @event.EstimatedDeliveryDate.Value;
|
||||
order.DestinationTimeZone = @event.DestinationTimeZone.Value;
|
||||
order.LatestTrackStatus = @event.TrackStatus;
|
||||
order.LatestTrackContent = @event.TrackContent;
|
||||
order.LatestTrackEnContent = @event.TrackEnContent;
|
||||
order.LatestTrackPlace = @event.TrackPlace;
|
||||
order.LatestTrackTime = @event.TrackTime;
|
||||
order.LatestTrackTimeZone = @event.TrackTimeZone;
|
||||
//当【预计签收时间】【签收地时区】同时存在时则更新主表
|
||||
if (@event.EstimatedDeliveryDate.HasValue && @event.DestinationTimeZone.HasValue)
|
||||
{
|
||||
order.EstimatedDeliveryDate = @event.EstimatedDeliveryDate.Value;
|
||||
order.DestinationTimeZone = @event.DestinationTimeZone.Value;
|
||||
}
|
||||
}
|
||||
|
||||
updateOrders.Add(order);
|
||||
|
||||
@ -49,14 +49,13 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
||||
var trackList = await DeleteTrackAsync(@event);
|
||||
|
||||
//当轨迹删除,根据轨迹标记/状态上IsToMq选择进行广播
|
||||
if (trackList.Count != 0)
|
||||
if (trackList.Count > 0)
|
||||
{
|
||||
_ = PublicTrackTopicAsync(@event, trackList);
|
||||
//引发预警计算
|
||||
WarningCalc_DeletedTrack(trackList);
|
||||
}
|
||||
|
||||
|
||||
// 根据订单关联关系异步向下刷(异步)
|
||||
await DownByOrderLink(@event);
|
||||
}
|
||||
@ -233,7 +232,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
||||
foreach (var order in orders)
|
||||
{
|
||||
//找到最新的轨迹数据
|
||||
var track = tracks?.OrderByDescending(x => x.TrackTime)
|
||||
var track = tracks?.OrderByDescending(x => x.ZeroTrackTime)
|
||||
.FirstOrDefault(x => x.OrderId == order.Id);
|
||||
|
||||
// 删除全部轨迹导致的重置行为
|
||||
@ -314,18 +313,6 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
||||
var item = dataItem.First();
|
||||
var content = contentList.First(m => m.TrackContentCode == item.TrackCode);
|
||||
|
||||
// _broadcastingService.TrackChangePublicTopic(track,
|
||||
// dataItem.Select(m => new OrderIdentifier
|
||||
// {
|
||||
// OrderId = m.OrderId,
|
||||
// OrderNo = m.OrderNo,
|
||||
// OrderType = m.OrderType
|
||||
// }).ToArray(),
|
||||
// item.TrackCode,
|
||||
// item.TrackStatusCode,
|
||||
// content.SubSystemCode
|
||||
// );
|
||||
|
||||
//将每个订单的每个轨迹的删除变更发布
|
||||
foreach (var track in dataItem)
|
||||
{
|
||||
@ -374,11 +361,10 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
||||
}
|
||||
|
||||
|
||||
public void WarningCalc_DeletedTrack(List<TrackDetailsIndex> delTracks)
|
||||
private void WarningCalc_DeletedTrack(List<TrackDetailsIndex> delTracks)
|
||||
{
|
||||
var signals = delTracks.Select(x => new TrackDeletedSignal
|
||||
{
|
||||
//EsId = x.Id,
|
||||
OrderId = x.OrderId,
|
||||
DeletedTrack = x
|
||||
}).ToList();
|
||||
|
||||
@ -236,7 +236,6 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
SubSystemId = @event.SubSystemId,
|
||||
SubSystemCode = trackContent.SubSystemCode,
|
||||
CustomId = @event.CustomId,
|
||||
//OrderIds = canNextOrderIds.ToArray(),
|
||||
OrderIdEsIdVersionDict = orderIdEsIdVersionDict,
|
||||
TrackCode = @event.TrackCode,
|
||||
SystemPushInfo = new SystemPushStruct
|
||||
|
||||
@ -263,6 +263,7 @@ public sealed class WarningNotifyAggregator : ITransientDependency
|
||||
|
||||
private List<NotifyConfig> BuildNotifyConfigs(List<WarningNotifyTaskEntity> needNotifyTasks)
|
||||
{
|
||||
var systemId = _optionsMonitor.CurrentValue.MiddleSystemId;
|
||||
var result = new List<NotifyConfig>();
|
||||
if (needNotifyTasks.Count == 0) return result;
|
||||
|
||||
@ -302,11 +303,13 @@ public sealed class WarningNotifyAggregator : ITransientDependency
|
||||
//接收完整预警,命中规则1,通知方式(飞书) ,命中规则2,通知方式(飞书,站内信)
|
||||
//此时聚合后,消息为:总共6条预警消息,其中回传xx条,运输xx条,完整xx条
|
||||
//同时使用飞书和站内信两种方式通知
|
||||
result.Add(NotifyConfig.CreateConfig(userId, notifyMessage, new List<int>
|
||||
var config = NotifyConfig.CreateConfig(userId, notifyMessage, new List<int>
|
||||
{
|
||||
1,
|
||||
2
|
||||
}));
|
||||
});
|
||||
config.SystemId = systemId;
|
||||
result.Add(config);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@ -2,6 +2,11 @@ namespace SJZY.Track.Application.Options;
|
||||
|
||||
public sealed class TrackWarningTaskOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属子系统id(业务中台id)
|
||||
/// </summary>
|
||||
public int MiddleSystemId { get; set; }
|
||||
|
||||
/// <summary> 通知任务扫描优先级 </summary>
|
||||
public int ScanWarningNotifyTaskLevel { get; set; }
|
||||
|
||||
|
||||
@ -5,3 +5,9 @@ public static class Empty<T>
|
||||
public static readonly List<T> List = new(0);
|
||||
public static readonly HashSet<T> Set = new(0);
|
||||
}
|
||||
|
||||
public static class Empty<TKey, TValue>
|
||||
where TKey : notnull
|
||||
{
|
||||
public static readonly Dictionary<TKey, TValue> Dict = new(0);
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
||||
.TopHits("latest_track", th => th
|
||||
.Size(1)
|
||||
.Sort(srt => srt
|
||||
.Field(f => f.CreateTime, SortOrder.Descending)
|
||||
.Field(f => f.ZeroTrackTime, SortOrder.Descending)
|
||||
)
|
||||
.Source()
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user