|
@@ -1,8 +1,11 @@
|
|
|
using MapsterMapper;
|
|
|
using MediatR;
|
|
|
using Sharing.Notifications.HuiJu;
|
|
|
+using Sharing.Province.Dtos;
|
|
|
using Sharing.Province.Dtos.HuiJu.Send;
|
|
|
using Sharing.Province.HuiJu.Send;
|
|
|
+using Sharing.Province.Other;
|
|
|
+using Sharing.Repository.Province.HuiJu;
|
|
|
|
|
|
namespace Sharing.Province.Handlers.HuiJu
|
|
|
{
|
|
@@ -15,6 +18,7 @@ namespace Sharing.Province.Handlers.HuiJu
|
|
|
private readonly PusherProvider _pusherProvider;
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly ISubmitCaseProcessRepository _submitCaseProcessRepository;
|
|
|
+ private readonly IWaitingPushDataRepository _waitingPushDataRepository;
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
@@ -23,13 +27,15 @@ namespace Sharing.Province.Handlers.HuiJu
|
|
|
/// <param name="pusherProvider"></param>
|
|
|
/// <param name="mapper"></param>
|
|
|
/// <param name="submitCaseProcessRepository"></param>
|
|
|
+ /// <param name="waitingPushDataRepository"></param>
|
|
|
public SubmitCaseProcessHandler(IChannelConfigurationManager channelConfigurationManager, PusherProvider pusherProvider, IMapper mapper
|
|
|
- , ISubmitCaseProcessRepository submitCaseProcessRepository)
|
|
|
+ , ISubmitCaseProcessRepository submitCaseProcessRepository, IWaitingPushDataRepository waitingPushDataRepository)
|
|
|
{
|
|
|
_channelConfigurationManager = channelConfigurationManager;
|
|
|
_pusherProvider = pusherProvider;
|
|
|
_mapper = mapper;
|
|
|
_submitCaseProcessRepository = submitCaseProcessRepository;
|
|
|
+ _waitingPushDataRepository = waitingPushDataRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -62,16 +68,39 @@ namespace Sharing.Province.Handlers.HuiJu
|
|
|
var response = await pusher.PushSubmitCaseProcessAsync(request, cancellationToken);
|
|
|
|
|
|
//如果推送成功修改数据状态
|
|
|
- //if (response != null)
|
|
|
- //{
|
|
|
- // if (response.Code == "1")
|
|
|
- // notification.DataOrder.SyncState = "1";
|
|
|
- // else
|
|
|
- // notification.DataOrder.SyncState = "2";
|
|
|
+ if (response != null)
|
|
|
+ {
|
|
|
+ if (response != null)
|
|
|
+ {
|
|
|
+ List<ErrorInfo> list = new();
|
|
|
+ if (response.custom != null && response.custom.errorObjs != null && response.custom.errorObjs.Count > 0)
|
|
|
+ {
|
|
|
+ list = response.custom.errorObjs;
|
|
|
+ }
|
|
|
+ foreach (var item in notification.DataOrder)
|
|
|
+ {
|
|
|
+ if (list != null && list.Count > 0)
|
|
|
+ {
|
|
|
+ if (list.Find(p => p.caseid == item.CaseId) != null)
|
|
|
+ item.SyncState = "2";
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+
|
|
|
+ await _submitCaseProcessRepository.UpdateAsync(item);
|
|
|
+ await _waitingPushDataRepository.RemoveAsync(p => p.SyncID == item.Id);
|
|
|
+ }
|
|
|
+ //if (response.code == "1")
|
|
|
+ // notification.dataorder.syncstate = "1";
|
|
|
+ //else
|
|
|
+ // notification.dataorder.syncstate = "2";
|
|
|
|
|
|
- // notification.DataOrder.ReturnResult = Newtonsoft.Json.JsonConvert.SerializeObject(response);
|
|
|
- // await _submitCaseProcessRepository.UpdateAsync(notification.DataOrder);
|
|
|
- //}
|
|
|
+ //notification.dataorder.returnresult = newtonsoft.json.jsonconvert.serializeobject(response);
|
|
|
+ //await _submitcaseprocessrepository.updateasync(notification.dataorder);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|