Merge remote-tracking branch 'origin/S03-轨迹中台' into test
This commit is contained in:
commit
2d948c1b27
@ -0,0 +1,20 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
|
public class TrackPushInput
|
||||||
|
{
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
public List<TrackItem> Data { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrackItem
|
||||||
|
{
|
||||||
|
public string Location { get; set; } = null!;
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public double TimeZone { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public string? DescriptionCn { get; set; }
|
||||||
|
public string? Code { get; set; }
|
||||||
|
public string? Status { get; set; }
|
||||||
|
public string? Extra { get; set; }
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
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;
|
||||||
@ -152,33 +152,33 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
private async Task DoAddAsync(TrackPushEvent @event,
|
private async Task DoAddAsync(TrackPushEvent @event,
|
||||||
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
||||||
{
|
{
|
||||||
var track = new
|
var track = new TrackItem
|
||||||
{
|
{
|
||||||
// 推真实的发生地和发生时间(时间是计算后的)
|
// 推真实的发生地和发生时间(时间是计算后的)
|
||||||
location = @event.TrackPlace,
|
Location = @event.TrackPlace,
|
||||||
date = @event.TrackTime.AddHours(
|
Date = @event.TrackTime.AddHours(
|
||||||
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
||||||
timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
TimeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
||||||
description = config.TrackEnContentValue,
|
Description = config.TrackEnContentValue,
|
||||||
description_cn = config.TrackContentValue,
|
DescriptionCn = config.TrackContentValue,
|
||||||
code = config.TrackContentCodeValue,
|
Code = config.TrackContentCodeValue,
|
||||||
status = config.TrackStatusValue,
|
Status = config.TrackStatusValue,
|
||||||
extra = config.ExpandFieldsValue
|
Extra = config.ExpandFieldsValue
|
||||||
};
|
};
|
||||||
|
|
||||||
JObject body = JObject.FromObject(new
|
var body = new TrackPushInput()
|
||||||
{
|
{
|
||||||
orderNo = @event.OrderNo,
|
OrderNo = @event.OrderNo,
|
||||||
data = new[] { track }
|
};
|
||||||
});
|
body.Data.Add(track);
|
||||||
|
|
||||||
if (config.IsAllPush)
|
if (config.IsAllPush)
|
||||||
{
|
{
|
||||||
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
||||||
if (history != default)
|
if (history != default)
|
||||||
{
|
{
|
||||||
body = JObject.Parse(history.PushContent);
|
body = JsonConvert.DeserializeObject<TrackPushInput>(history.PushContent);
|
||||||
((JArray)body["data"]!).Add(JObject.FromObject(track));
|
body!.Data.Add(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,6 +186,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
config.ServiceProviderCode, body);
|
config.ServiceProviderCode, body);
|
||||||
|
|
||||||
log.PushContent = body.ToJson();
|
log.PushContent = body.ToJson();
|
||||||
|
|
||||||
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
||||||
log.RequestId = res.RequestId;
|
log.RequestId = res.RequestId;
|
||||||
log.Message = res.Msg;
|
log.Message = res.Msg;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user