fix:轨迹推送事件处理:修复轨迹全量推送(最新轨迹)字段比较问题
This commit is contained in:
parent
8ca0adfbd3
commit
a517eae81f
@ -356,14 +356,22 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
body = DeserializeForTextJson<TrackPushInput>(history.PushContent);
|
body = DeserializeForTextJson<TrackPushInput>(history.PushContent);
|
||||||
if (config.IsAllPushWithLatest)
|
if (config.IsAllPushWithLatest)
|
||||||
{
|
{
|
||||||
|
//同code同比较字段保证唯一
|
||||||
var old = body!.Data
|
var old = body!.Data
|
||||||
.Where(x => x["code"] == cur["code"])
|
.Where(x =>
|
||||||
.WhereIf(!compareFields.IsNullOrWhiteSpace(), x =>
|
{
|
||||||
|
//反序列化出的JsonElement和字典字符串类型做比较
|
||||||
|
var a = ((JsonElement) x["code"]!).GetString();
|
||||||
|
var b = cur["code"]!.ToString(); //tips: 需要要将object类型的字符串转为string类型,否则使用的是引用比较,反序列化出的string一定和本地string引用不同
|
||||||
|
return a == b;
|
||||||
|
}).WhereIf(!compareFields.IsNullOrWhiteSpace(), x =>
|
||||||
{
|
{
|
||||||
if (x["extra"] == null || log.Extra == null) return false;
|
if (x["extra"] == null || log.Extra == null) return false;
|
||||||
return EqExtraByFieldForTextJson(x["extra"]!, DeserializeForTextJson<JsonElement>(log.Extra)!, compareFields!);
|
return EqExtraByFieldForTextJson(x["extra"]!, DeserializeForTextJson<JsonElement>(log.Extra), compareFields!);
|
||||||
})
|
})
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
if (old != null)
|
if (old != null)
|
||||||
{
|
{
|
||||||
body.Data.Remove(old);
|
body.Data.Remove(old);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user