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