|
@@ -0,0 +1,74 @@
|
|
|
+using MapsterMapper;
|
|
|
+using MediatR;
|
|
|
+using Sharing.Notifications;
|
|
|
+using Sharing.Province.Dtos.XieTong.Send;
|
|
|
+using Sharing.Province.XieTong.Send;
|
|
|
+using Sharing.Repository.Province.XieTong.Send;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace Sharing.Province.Handlers
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ public class GetCaseProcessReceiveHandler : INotificationHandler<GetCaseProcessReceiveNotification>
|
|
|
+ {
|
|
|
+ private readonly IChannelConfigurationManager _channelConfigurationManager;
|
|
|
+ private readonly PusherProvider _pusherProvider;
|
|
|
+ private readonly IMapper _mapper;
|
|
|
+ private readonly IGetCaseProcessReceiveRepository _getCaseProcessReceiveRepository;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="channelConfigurationManager"></param>
|
|
|
+ /// <param name="pusherProvider"></param>
|
|
|
+ /// <param name="mapper"></param>
|
|
|
+ /// <param name="getCaseProcessReceiveRepository"></param>
|
|
|
+ public GetCaseProcessReceiveHandler(IChannelConfigurationManager channelConfigurationManager, PusherProvider pusherProvider, IMapper mapper
|
|
|
+ , IGetCaseProcessReceiveRepository getCaseProcessReceiveRepository)
|
|
|
+ {
|
|
|
+ _channelConfigurationManager = channelConfigurationManager;
|
|
|
+ _pusherProvider = pusherProvider;
|
|
|
+ _mapper = mapper;
|
|
|
+ _getCaseProcessReceiveRepository = getCaseProcessReceiveRepository;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单交办处理过程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="notification"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task Handle(GetCaseProcessReceiveNotification notification, CancellationToken cancellationToken = default)
|
|
|
+ {
|
|
|
+ var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
|
|
|
+
|
|
|
+ var dataReceive = _mapper.Map<GetCaseProcessReceiveInfo>(notification.Data);
|
|
|
+ var data = new GetCaseProcessReceiveData
|
|
|
+ {
|
|
|
+ GetCaseProcessReceiveInfos = new List<GetCaseProcessReceiveInfo>
|
|
|
+ {
|
|
|
+ dataReceive
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var request = new GetCaseProcessReceiveRequest();
|
|
|
+ request.SetData(data);
|
|
|
+
|
|
|
+ var response = await pusher.PushGetCaseProcessReceiveAsync(request, cancellationToken);
|
|
|
+
|
|
|
+ //如果推送成功修改数据状态
|
|
|
+ if (response != null && response.Code == "1")
|
|
|
+ {
|
|
|
+ notification.Data.SyncState = "1";
|
|
|
+ notification.Data.ReturnResult = Newtonsoft.Json.JsonConvert.SerializeObject(response);
|
|
|
+ await _getCaseProcessReceiveRepository.UpdateAsync(notification.Data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|