Merge branch 'S06' into test
This commit is contained in:
commit
7cdf91d8e5
@ -123,5 +123,5 @@ public class BatchUpsertTrackInput : OrderNosInfo
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string,object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -104,5 +104,5 @@ public class TrackDetail
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class UpdateOrderInput : OrderNoInfo
|
||||
/// <summary>
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public List<string> TemplateCodes { get; set; }
|
||||
public List<string>? TemplateCodes { get; set; }
|
||||
}
|
||||
|
||||
public class PullConfigInfo
|
||||
|
||||
@ -127,5 +127,5 @@ public class UpsertTrackInput : OrderNoInfo
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -132,5 +132,5 @@ public class TrackChangeEto
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -155,5 +155,5 @@ public class TrackPushEto
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -73,5 +73,5 @@ public struct SystemPushStruct
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class TrackUpsertEvent
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Version>7.0.5</Version>
|
||||
<Version>7.0.7</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System.Text.Json;
|
||||
using DotNetCore.CAP;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
@ -128,7 +129,10 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||
if (config == null) return;
|
||||
|
||||
var tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds, @event.TrackCode);
|
||||
var tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds, new List<string>()
|
||||
{
|
||||
@event.TrackCode
|
||||
});
|
||||
tracks = tracks.DistinctBy(x => x.OrderId).ToList(); // 防止重复推送
|
||||
if (tracks.Count == 0) return; // 一个能推的轨迹都不存在
|
||||
|
||||
@ -254,14 +258,14 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
var dict = new Dictionary<string, object>()
|
||||
{
|
||||
// 推真实的发生地和发生时间(时间是计算后的)
|
||||
{ "Location", log.TrackPlace },
|
||||
{ "Date", trackDateStr },
|
||||
{ "TimeZone", config.TrackTimeZone ?? log.TrackTimeZone },
|
||||
{ "Description", config.TrackEnContentValue },
|
||||
{ "DescriptionCn", config.TrackContentValue },
|
||||
{ "Code", config.TrackContentCodeValue },
|
||||
{ "Status", config.TrackStatusValue },
|
||||
{ "Extra", config.ExpandFieldsValue }
|
||||
// { "location", log.TrackPlace },
|
||||
// { "date", trackDateStr },
|
||||
// { "timeZone", config.TrackTimeZone ?? log.TrackTimeZone },
|
||||
// { "description", config.TrackEnContentValue },
|
||||
// { "descriptionCn", config.TrackContentValue },
|
||||
// { "code", config.TrackContentCodeValue },
|
||||
// { "status", config.TrackStatusValue },
|
||||
// { "extra", config.ExpandFieldsValue }
|
||||
};
|
||||
body.Data.Add(dict);
|
||||
log.PushContent = body.ToJson();
|
||||
@ -293,15 +297,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
};
|
||||
var dict = new Dictionary<string, object>()
|
||||
{
|
||||
// 推真实的发生地和发生时间(时间是计算后的)
|
||||
{ "Location", log.TrackPlace },
|
||||
{ "Date", trackDateStr },
|
||||
{ "TimeZone", config.TrackTimeZone ?? log.TrackTimeZone },
|
||||
{ "Description", config.TrackEnContentValue },
|
||||
{ "DescriptionCn", config.TrackContentValue },
|
||||
{ "Code", config.TrackContentCodeValue },
|
||||
{ "Status", config.TrackStatusValue },
|
||||
{ "Extra", config.ExpandFieldsValue }
|
||||
// // 推真实的发生地和发生时间(时间是计算后的)
|
||||
// { "location", log.TrackPlace },
|
||||
// { "date", trackDateStr },
|
||||
// { "timeZone", config.TrackTimeZone ?? log.TrackTimeZone },
|
||||
// { "description", config.TrackEnContentValue },
|
||||
// { "descriptionCn", config.TrackContentValue },
|
||||
// { "code", config.TrackContentCodeValue },
|
||||
// { "status", config.TrackStatusValue },
|
||||
// { "extra", config.ExpandFieldsValue }
|
||||
};
|
||||
body.Data.Add(dict);
|
||||
|
||||
@ -395,12 +399,16 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
/// <param name="dict">要扩展的参数字典</param>
|
||||
/// <param name="paramNames">来源扩展字段的参数名</param>
|
||||
/// <returns></returns>
|
||||
private void FillExtraParam(Dictionary<string, object>? trackExtra, Dictionary<string, object>? dict, List<string>? paramNames)
|
||||
private void FillExtraParam(string? trackExtraStr, Dictionary<string, object>? dict, List<string>? paramNames)
|
||||
{
|
||||
if (paramNames == null || paramNames.Count == 0) return;
|
||||
if (dict == null) return;
|
||||
|
||||
if (trackExtra == null || trackExtra.Count == 0) return;
|
||||
if (string.IsNullOrWhiteSpace(trackExtraStr)) return;
|
||||
|
||||
var trackExtra = ExtractTrackExtraDict(trackExtraStr);
|
||||
|
||||
if (trackExtra.Count == 0) return;
|
||||
foreach (var item in
|
||||
trackExtra.Where(x => x.Value != null && paramNames.Contains(x.Key)))
|
||||
{
|
||||
@ -408,4 +416,54 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Dictionary<string, object> ExtractTrackExtraDict(string trackExtraStr)
|
||||
{
|
||||
var dict = new Dictionary<string, object>();
|
||||
var trackExtra = JsonConvert.DeserializeObject<Dictionary<string, object>>(trackExtraStr);
|
||||
if (trackExtra == null) return dict;
|
||||
foreach (var pair in trackExtra)
|
||||
{
|
||||
if (pair.Value is JsonElement jEl)
|
||||
{
|
||||
object? objVal = null;
|
||||
switch (jEl.ValueKind)
|
||||
{
|
||||
case JsonValueKind.String:
|
||||
objVal = jEl.GetString();
|
||||
// 处理字符串值
|
||||
break;
|
||||
case JsonValueKind.Number:
|
||||
objVal = jEl.GetDouble();
|
||||
// 处理数值
|
||||
break;
|
||||
case JsonValueKind.True:
|
||||
case JsonValueKind.False:
|
||||
objVal = jEl.GetBoolean();
|
||||
// 处理布尔值
|
||||
break;
|
||||
case JsonValueKind.Object:
|
||||
// 处理对象
|
||||
break;
|
||||
case JsonValueKind.Array:
|
||||
// 处理数组
|
||||
break;
|
||||
case JsonValueKind.Null:
|
||||
// 处理空值
|
||||
break;
|
||||
default:
|
||||
// 处理未知类型
|
||||
break;
|
||||
}
|
||||
|
||||
if (objVal == null) continue;
|
||||
dict.TryAdd(pair.Key, objVal);
|
||||
continue;
|
||||
}
|
||||
|
||||
dict.TryAdd(pair.Key, pair.Value);
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
|
||||
order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos);
|
||||
order.TemplateCodes = string.Join(',', input.TemplateCodes);
|
||||
order.TemplateCodes = input.TemplateCodes == null ? null : string.Join(',', input.TemplateCodes);
|
||||
|
||||
var orderId = await _orderRepository.CreateOrderAsync(order);
|
||||
|
||||
@ -131,7 +131,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
|
||||
order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos);
|
||||
order.TemplateCodes = string.Join(',', input.TemplateCodes);
|
||||
order.TemplateCodes = input.TemplateCodes == null ? null : string.Join(',', input.TemplateCodes);
|
||||
await _orderRepository.UpdateOrderAsync(order);
|
||||
}
|
||||
|
||||
|
||||
@ -190,5 +190,5 @@ public class TrackDetailsIndex : IdBaseIndex
|
||||
/// <summary>
|
||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||
/// </summary>
|
||||
public Dictionary<string, object>? Extra { get; set; }
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Expand.ElasticSearch.Services;
|
||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
|
||||
namespace SJZY.Track.Repository.Repositories;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user