Merge branch 'S03-轨迹中台' into dev
This commit is contained in:
commit
a2e216f671
@ -80,12 +80,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
// 推断 本次推送 是否可行
|
// 推断 本次推送 是否可行
|
||||||
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
||||||
order.LatestPushTrackCode, @event.TrackCode);
|
order.LatestPushTrackCode, @event.TrackCode);
|
||||||
allPush = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config == null) return;
|
if (config == null) return;
|
||||||
await DoAddAsync(@event, config, log, allPush);
|
await DoAddAsync(@event, config, log);
|
||||||
break;
|
break;
|
||||||
case OptionType.删除:
|
case OptionType.删除:
|
||||||
break;
|
break;
|
||||||
@ -144,7 +143,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoAddAsync(TrackPushEvent @event,
|
private async Task DoAddAsync(TrackPushEvent @event,
|
||||||
TrackPushContentConfigDto config, TrackPushRecordIndex log, bool allPush)
|
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
||||||
{
|
{
|
||||||
var track = new
|
var track = new
|
||||||
{
|
{
|
||||||
@ -166,7 +165,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
data = new[] { track }
|
data = new[] { track }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (allPush)
|
if (config.IsAllPush)
|
||||||
{
|
{
|
||||||
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
||||||
if (history != default)
|
if (history != default)
|
||||||
|
|||||||
@ -44,28 +44,16 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
var cache = await GetPushContentConfigsAsync(subSystemId, customId);
|
var cache = await GetPushContentConfigsAsync(subSystemId, customId);
|
||||||
if (cache == null || cache.Count < 1) return default;
|
if (cache == null || cache.Count < 1) return default;
|
||||||
|
|
||||||
TrackPushContentConfigDto? matched;
|
|
||||||
if (latestPushTrackCode == null)
|
|
||||||
{
|
|
||||||
matched = cache.First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var idx = cache.FindIndex(x => x.TrackCode == latestPushTrackCode);
|
var idx = cache.FindIndex(x => x.TrackCode == latestPushTrackCode);
|
||||||
|
|
||||||
if (idx == -1) return default; // 是否预警?
|
if (idx + 1 >= cache.Count) return default; // 推完了
|
||||||
|
|
||||||
// find next
|
// find next
|
||||||
if (idx + 1 < cache.Count && cache[idx + 1].TrackCode == trackCode)
|
var matched = cache[idx + 1].TrackCode == trackCode
|
||||||
{
|
? cache[idx + 1]
|
||||||
matched = cache[idx + 1];
|
:
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// find swap
|
// find swap
|
||||||
matched = cache.FirstOrDefault(x => x.TrackCode == cache[idx].SwapTrackCode);
|
cache.FirstOrDefault(x => x.TrackCode == cache[idx + 1].SwapTrackCode);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return matched != null && matched.TrackCode == trackCode && matched.IsAutoPush ? matched : default;
|
return matched != null && matched.TrackCode == trackCode && matched.IsAutoPush ? matched : default;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user