Merge branch 'S06' into test
This commit is contained in:
commit
42ba5c6a75
@ -70,6 +70,7 @@ public class TrackPushContentConfigDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展字段参数值
|
/// 扩展字段参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("废弃属性,调整为从轨迹明细扩展中获取扩展值填入")]
|
||||||
public string? ExpandFieldsValue { get; set; }
|
public string? ExpandFieldsValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -5,7 +5,7 @@ public class TrackPushInput
|
|||||||
public string OrderNo { get; set; } = null!;
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
//原TrackItem,为了扩展字段入参变更为字典
|
//原TrackItem,为了扩展字段入参变更为字典
|
||||||
public List<Dictionary<string,object>> Data { get; set; } = new();
|
public List<Dictionary<string,object?>> Data { get; set; } = new();
|
||||||
|
|
||||||
public string Log { get; set; }
|
public string Log { get; set; }
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ public class TrackUpdateInput
|
|||||||
public string OrderNo { get; set; } = null!;
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
//原TrackItem,为了扩展字段入参变更为字典
|
//原TrackItem,为了扩展字段入参变更为字典
|
||||||
public List<Dictionary<string,object>> Data { get; set; } = new();
|
public List<Dictionary<string,object?>> Data { get; set; } = new();
|
||||||
|
|
||||||
public string Log { get; set; }
|
public string Log { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<Version>7.0.7</Version>
|
<Version>7.0.8</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -97,7 +97,6 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
var items = new List<TrackPushInput>();
|
var items = new List<TrackPushInput>();
|
||||||
TrackPushContentConfigDto? config;
|
TrackPushContentConfigDto? config;
|
||||||
var isSystemPush = @event.OperationMan == null;
|
var isSystemPush = @event.OperationMan == null;
|
||||||
var trackPushInputDict = new Dictionary<TrackPushInput, TrackDetailsIndex>();
|
|
||||||
if (isSystemPush)
|
if (isSystemPush)
|
||||||
{
|
{
|
||||||
foreach (var order in _orders)
|
foreach (var order in _orders)
|
||||||
@ -128,7 +127,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTimeZone = @event.SystemPushInfo.TrackTimeZone,
|
TrackTimeZone = @event.SystemPushInfo.TrackTimeZone,
|
||||||
CreateUser = GlobalConst.SystemUser,
|
CreateUser = GlobalConst.SystemUser,
|
||||||
};
|
};
|
||||||
var item = await BuiltPushItem(config, log);
|
var item = await BuiltPushItem(config, log, @event.SystemPushInfo.Extra);
|
||||||
item.Log = JsonConvert.SerializeObject(log);
|
item.Log = JsonConvert.SerializeObject(log);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
@ -174,9 +173,8 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTimeZone = track.TrackTimeZone,
|
TrackTimeZone = track.TrackTimeZone,
|
||||||
CreateUser = @event.OperationMan,
|
CreateUser = @event.OperationMan,
|
||||||
};
|
};
|
||||||
var item = await BuiltPushItem(config, log);
|
var item = await BuiltPushItem(config, log, track.Extra);
|
||||||
item.Log = JsonConvert.SerializeObject(log);
|
item.Log = JsonConvert.SerializeObject(log);
|
||||||
trackPushInputDict.Add(item, track);
|
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,18 +182,18 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
if (items.Count == 0) return;
|
if (items.Count == 0) return;
|
||||||
|
|
||||||
//获取参数结构名称
|
//获取参数结构名称
|
||||||
var paramNames = await GetExtraParamNamesAsync(@event.SubSystemCode);
|
// var paramNames = await GetExtraParamNamesAsync(@event.SubSystemCode);
|
||||||
|
//
|
||||||
//如果为系统推送,则从事件中取出轨迹扩展内容填充
|
// //如果为系统推送,则从事件中取出轨迹扩展内容填充
|
||||||
foreach (var item in items)
|
// foreach (var item in items)
|
||||||
{
|
// {
|
||||||
//根据事件中轨迹扩展内容填充
|
// //根据事件中轨迹扩展内容填充
|
||||||
if (isSystemPush)
|
// if (isSystemPush)
|
||||||
item.Data.ForEach(dict => FillExtraParam(@event.SystemPushInfo.Extra, dict, paramNames));
|
// item.Data.ForEach(dict => FillExtraParam(@event.SystemPushInfo.Extra, dict, paramNames));
|
||||||
//根据查出的轨迹中扩展内容填充
|
// //根据查出的轨迹中扩展内容填充
|
||||||
else
|
// else
|
||||||
item.Data.ForEach(dict => FillExtraParam(trackPushInputDict[item].Extra, dict, paramNames));
|
// item.Data.ForEach(dict => FillExtraParam(trackPushInputDict[item].Extra, dict, paramNames));
|
||||||
}
|
// }
|
||||||
|
|
||||||
using (Track2InterfaceRelaySubSystemContext.Use(
|
using (Track2InterfaceRelaySubSystemContext.Use(
|
||||||
new Track2InterfaceRelaySubSystemContext(@event.SubSystemCode)))
|
new Track2InterfaceRelaySubSystemContext(@event.SubSystemCode)))
|
||||||
@ -237,19 +235,19 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTimeZone = @event.SystemPushInfo.TrackTimeZone,
|
TrackTimeZone = @event.SystemPushInfo.TrackTimeZone,
|
||||||
CreateUser = GlobalConst.SystemUser,
|
CreateUser = GlobalConst.SystemUser,
|
||||||
};
|
};
|
||||||
var item = BuiltUpdateItem(config, log);
|
var item = BuiltUpdateItem(config, log, @event.SystemPushInfo.Extra);
|
||||||
item.Log = JsonConvert.SerializeObject(log);
|
item.Log = JsonConvert.SerializeObject(log);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items.Count == 0) return;
|
if (items.Count == 0) return;
|
||||||
|
|
||||||
//获取参数结构名称
|
// //获取参数结构名称
|
||||||
var paramNames = await GetExtraParamNamesAsync(@event.SubSystemCode);
|
// var paramNames = await GetExtraParamNamesAsync(@event.SubSystemCode);
|
||||||
|
//
|
||||||
//根据事件中轨迹扩展内容填充请求
|
// //根据事件中轨迹扩展内容填充请求
|
||||||
foreach (var item in items)
|
// foreach (var item in items)
|
||||||
item.Data.ForEach(dict => FillExtraParam(@event.SystemPushInfo.Extra, dict, paramNames));
|
// item.Data.ForEach(dict => FillExtraParam(@event.SystemPushInfo.Extra, dict, paramNames));
|
||||||
|
|
||||||
using (Track2InterfaceRelaySubSystemContext.Use(
|
using (Track2InterfaceRelaySubSystemContext.Use(
|
||||||
new Track2InterfaceRelaySubSystemContext(@event.SubSystemCode)))
|
new Track2InterfaceRelaySubSystemContext(@event.SubSystemCode)))
|
||||||
@ -267,16 +265,16 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrackUpdateInput BuiltUpdateItem(TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
private TrackUpdateInput BuiltUpdateItem(TrackPushContentConfigDto config, TrackPushRecordIndex log, string? extraJson)
|
||||||
{
|
{
|
||||||
var trackDatetime = log.TrackTime.AddHours(config.TrackTimeZone ?? log.TrackTimeZone - log.TrackTimeZone);
|
var trackDatetime = log.TrackTime.AddHours(config.TrackTimeZone ?? log.TrackTimeZone - log.TrackTimeZone);
|
||||||
var trackDateStr = DateTimeFormat(trackDatetime, config.TrackTimeZone ?? log.TrackTimeZone, config);
|
var trackDateStr = DateTimeFormat(trackDatetime, config.TrackTimeZone ?? log.TrackTimeZone, config);
|
||||||
|
|
||||||
var body = new TrackUpdateInput
|
var body = new TrackUpdateInput
|
||||||
{
|
{
|
||||||
OrderNo = log.OrderNo,
|
OrderNo = log.OrderNo
|
||||||
};
|
};
|
||||||
var dict = new Dictionary<string, object>()
|
var dict = new Dictionary<string, object?>()
|
||||||
{
|
{
|
||||||
//推真实的发生地和发生时间(时间是计算后的)
|
//推真实的发生地和发生时间(时间是计算后的)
|
||||||
{ "location", log.TrackPlace },
|
{ "location", log.TrackPlace },
|
||||||
@ -286,7 +284,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{ "descriptionCn", config.TrackContentValue },
|
{ "descriptionCn", config.TrackContentValue },
|
||||||
{ "code", config.TrackContentCodeValue },
|
{ "code", config.TrackContentCodeValue },
|
||||||
{ "status", config.TrackStatusValue },
|
{ "status", config.TrackStatusValue },
|
||||||
{ "extra", config.ExpandFieldsValue }
|
{ "extra", DeserializeForTextJson<object>(extraJson) }
|
||||||
};
|
};
|
||||||
body.Data.Add(dict);
|
body.Data.Add(dict);
|
||||||
log.PushContent = body.ToJson();
|
log.PushContent = body.ToJson();
|
||||||
@ -294,7 +292,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<TrackPushInput> BuiltPushItem(TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
private async Task<TrackPushInput> BuiltPushItem(TrackPushContentConfigDto config, TrackPushRecordIndex log, string? extraJson)
|
||||||
{
|
{
|
||||||
var trackDatetime = log.TrackTime.AddHours(config.TrackTimeZone ?? log.TrackTimeZone - log.TrackTimeZone);
|
var trackDatetime = log.TrackTime.AddHours(config.TrackTimeZone ?? log.TrackTimeZone - log.TrackTimeZone);
|
||||||
var trackDateStr = DateTimeFormat(trackDatetime, config.TrackTimeZone ?? log.TrackTimeZone, config);
|
var trackDateStr = DateTimeFormat(trackDatetime, config.TrackTimeZone ?? log.TrackTimeZone, config);
|
||||||
@ -303,7 +301,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
OrderNo = log.OrderNo,
|
OrderNo = log.OrderNo,
|
||||||
};
|
};
|
||||||
var dict = new Dictionary<string, object>()
|
var dict = new Dictionary<string, object?>()
|
||||||
{
|
{
|
||||||
// 推真实的发生地和发生时间(时间是计算后的)
|
// 推真实的发生地和发生时间(时间是计算后的)
|
||||||
{ "location", log.TrackPlace },
|
{ "location", log.TrackPlace },
|
||||||
@ -313,7 +311,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{ "descriptionCn", config.TrackContentValue },
|
{ "descriptionCn", config.TrackContentValue },
|
||||||
{ "code", config.TrackContentCodeValue },
|
{ "code", config.TrackContentCodeValue },
|
||||||
{ "status", config.TrackStatusValue },
|
{ "status", config.TrackStatusValue },
|
||||||
{ "extra", config.ExpandFieldsValue }
|
{ "extra", DeserializeForTextJson<object>(extraJson) }
|
||||||
};
|
};
|
||||||
body.Data.Add(dict);
|
body.Data.Add(dict);
|
||||||
|
|
||||||
@ -322,12 +320,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
var history = await _trackPushRecordEsRepository.GetLatestTrackPushRecordAsync(log.OrderId);
|
var history = await _trackPushRecordEsRepository.GetLatestTrackPushRecordAsync(log.OrderId);
|
||||||
if (history != default)
|
if (history != default)
|
||||||
{
|
{
|
||||||
body = JsonConvert.DeserializeObject<TrackPushInput>(history.PushContent);
|
body = DeserializeForTextJson<TrackPushInput>(history.PushContent);
|
||||||
body!.Data.Add(dict);
|
body!.Data.Add(dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.PushContent = body.ToJson();
|
log.PushContent = SerializeForTextJson(body);
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
@ -381,6 +379,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
return dateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK");
|
return dateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string SerializeForTextJson(object? obj)
|
||||||
|
{
|
||||||
|
return obj == null ? string.Empty : System.Text.Json.JsonSerializer.Serialize(obj);
|
||||||
|
}
|
||||||
|
private T? DeserializeForTextJson<T>(string? json)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(json) ? default : System.Text.Json.JsonSerializer.Deserialize<T>(json);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取来源系统接口的参数名
|
/// 获取来源系统接口的参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -430,7 +437,6 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Dictionary<string, object> ExtractTrackExtraDict(string trackExtraStr)
|
private Dictionary<string, object> ExtractTrackExtraDict(string trackExtraStr)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<string, object>();
|
var dict = new Dictionary<string, object>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user