This commit is contained in:
李鹏军 2024-04-24 21:44:08 +08:00
parent 9d5cad393e
commit 09881a3932
3 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,7 @@
using Newtonsoft.Json;
using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Helpers;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Consts;
@ -26,11 +27,12 @@ public class TrackPushCompletedEventHandler : ITransientDependency, ICapSubscrib
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
{
string logStr = null;
if (@event.Attach == OptionType.新增.ToString())
var optionType = Base64Helper.DeSerialize<string>(@event.Attach);
if (optionType == OptionType.新增.ToString())
{
logStr = JsonConvert.DeserializeObject<TrackPushInput>(@event.RequestParams)!.Log;
}
else if (@event.Attach == OptionType.修改.ToString())
else if (optionType == OptionType.修改.ToString())
{
logStr = JsonConvert.DeserializeObject<TrackUpdateInput>(@event.RequestParams)!.Log;
}

View File

@ -1,11 +1,11 @@
using System.Text;
using DotNetCore.CAP;
using DotNetCore.CAP;
using Newtonsoft.Json;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Events;
using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Application.Helpers;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
@ -144,9 +144,9 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
}
}
byte[] asciiBytes = Encoding.ASCII.GetBytes(OptionType.新增.ToString());
string asciiString = Encoding.ASCII.GetString(asciiBytes);
string asciiString = Base64Helper.SerializeObject(OptionType.新增.ToString());
if (items.Count == 0) return;
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.PushTrackInterfaceCode,
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
attach: asciiString);
@ -178,6 +178,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
items.Add(item);
}
if (items.Count == 0) return;
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.TrackUpdateInterfaceCode,
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
attach: OptionType.修改.ToString());

View File

@ -16,7 +16,7 @@ public class TrackPushRecordsRepository : ElasticSearchContextAbstract<TrackDeta
public async Task AddAsync(TrackPushRecordIndex index)
{
index.IndexName = $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}";
index.IndexName = $"{GlobalConst.TrackPushRecordsIndex}-{DateTime.Now:yyyy.MM.dd}";
index.CreateTime = DateTime.Now;
// 按天写入es
var r = await Context.IndexAsync(index, request => request