diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushAfterUpdateOrderEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushAfterUpdateOrderEventHandler.cs deleted file mode 100644 index a6c65fdd..00000000 --- a/src/SJZY.Track.Application/EventHandlers/TrackPushAfterUpdateOrderEventHandler.cs +++ /dev/null @@ -1,50 +0,0 @@ -using DotNetCore.CAP; -using SJZY.Track.Application.Contract.Dtos.TrackPush; -using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Consts; -using SJZY.Track.Domain.Enums; -using Volo.Abp.DependencyInjection; - -namespace SJZY.Track.Application.EventHandlers; - -public class TrackPushAfterUpdateOrderEventHandler : ITransientDependency, ICapSubscribe -{ - private readonly IOrderRepository _orderRepository; - - public TrackPushAfterUpdateOrderEventHandler(IOrderRepository orderRepository) - { - _orderRepository = orderRepository; - } - - [CapSubscribe(GlobalConst.TrackPushAfterUpdateOrderSubscribe)] - public async Task ConsumerAsync(TrackPushAfterUpdateOrderDto dto) - { - var order = await _orderRepository.GetFirstAsync(x => x.Id == dto.OrderId); - if (order == default) return; - - /* - * 异常:最近一条推送是失败 - */ - if (!dto.IsSuccess) - { - order.QuestionType = (int)TrackProblemType.Error; - order.LatestPushError = dto.Message; - } - else - { - order.QuestionType = (int)TrackProblemType.None; - order.LatestPushError = null; - if (dto.OptionType == OptionType.新增) - { - // tips:只有新增会影响推送进度 - order.LatestPushTrackCode = dto.TrackCode; - order.LatestPushTime = DateTime.Now; - } - } - - await _orderRepository.UpdateColumnAsync(order, x => new - { - x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime - }); - } -} \ No newline at end of file