S06:feat【6. 增加推送映射配置项【只推送最新修改记录】】
https://www.tapd.cn/60863849/prong/stories/view/1160863849001041817
This commit is contained in:
parent
47ebc8b09b
commit
313751fcb8
@ -44,6 +44,11 @@ public class EditTrackPushConfigInput
|
||||
/// </summary>
|
||||
public bool? IsAllPush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否全量推送
|
||||
/// </summary>
|
||||
public bool? IsAllPushWithLatest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式枚举
|
||||
/// </summary>
|
||||
|
||||
@ -17,6 +17,11 @@ public class TrackPushContentConfigDto
|
||||
/// </summary>
|
||||
public bool IsAllPush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否全量推送(最新轨迹)
|
||||
/// </summary>
|
||||
public bool IsAllPushWithLatest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持删除
|
||||
/// </summary>
|
||||
|
||||
@ -23,7 +23,6 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
||||
private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
|
||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||
private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository;
|
||||
private List<OrderEntity> _orders = null!;
|
||||
@ -31,13 +30,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
|
||||
public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
|
||||
IOrderRepository orderRepository, ITrackPushCacheService trackPushCacheService,
|
||||
ITrackDetailsEsRepository trackDetailsEsRepository, ITrackPushRecordEsRepository trackPushRecordEsRepository,
|
||||
ITrackPushRecordEsRepository trackPushRecordEsRepository,
|
||||
IOptionsMonitor<InterfaceRelayParamsConfigOptions> options)
|
||||
{
|
||||
_httpClientProxy = httpClientProxy;
|
||||
_orderRepository = orderRepository;
|
||||
_trackPushCacheService = trackPushCacheService;
|
||||
_trackDetailsEsRepository = trackDetailsEsRepository;
|
||||
_trackPushRecordEsRepository = trackPushRecordEsRepository;
|
||||
_options = options;
|
||||
}
|
||||
@ -285,7 +283,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
{
|
||||
OrderNo = log.OrderNo,
|
||||
};
|
||||
var dict = new Dictionary<string, object?>()
|
||||
var cur = new Dictionary<string, object?>()
|
||||
{
|
||||
// 推真实的发生地和发生时间(时间是计算后的)
|
||||
{ "location", log.TrackPlace },
|
||||
@ -297,7 +295,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
{ "status", config.TrackStatusValue },
|
||||
{ "extra", DeserializeForTextJson<object>(extraJson) }
|
||||
};
|
||||
body.Data.Add(dict);
|
||||
body.Data.Add(cur);
|
||||
|
||||
if (config.IsAllPush)
|
||||
{
|
||||
@ -305,7 +303,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (history != default)
|
||||
{
|
||||
body = DeserializeForTextJson<TrackPushInput>(history.PushContent);
|
||||
body!.Data.Add(dict);
|
||||
if (config.IsAllPushWithLatest)
|
||||
{
|
||||
var last = body!.Data.Last();
|
||||
if (cur["code"] == last["code"])
|
||||
{
|
||||
body.Data.Remove(last);
|
||||
}
|
||||
}
|
||||
body!.Data.Add(cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
||||
x.Id,
|
||||
x.IsAutoPush,
|
||||
x.IsAllPush,
|
||||
x.IsAllPushWithLatest,
|
||||
x.IsCanDelete,
|
||||
x.IsCanUpdate,
|
||||
x.SubSystemId,
|
||||
@ -76,6 +77,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
||||
IsAutoPush = trackPushConfig.IsAutoPush,
|
||||
IsCanUpdate = trackPushConfig.IsCanUpdate,
|
||||
IsAllPush = trackPushConfig.IsAllPush,
|
||||
IsAllPushWithLatest = trackPushConfig.IsAllPushWithLatest,
|
||||
IsCanDelete = trackPushConfig.IsCanDelete,
|
||||
DateTimeFormatType = (int) trackPushConfig.DateTimeFormatType,
|
||||
DateTimeFormat = trackPushConfig.DateTimeFormat,
|
||||
@ -89,6 +91,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
||||
TrackContentValue = item.TrackContentValue,
|
||||
TrackEnContentValue = item.TrackEnContentValue,
|
||||
TrackTimeZone = item.TrackTimeZone,
|
||||
// todo:废弃字段如果没有外部子系统依赖,可以逐步删除
|
||||
ExpandFieldsValue = item.ExpandFieldsValue,
|
||||
}).ToList();
|
||||
|
||||
|
||||
@ -56,6 +56,12 @@ public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
[SugarColumn(ColumnName = "IsAllPush")]
|
||||
public bool IsAllPush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否全量推送(最新轨迹)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "IsAllPushWithLatest")]
|
||||
public bool IsAllPushWithLatest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日期时间格式类型
|
||||
/// </summary>
|
||||
|
||||
@ -51,6 +51,11 @@ public class GetTrackPushConfigDetailOutputVO
|
||||
/// </summary>
|
||||
public bool IsAllPush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否全量推送(最新轨迹)
|
||||
/// </summary>
|
||||
public bool IsAllPushWithLatest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式枚举
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user