opt:接口通请求失败打印异常
This commit is contained in:
parent
96b3486956
commit
4cb5f465da
@ -65,8 +65,14 @@ public class TrackPushCompletedEventHandler : ITransientDependency, ICapSubscrib
|
||||
|
||||
private async Task TrackPushAfterUpdateOrderAsync(TrackPushRecordIndex log)
|
||||
{
|
||||
var order = new OrderEntity();
|
||||
order.Id = log.OrderId;
|
||||
// tips:只有新增会影响推送进度?
|
||||
if (log.OptionType != OptionType.新增.ToString()) return;
|
||||
|
||||
var order = new OrderEntity
|
||||
{
|
||||
Id = log.OrderId
|
||||
};
|
||||
|
||||
/*
|
||||
* 异常:最近一条推送是失败
|
||||
*/
|
||||
@ -74,27 +80,22 @@ public class TrackPushCompletedEventHandler : ITransientDependency, ICapSubscrib
|
||||
{
|
||||
order.QuestionType = (int)TrackProblemType.Error;
|
||||
order.LatestPushError = log.Message;
|
||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||
{
|
||||
x.QuestionType, x.LatestPushError
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// 还原成正常态
|
||||
order.QuestionType = (int)TrackProblemType.None;
|
||||
order.LatestPushError = null;
|
||||
if (log.OptionType == OptionType.新增.ToString())
|
||||
order.LatestPushTrackCode = log.TrackCode;
|
||||
order.LatestPushTime = log.CreateTime;
|
||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||
{
|
||||
// tips:只有新增会影响推送进度?
|
||||
order.LatestPushTrackCode = log.TrackCode;
|
||||
order.LatestPushTime = DateTime.Now;
|
||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||
{
|
||||
x.LatestPushTrackCode, x.LatestPushTime, x.QuestionType, x.LatestPushError
|
||||
});
|
||||
return;
|
||||
}
|
||||
x.LatestPushTrackCode, x.LatestPushTime, x.QuestionType, x.LatestPushError
|
||||
});
|
||||
}
|
||||
|
||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||
{
|
||||
x.QuestionType, x.LatestPushError
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -44,9 +44,8 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (pushConfigs == null || pushConfigs.Count == 0) return;
|
||||
_pushConfigs = pushConfigs;
|
||||
|
||||
var errorType = (int)TrackProblemType.Error;
|
||||
var orders = await _orderRepository.GetListAsync(x =>
|
||||
@event.OrderIds.Contains(x.Id) && x.QuestionType != errorType, x => new OrderEntity
|
||||
@event.OrderIds.Contains(x.Id), x => new OrderEntity
|
||||
{
|
||||
Id = x.Id, OrderNo = x.OrderNo, LatestPushTrackCode = x.LatestPushTrackCode,
|
||||
OrderType = x.OrderType
|
||||
@ -80,6 +79,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
{
|
||||
foreach (var order in _orders)
|
||||
{
|
||||
if (order.QuestionType == (int)TrackProblemType.Error) continue; // 系统不推异常单,只能人工操作
|
||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
||||
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
|
||||
if (config == null) continue;
|
||||
@ -114,6 +114,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
|
||||
if (tracks.Count == 0) return; // 一个能推的轨迹都不存在
|
||||
|
||||
// tips:人工推送只要能推就推了,不会校验已推和顺序问题,因为可能是更新
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
var order = _orders.First(x => x.Id == track.OrderId);
|
||||
@ -147,9 +148,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (items.Count == 0) return;
|
||||
|
||||
string asciiString = Base64Helper.SerializeObject(OptionType.新增.ToString());
|
||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.PushTrackInterfaceCode,
|
||||
var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||
InterfaceRelayConst.PushTrackInterfaceCode,
|
||||
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
|
||||
attach: asciiString);
|
||||
|
||||
if (r.Code != InterfaceRelayConst.SuccessCode)
|
||||
{
|
||||
throw new BusinessException(message: r.Msg);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DoUpdateAsync(TrackPushEvent @event)
|
||||
@ -181,9 +188,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
if (items.Count == 0) return;
|
||||
|
||||
string asciiString = Base64Helper.SerializeObject(OptionType.修改.ToString());
|
||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.TrackUpdateInterfaceCode,
|
||||
var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||
InterfaceRelayConst.TrackUpdateInterfaceCode,
|
||||
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
|
||||
attach: asciiString);
|
||||
|
||||
if (r.Code != InterfaceRelayConst.SuccessCode)
|
||||
{
|
||||
throw new BusinessException(message: r.Msg);
|
||||
}
|
||||
}
|
||||
|
||||
private TrackUpdateInput BuiltUpdateItem(TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user