Merge branch 'S02-轨迹中台第二部分' into dev
This commit is contained in:
commit
2fbbb251ab
@ -19,7 +19,7 @@ public interface ITrackPushCacheService
|
||||
/// <param name="customId">服务商id</param>
|
||||
/// <param name="trackContentId"></param>
|
||||
/// <returns></returns>
|
||||
Task<TrackPushContentConfigDto> GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
|
||||
Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
|
||||
|
||||
/// <summary>
|
||||
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null
|
||||
|
||||
@ -61,7 +61,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode);
|
||||
|
||||
// step1、upsert es轨迹
|
||||
await UpsertTrackAsync(track, @event);
|
||||
track = await UpsertTrackAsync(track, @event);
|
||||
Debug.Assert(track != null, nameof(track) + " != null");
|
||||
|
||||
// step2、触发轨迹推送事件(异步)
|
||||
@ -103,7 +103,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
/// </summary>
|
||||
/// <param name="track"></param>
|
||||
/// <param name="event"></param>
|
||||
private async Task UpsertTrackAsync(TrackDetailsIndex? track, TrackUpsertEvent @event)
|
||||
private async Task<TrackDetailsIndex?> UpsertTrackAsync(TrackDetailsIndex? track, TrackUpsertEvent @event)
|
||||
{
|
||||
if (track == default)
|
||||
{
|
||||
@ -113,7 +113,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (trackContent == default)
|
||||
{
|
||||
// 订单所绑定的模板,没有一条内容可以匹配发生的轨迹
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
track = new TrackDetailsIndex
|
||||
@ -146,6 +146,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
}
|
||||
|
||||
await _trackDetailsRepository.UpsertAsync(track);
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -162,7 +164,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
{
|
||||
config = await _trackPushCacheService.GetPushContentConfigAsync(
|
||||
@event.SubSystemId, @event.CustomId, track.TrackContentId);
|
||||
if (!config.IsCanUpdate) return;
|
||||
if (config == null || !config.IsCanUpdate) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -28,12 +28,12 @@ public class TrackPushCacheService : ApplicationService, ITrackPushCacheService
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public async Task<TrackPushContentConfigDto> GetPushContentConfigAsync(int subSystemId, int customId,
|
||||
public async Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId,
|
||||
int trackContentId)
|
||||
{
|
||||
var data = await GetPushContentConfigsAsync(subSystemId, customId);
|
||||
|
||||
return data.Single(x => x.TrackContentId == trackContentId);
|
||||
return data?.FirstOrDefault(x => x.TrackContentId == trackContentId);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user