转鹏军
This commit is contained in:
parent
cb147ccbe1
commit
4fb127ed47
@ -123,7 +123,7 @@ public class BatchUpsertTrackInput : OrderNosInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否强制推送
|
/// 是否强制推送
|
||||||
|
|||||||
@ -105,5 +105,5 @@ public class TrackDetail
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,7 +132,7 @@ public class UpsertTrackInput : OrderNoInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否强制推送
|
/// 是否强制推送
|
||||||
|
|||||||
@ -85,5 +85,5 @@ public class TrackPushRecordDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹的额外新
|
/// 轨迹的额外新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,5 +132,5 @@ public class TrackChangeEto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,5 +83,5 @@ public class TrackPushCompletedEvent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹的额外新
|
/// 轨迹的额外新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,5 +88,5 @@ public struct SystemPushStruct
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,7 +154,7 @@ public class TrackUpsertEvent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否强制推送
|
/// 是否强制推送
|
||||||
|
|||||||
@ -265,7 +265,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", log.Extra }
|
{ "extra", DeserializeForTextJson<object>(log.Extra) }
|
||||||
};
|
};
|
||||||
body.Data.Add(dict);
|
body.Data.Add(dict);
|
||||||
log.PushContent = body.ToJson();
|
log.PushContent = body.ToJson();
|
||||||
@ -293,7 +293,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", log.Extra }
|
{ "extra", DeserializeForTextJson<object>(log.Extra) }
|
||||||
};
|
};
|
||||||
body.Data.Add(cur);
|
body.Data.Add(cur);
|
||||||
|
|
||||||
@ -380,4 +380,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
return string.IsNullOrWhiteSpace(json) ? default : System.Text.Json.JsonSerializer.Deserialize<T>(json);
|
return string.IsNullOrWhiteSpace(json) ? default : System.Text.Json.JsonSerializer.Deserialize<T>(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, object>? GetExtraDictForTextJson(string? extraStr)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(extraStr)
|
||||||
|
? null
|
||||||
|
: System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(extraStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
|
using NetTaste;
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
@ -234,7 +235,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
// todo:条件命名写反了
|
// todo:条件命名写反了
|
||||||
// important:轨迹code相同,时间、发生地不同的,可能存在多条!!
|
// important:轨迹code相同,时间、发生地不同的,可能存在多条!!
|
||||||
var tracks = await _trackDetailsEsRepository.GetListAsync(orderIds, @event.TrackCode, false);
|
var tracks = await _trackDetailsEsRepository.GetListAsync(orderIds, @event.TrackCode, true);
|
||||||
|
|
||||||
var insertTracks = new List<TrackDetailsIndex>();
|
var insertTracks = new List<TrackDetailsIndex>();
|
||||||
var updateTracks = new List<TrackDetailsIndex>();
|
var updateTracks = new List<TrackDetailsIndex>();
|
||||||
@ -249,6 +250,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
updateTracks.Add(BuiltUpdateTrack(@event, trackById, order, trackContent));
|
updateTracks.Add(BuiltUpdateTrack(@event, trackById, order, trackContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,8 +262,10 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var extraDict = GetExtraDictForTextJson(@event.Extra);
|
||||||
if (@event.Extra == null ||
|
if (@event.Extra == null ||
|
||||||
@event.Extra.TryGetValue(@event.CompareFields, out var compareValue) == false)
|
extraDict == null
|
||||||
|
|| extraDict.TryGetValue(@event.CompareFields, out var compareValue) == false)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "轨迹比较字段不存在,请检查拓展字段");
|
throw new BusinessException(message: "轨迹比较字段不存在,请检查拓展字段");
|
||||||
}
|
}
|
||||||
@ -269,7 +273,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
existTracks = existTracks.Where(x =>
|
existTracks = existTracks.Where(x =>
|
||||||
{
|
{
|
||||||
// tips:注意兼容性,历史轨迹的字段可能为空
|
// tips:注意兼容性,历史轨迹的字段可能为空
|
||||||
if (x.Extra == null || !x.Extra.TryGetValue(@event.CompareFields, out var oldValue))
|
if (x.Extra == null || !extraDict.TryGetValue(@event.CompareFields, out var oldValue))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -441,4 +445,11 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, object>? GetExtraDictForTextJson(string? extraStr)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(extraStr)
|
||||||
|
? null
|
||||||
|
: System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(extraStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using BSI.Stack.Rabbit.Handler;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
|||||||
@ -190,5 +190,5 @@ public class TrackDetailsIndex : IdBaseIndex
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展信息字段,用与轨迹推送的附加字段
|
/// 扩展信息字段,用与轨迹推送的附加字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,5 +96,5 @@ public class TrackPushRecordIndex : IdBaseIndex
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹额外信息
|
/// 轨迹额外信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object>? Extra { get; set; }
|
public string? Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
public async Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, string trackCode,
|
public async Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, string trackCode,
|
||||||
bool forUpsert = false)
|
bool forUpsert = false)
|
||||||
{
|
{
|
||||||
var r = !forUpsert
|
var r = forUpsert
|
||||||
? await Context.SearchAsync<TrackDetailsIndex>(s => s
|
? await Context.SearchAsync<TrackDetailsIndex>(s => s
|
||||||
.Index(GlobalConst.TrackDetailsIndex)
|
.Index(GlobalConst.TrackDetailsIndex)
|
||||||
.Source()
|
.Source()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user