fix 手动更新bug

This commit is contained in:
李鹏军 2024-03-27 16:50:40 +08:00
parent 41755830f6
commit 676cdad78c
4 changed files with 20 additions and 9 deletions

View File

@ -2,10 +2,10 @@
public class TrackRefreshAttach public class TrackRefreshAttach
{ {
public TrackRefreshAttach(int serviceProviderId, string serviceProviderCode, int subSystemId, int orderType) public TrackRefreshAttach(int serviceProviderId, string serviceProviderName, int subSystemId, int orderType)
{ {
ServiceProviderId = serviceProviderId; ServiceProviderId = serviceProviderId;
ServiceProviderCode = serviceProviderCode; ServiceProviderName = serviceProviderName;
SubSystemId = subSystemId; SubSystemId = subSystemId;
OrderType = orderType; OrderType = orderType;
} }
@ -16,9 +16,9 @@ public class TrackRefreshAttach
public int ServiceProviderId { get; set; } public int ServiceProviderId { get; set; }
/// <summary> /// <summary>
/// 服务商code /// 服务商name
/// </summary> /// </summary>
public string ServiceProviderCode { get; set; } public string ServiceProviderName { get; set; }
/// <summary> /// <summary>
/// 订单类型(主数据枚举TrackOrderType) /// 订单类型(主数据枚举TrackOrderType)

View File

@ -51,18 +51,21 @@ public class TrackPullService : ApplicationService
throw new BusinessException(message: "一个能更新的都没有"); 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 => new
{ x.ServiceProviderId, x.ServiceProviderName, x.SubSystemId, x.OrderType }))
{ {
var data = group.Select(x => new var data = group.Select(x => new
{ {
x.OrderNo x.OrderNo
}).ToList(); }).ToList();
var serviceProviderCode = group.FirstOrDefault()!.ServiceProviderCode;
// 批量获取轨迹 // 批量获取轨迹
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
"A012", group.Key.ServiceProviderCode, data, "A012", serviceProviderCode, data, GlobalConst.TrackRefreshSubscribe,
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key)); JsonConvert.SerializeObject(new TrackRefreshAttach(group.Key.ServiceProviderId,
group.Key.ServiceProviderName, group.Key.SubSystemId, group.Key.OrderType)));
} }
return true; return true;
@ -87,6 +90,7 @@ public class TrackPullService : ApplicationService
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId); var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode; var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode;
var serviceProviderName = orders.FirstOrDefault()?.ServiceProviderName;
foreach (var group in orders.GroupBy(x => foreach (var group in orders.GroupBy(x =>
new { x.SubSystemId, x.OrderType })) new { x.SubSystemId, x.OrderType }))
@ -100,7 +104,7 @@ public class TrackPullService : ApplicationService
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data, InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, GlobalConst.TrackRefreshSubscribe,
JsonConvert.SerializeObject(new TrackRefreshAttach(config.ServiceProviderId, serviceProviderCode!, JsonConvert.SerializeObject(new TrackRefreshAttach(config.ServiceProviderId, serviceProviderName!,
group.Key.SubSystemId, group.Key.OrderType))); group.Key.SubSystemId, group.Key.OrderType)));
} }

View File

@ -16,6 +16,11 @@ public class OrderWithServiceProviderVO
/// </summary> /// </summary>
public string ServiceProviderCode { get; set; } = null!; public string ServiceProviderCode { get; set; } = null!;
/// <summary>
/// 服务商name
/// </summary>
public string ServiceProviderName { get; set; } = null!;
/// <summary> /// <summary>
/// 子系统id /// 子系统id
/// </summary> /// </summary>

View File

@ -120,6 +120,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
OrderType = a.OrderType, OrderType = a.OrderType,
ServiceProviderId = b.ServiceProviderId, ServiceProviderId = b.ServiceProviderId,
ServiceProviderCode = c.Code, ServiceProviderCode = c.Code,
ServiceProviderName = c.Name,
SubSystemId = a.SubSystemId SubSystemId = a.SubSystemId
}) })
.ToListAsync(); .ToListAsync();
@ -137,6 +138,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
OrderType = a.OrderType, OrderType = a.OrderType,
ServiceProviderId = b.ServiceProviderId, ServiceProviderId = b.ServiceProviderId,
ServiceProviderCode = c.Code, ServiceProviderCode = c.Code,
ServiceProviderName = c.Name,
SubSystemId = a.SubSystemId SubSystemId = a.SubSystemId
}) })
.ToListAsync(); .ToListAsync();