Merge branch 'S02-轨迹中台' into test
This commit is contained in:
commit
4677f69e2a
@ -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)
|
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
|
||||||
{
|
{
|
||||||
// tips:attach返回的是服务商id,必有
|
// tips:attach返回的是服务商id,必有
|
||||||
var attach = JsonConvert.DeserializeObject<TrackRefreshAttach>(@event.Attach);
|
var attach = JsonConvert.DeserializeObject<TrackRefreshDto>(@event.Attach);
|
||||||
if (attach is null) return;
|
if (attach is null) return;
|
||||||
var config =
|
var config =
|
||||||
await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
|
await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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.Http.Client" Version="7.0.2" />
|
||||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SJZY.Expand.ABP.Core;
|
using SJZY.Expand.ABP.Core;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
@ -41,7 +40,6 @@ public class TrackPullService : ApplicationService
|
|||||||
// todo:罚时?
|
// todo:罚时?
|
||||||
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
||||||
|
|
||||||
|
|
||||||
// 这里没有区分订单类型,就算的不同类型的单一起刷新了也无所谓
|
// 这里没有区分订单类型,就算的不同类型的单一起刷新了也无所谓
|
||||||
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(input.OrderNos);
|
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(input.OrderNos);
|
||||||
|
|
||||||
@ -50,18 +48,19 @@ public class TrackPullService : ApplicationService
|
|||||||
throw new BusinessException(message: "一个拉取配置都不存在");
|
throw new BusinessException(message: "一个拉取配置都不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var group in orders.GroupBy(x =>
|
foreach (var group in orders.GroupBy(x => x.ServiceProviderCode))
|
||||||
new TrackRefreshAttach(x.ServiceProviderId, x.ServiceProviderCode, x.SubSystemId, x.OrderType)))
|
|
||||||
{
|
{
|
||||||
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();
|
}).ToList();
|
||||||
|
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
"A012", group.Key.ServiceProviderCode, data,
|
"A012", group.Key, data, GlobalConst.TrackRefreshSubscribe);
|
||||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -86,19 +85,19 @@ public class TrackPullService : ApplicationService
|
|||||||
|
|
||||||
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
|
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
|
||||||
|
|
||||||
foreach (var group in orders.GroupBy(x =>
|
foreach (var group in orders.GroupBy(x => x.ServiceProviderCode))
|
||||||
new TrackRefreshAttach(x.ServiceProviderId, x.ServiceProviderCode, x.SubSystemId,
|
|
||||||
x.OrderType)))
|
|
||||||
{
|
{
|
||||||
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();
|
}).ToList();
|
||||||
|
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
"A012", group.Key.ServiceProviderCode, data,
|
"A012", group.Key, data, GlobalConst.TrackRefreshSubscribe);
|
||||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await RedisHelper.Client.SetExAsync(redisKey, config.PullInterval * 60, 1);
|
await RedisHelper.Client.SetExAsync(redisKey, config.PullInterval * 60, 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user