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