12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using DotNetCore.CAP;
- using Hotline.Caching.Interfaces;
- using Hotline.Orders;
- using Hotline.Settings;
- using Hotline.Share.Dtos.Order;
- using Hotline.Share.Dtos.Snapshot;
- using Hotline.Share.Mq;
- using Hotline.Share.Tools;
- using Hotline.Snapshot;
- using Hotline.Snapshot.Interfaces;
- using Hotline.Snapshot.Notifications;
- using MediatR;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XF.Domain.Dependency;
- namespace Hotline.Application.Snapshot.Notifications;
- public class SnapshotHandler : ICapSubscribe, IScopeDependency
- {
- private readonly ISnapshotApplication _snapshotApplication;
- public SnapshotHandler(ISnapshotApplication snapshotApplication)
- {
- _snapshotApplication = snapshotApplication;
- }
- /// <summary>
- /// 推送成功后发送的延迟消息;
- /// 延迟检查网格员是否回复了工单;
- /// <param name="message"></param>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
- [CapSubscribe(EventNames.GuiderSystemReplyDelay)]
- public async Task PostGuiderSystemDelayedNotificationHandler(PostGuiderSystemDelayed message, CancellationToken cancellationToken)
- {
- await _snapshotApplication.GuiderSystemReplyDelayAsync(message.OrderId, cancellationToken);
- }
- /// <summary>
- /// 工单归档后生成红包数据
- /// </summary>
- /// <param name="dto"></param>
- /// <param name="cancellationToken"></param>
- [CapSubscribe(EventNames.HotlineOrderFiled)]
- public async void SnapshotOrderEndAsync(OrderFlowDto dto, CancellationToken cancellationToken)
- {
- await _snapshotApplication.AddRedPardAsync(dto.Order.Id, cancellationToken);
- }
- }
- /// <summary>
- /// 网格员办结事件处理
- /// 把网格员信息回填到系统中, 和小程序账号绑定
- /// </summary>
- public class GuiderSystemFieldNotificationHandler : INotificationHandler<GuiderSystemFieldNotification>
- {
- private readonly ISnapshotApplication _snapshotApplication;
- public GuiderSystemFieldNotificationHandler(ISnapshotApplication snapshotApplication1)
- {
- _snapshotApplication = snapshotApplication1;
- }
- public async Task Handle(GuiderSystemFieldNotification notification, CancellationToken cancellationToken)
- {
- await _snapshotApplication.SyncGuiderInfoAsync(notification.OrderId, cancellationToken);
- await _snapshotApplication.SyncCommunityInfoAsync(notification.CommunityInfo, cancellationToken);
- }
- }
- /// <summary>
- /// 推送网格员系统
- /// </summary>
- public class SnapshotPushNotificationHandler : INotificationHandler<PostGuiderSystemNotification>
- {
- private readonly ISnapshotApplication _snapshotApplication;
- public SnapshotPushNotificationHandler(ISnapshotApplication snapshotApplication)
- {
- _snapshotApplication = snapshotApplication;
- }
- public async Task Handle(PostGuiderSystemNotification notification, CancellationToken cancellationToken)
- {
- await _snapshotApplication.PostOrderGuiderSystemAsync(notification.OrderId, cancellationToken);
- }
- }
|