fix:手动推送 子系统,客户 分组推
This commit is contained in:
parent
52b70cb213
commit
96b3486956
@ -39,25 +39,33 @@ public class TrackPushService : ApplicationService
|
||||
{
|
||||
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
||||
|
||||
var orderIds = await _orderRepository.GetArrayAsync(x =>
|
||||
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => x.Id);
|
||||
var orders = await _orderRepository.GetArrayAsync(x =>
|
||||
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new
|
||||
{
|
||||
x.Id, x.SubSystemId, x.CustomId
|
||||
});
|
||||
|
||||
if (!orderIds.Any())
|
||||
if (!orders.Any())
|
||||
{
|
||||
throw new BusinessException(message: "一个订单都不存在");
|
||||
}
|
||||
|
||||
var trackPushEvent = new TrackPushEvent
|
||||
foreach (var group in orders.GroupBy(x => new { x.SubSystemId, x.CustomId }))
|
||||
{
|
||||
OptionType = OptionType.新增,
|
||||
OrderIds = orderIds,
|
||||
TrackCode = input.TrackCode,
|
||||
OperationMan = CurrentUserRequest.CurrentUser.Name,
|
||||
};
|
||||
var trackPushEvent = new TrackPushEvent
|
||||
{
|
||||
OptionType = OptionType.新增,
|
||||
SubSystemId = group.Key.SubSystemId,
|
||||
CustomId = group.Key.CustomId,
|
||||
OrderIds = group.Select(x => x.Id).ToArray(),
|
||||
TrackCode = input.TrackCode,
|
||||
OperationMan = CurrentUserRequest.CurrentUser.Name,
|
||||
};
|
||||
|
||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
||||
}
|
||||
|
||||
return $"即将推送轨迹代码{input.TrackCode}给{orderIds.Length}个订单";
|
||||
return $"即将推送轨迹代码{input.TrackCode}给{orders.Length}个订单";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user