对接接口通7.1.6
This commit is contained in:
parent
8d186fa985
commit
51b529ae90
@ -1,32 +0,0 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||
|
||||
public class TrackRefreshAttach
|
||||
{
|
||||
public TrackRefreshAttach(int serviceProviderId, string serviceProviderCode, int subSystemId, int orderType)
|
||||
{
|
||||
ServiceProviderId = serviceProviderId;
|
||||
ServiceProviderCode = serviceProviderCode;
|
||||
SubSystemId = subSystemId;
|
||||
OrderType = orderType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 服务商id
|
||||
/// </summary>
|
||||
public int ServiceProviderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商code
|
||||
/// </summary>
|
||||
public string ServiceProviderCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型(主数据枚举TrackOrderType)
|
||||
/// </summary>
|
||||
public int OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubSystemId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||
|
||||
public class TrackRefreshDto : OrderNoInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务商id
|
||||
/// </summary>
|
||||
public int ServiceProviderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubSystemId { get; set; }
|
||||
}
|
||||
@ -32,7 +32,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
||||
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
|
||||
{
|
||||
// tips:attach返回的是服务商id,必有
|
||||
var attach = JsonConvert.DeserializeObject<TrackRefreshAttach>(@event.Attach);
|
||||
var attach = JsonConvert.DeserializeObject<TrackRefreshDto>(@event.Attach);
|
||||
if (attach is null) return;
|
||||
var config =
|
||||
await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.5-beta3"/>
|
||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.6"/>
|
||||
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Newtonsoft.Json;
|
||||
using SJZY.Expand.ABP.Core;
|
||||
using SJZY.InterfaceRelay.Application.Contracts;
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
@ -41,7 +40,6 @@ public class TrackPullService : ApplicationService
|
||||
// todo:罚时?
|
||||
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
||||
|
||||
|
||||
// 这里没有区分订单类型,就算的不同类型的单一起刷新了也无所谓
|
||||
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(input.OrderNos);
|
||||
|
||||
@ -50,18 +48,19 @@ public class TrackPullService : ApplicationService
|
||||
throw new BusinessException(message: "一个拉取配置都不存在");
|
||||
}
|
||||
|
||||
foreach (var group in orders.GroupBy(x =>
|
||||
new TrackRefreshAttach(x.ServiceProviderId, x.ServiceProviderCode, x.SubSystemId, x.OrderType)))
|
||||
foreach (var group in orders.GroupBy(x => x.ServiceProviderCode))
|
||||
{
|
||||
var data = group.Select(x => new
|
||||
var data = group.Select(x => new TrackRefreshDto
|
||||
{
|
||||
x.OrderNo
|
||||
OrderType = x.OrderType,
|
||||
OrderNo = x.OrderNo,
|
||||
ServiceProviderId = x.ServiceProviderId,
|
||||
SubSystemId = x.SubSystemId
|
||||
}).ToList();
|
||||
|
||||
// 批量获取轨迹
|
||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||
"A012", group.Key.ServiceProviderCode, data,
|
||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
||||
"A012", group.Key, data, GlobalConst.TrackRefreshSubscribe);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -86,19 +85,19 @@ public class TrackPullService : ApplicationService
|
||||
|
||||
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
|
||||
|
||||
foreach (var group in orders.GroupBy(x =>
|
||||
new TrackRefreshAttach(x.ServiceProviderId, x.ServiceProviderCode, x.SubSystemId,
|
||||
x.OrderType)))
|
||||
foreach (var group in orders.GroupBy(x => x.ServiceProviderCode))
|
||||
{
|
||||
var data = group.Select(x => new
|
||||
var data = group.Select(x => new TrackRefreshDto
|
||||
{
|
||||
x.OrderNo
|
||||
OrderType = x.OrderType,
|
||||
OrderNo = x.OrderNo,
|
||||
ServiceProviderId = x.ServiceProviderId,
|
||||
SubSystemId = x.SubSystemId
|
||||
}).ToList();
|
||||
|
||||
// 批量获取轨迹
|
||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||
"A012", group.Key.ServiceProviderCode, data,
|
||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
||||
"A012", group.Key, data, GlobalConst.TrackRefreshSubscribe);
|
||||
}
|
||||
|
||||
await RedisHelper.Client.SetExAsync(redisKey, config.PullInterval * 60, 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user