|
@@ -8,31 +8,16 @@ using Hotline.DataSharing.Province.Other;
|
|
|
using Hotline.DataSharing.Province.XieTong.Knowledge;
|
|
|
using Hotline.DataSharing.Province.XieTong.Receive;
|
|
|
using Hotline.DataSharing.Province.XieTong.Send;
|
|
|
-using Hotline.Share.Dtos.DataSharing.Province.Extend;
|
|
|
+using Hotline.Share.Dtos.DataSharing.Province;
|
|
|
+using Hotline.Share.Dtos.DataSharing.Province.XieTong.Knowledge;
|
|
|
+using Hotline.Share.Dtos.DataSharing.Province.XieTong.Receive;
|
|
|
using Hotline.Share.Dtos.DataSharing.Province.XieTong.Send;
|
|
|
-using Hotline.Share.Dtos.Order;
|
|
|
-using Hotline.Share.Enums.DataSharing;
|
|
|
-using Hotline.Share.Enums.Order;
|
|
|
using MapsterMapper;
|
|
|
using MediatR;
|
|
|
-using Microsoft.AspNetCore.Http;
|
|
|
-using Microsoft.IdentityModel.Tokens;
|
|
|
using Newtonsoft.Json;
|
|
|
-using Org.BouncyCastle.Asn1.Ocsp;
|
|
|
using Sharing.Province.Dtos.HuiJu.Send;
|
|
|
-using Sharing.Share.Dtos.DataSharing.DataExchange;
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
-using System.Net.Http;
|
|
|
-using System.Net;
|
|
|
-using System.Text;
|
|
|
-using System.Threading;
|
|
|
-using System.Threading.Tasks;
|
|
|
using XF.Domain.Dependency;
|
|
|
using XF.Domain.Repository;
|
|
|
-using Hotline.Share.Dtos.DataSharing.DataExchange;
|
|
|
-using Hotline.Share.Dtos.DataSharing.Province.XieTong.Knowledge;
|
|
|
|
|
|
namespace Hotline.DataSharing.Province.Services
|
|
|
{
|
|
@@ -88,6 +73,7 @@ namespace Hotline.DataSharing.Province.Services
|
|
|
private readonly IRepository<DsOrderWorkFlow> _dataOrderWorkFlowRepository;
|
|
|
private readonly PusherProvider _pusherProvider;
|
|
|
private readonly IHttpClientFactory _httpClientFactory;
|
|
|
+ private readonly IRepository<DsGetCaseDistrecordSend> _getCaseDistrecordSendRepository;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 注入
|
|
@@ -141,6 +127,7 @@ namespace Hotline.DataSharing.Province.Services
|
|
|
/// <param name="dataOrderWorkFlowRepository"></param>
|
|
|
/// <param name="pusherProvider"></param>
|
|
|
/// <param name="httpClientFactory"></param>
|
|
|
+ /// <param name="getCaseDistrecordSendRepository"></param>
|
|
|
public PusherProviderService(IRepository<DsSubmitCaseInfo> submitCaseInfoRepository,
|
|
|
IMapper mapper,
|
|
|
IMediator mediator,
|
|
@@ -189,7 +176,8 @@ namespace Hotline.DataSharing.Province.Services
|
|
|
IRepository<DsOrder> dataOrderRepository,
|
|
|
IRepository<DsOrderWorkFlow> dataOrderWorkFlowRepository,
|
|
|
PusherProvider pusherProvider,
|
|
|
- IHttpClientFactory httpClientFactory)
|
|
|
+ IHttpClientFactory httpClientFactory,
|
|
|
+ IRepository<DsGetCaseDistrecordSend> getCaseDistrecordSendRepository)
|
|
|
{
|
|
|
_submitCaseInfoRepository = submitCaseInfoRepository;
|
|
|
_mapper = mapper;
|
|
@@ -240,6 +228,7 @@ namespace Hotline.DataSharing.Province.Services
|
|
|
_dataOrderWorkFlowRepository = dataOrderWorkFlowRepository;
|
|
|
_pusherProvider = pusherProvider;
|
|
|
_httpClientFactory = httpClientFactory;
|
|
|
+ _getCaseDistrecordSendRepository = getCaseDistrecordSendRepository;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -934,5 +923,266 @@ namespace Hotline.DataSharing.Province.Services
|
|
|
await _revokeCaseInfoRepository.UpdateAsync(dto, cancellationToken);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单处理过程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SubmitCaseProcessPusher(List<DsSubmitCaseProcess> dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
|
|
|
+
|
|
|
+ var dataReceive = _mapper.Map<List<CaseProcess>>(dto);
|
|
|
+
|
|
|
+ var request = new SubmitCaseProcessRequest();
|
|
|
+
|
|
|
+ foreach (var item in dataReceive)
|
|
|
+ {
|
|
|
+ request.ForeachClass(item);
|
|
|
+ }
|
|
|
+ var data = new SubmitCaseProcessData
|
|
|
+ {
|
|
|
+ CaseProcesss = dataReceive
|
|
|
+ };
|
|
|
+ request.SetData(data);
|
|
|
+
|
|
|
+ var response = await pusher.PushSubmitCaseProcessAsync(request, cancellationToken);
|
|
|
+
|
|
|
+ //如果推送成功修改数据状态
|
|
|
+ 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 dto)
|
|
|
+ {
|
|
|
+ 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, cancellationToken);
|
|
|
+ await _waitingPushDataRepository.RemoveAsync(p => p.SyncID == item.Id, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单处理结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SubmitCaseResultPusher(List<DsSubmitCaseResult> dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
|
|
|
+
|
|
|
+ var dataReceive = _mapper.Map<List<CaseResult>>(dto);
|
|
|
+
|
|
|
+ var request = new SubmitCaseResultRequest();
|
|
|
+
|
|
|
+ foreach (var item in dataReceive)
|
|
|
+ {
|
|
|
+ request.ForeachClass(dataReceive);
|
|
|
+ var dataOrder = await _dataOrderRepository.GetAsync(p => p.ProvinceNo == item.CaseSerial, cancellationToken);
|
|
|
+ if (dataOrder != null)
|
|
|
+ {
|
|
|
+ if (dataOrder.FirstSyncResultTime == null || dataOrder.FirstSyncResultTime is null)
|
|
|
+ {
|
|
|
+ dataOrder.FirstSyncResultTime = DateTime.Now;
|
|
|
+ }
|
|
|
+ dataOrder.NewSyncResultTime = DateTime.Now;
|
|
|
+ dataOrder.NewSyncResultReplyTime = item.FinishTime;
|
|
|
+ dataOrder.AllDuration = item.HandleTimeLong * 60;
|
|
|
+
|
|
|
+ await _dataOrderRepository.UpdateAsync(dataOrder, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var data = new SubmitCaseResultData
|
|
|
+ {
|
|
|
+ CaseResults = dataReceive
|
|
|
+ };
|
|
|
+ request.SetData(data);
|
|
|
+
|
|
|
+ var response = await pusher.PushSubmitCaseResultAsync(request, cancellationToken);
|
|
|
+
|
|
|
+ //如果推送成功修改数据状态
|
|
|
+ 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 dto)
|
|
|
+ {
|
|
|
+ if (list != null && list.Count > 0)
|
|
|
+ {
|
|
|
+ if (list.Find(p => p.caseserial == item.CaseSerial) != null)
|
|
|
+ item.SyncState = "2";
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+
|
|
|
+ await _submitCaseResultRepository.UpdateAsync(item, cancellationToken);
|
|
|
+ await _waitingPushDataRepository.RemoveAsync(p => p.SyncID == item.Id, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单回访评价
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SubmitVisitInfoPusher(List<DsSubmitVisitInfo> dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
|
|
|
+
|
|
|
+ var dataReceive = _mapper.Map<List<VisitInfo>>(dto);
|
|
|
+
|
|
|
+ var request = new SubmitVisitInfoRequest();
|
|
|
+ foreach (var item in dataReceive)
|
|
|
+ {
|
|
|
+ request.ForeachClass(item);
|
|
|
+ var dataOrder = await _dataOrderRepository.GetAsync(p => p.ProvinceNo == item.CaseSerial, cancellationToken);
|
|
|
+ if (dataOrder != null)
|
|
|
+ {
|
|
|
+ if (dataOrder.FirstSyncVisitTime == null || dataOrder.FirstSyncVisitTime is null)
|
|
|
+ {
|
|
|
+ dataOrder.FirstSyncVisitTime = DateTime.Now;
|
|
|
+ }
|
|
|
+ dataOrder.NewSyncVisitTime = item.VisitTime;
|
|
|
+ dataOrder.NewSyncVisitReplyTime = DateTime.Now;
|
|
|
+ dataOrder.FirstSatisfaction = item.FirstSatisfaction;
|
|
|
+ dataOrder.NewSatisfaction = item.SubjectResultSatify;
|
|
|
+ await _dataOrderRepository.UpdateAsync(dataOrder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var data = new SubmitVisitInfoData
|
|
|
+ {
|
|
|
+ VisitInfos = dataReceive
|
|
|
+ };
|
|
|
+ request.SetData(data);
|
|
|
+
|
|
|
+ var response = await pusher.PushSubmitVisitInfoAsync(request, cancellationToken);
|
|
|
+
|
|
|
+ //如果推送成功修改数据状态
|
|
|
+ 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 dto)
|
|
|
+ {
|
|
|
+ if (list != null && list.Count > 0)
|
|
|
+ {
|
|
|
+ if (list.Find(p => p.caseserial == item.CaseSerial) != null)
|
|
|
+ item.SyncState = "2";
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ item.SyncState = "1";
|
|
|
+
|
|
|
+ await _submitVisitInfoRepository.UpdateAsync(item, cancellationToken);
|
|
|
+ await _waitingPushDataRepository.RemoveAsync(p => p.SyncID == item.Id, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///附件上传处理
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task GetCaseMaterialInfoPusher(List<DsGetCaseMaterialInfo> dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //处理数据
|
|
|
+ foreach (var item in dto)
|
|
|
+ {
|
|
|
+ var dataReceive = _mapper.Map<GetCaseMaterialInfoModel>(item);
|
|
|
+
|
|
|
+ //附件上传
|
|
|
+ var result = "";// await SendFile(dataReceive, item.FileName);
|
|
|
+
|
|
|
+ //结果处理
|
|
|
+ if (result == "1")
|
|
|
+ {
|
|
|
+ //移除待发表数据
|
|
|
+ await _waitingPushDataRepository.RemoveAsync(p => p.SyncID == item.Id, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //更新推送表状态
|
|
|
+ item.SyncState = "1";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.SyncState = "2";
|
|
|
+ }
|
|
|
+ await _getCaseMaterialInfoRepository.UpdateAsync(item, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 拉取12315工单办理信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="CaseSerial"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task GetCaseDistrecordSendPusher(string CaseSerial, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
|
|
|
+
|
|
|
+ var request = new GetCaseDistrecordSendRequest();
|
|
|
+
|
|
|
+ request.SetData(new GetCaseDistrecordSendInfo()
|
|
|
+ {
|
|
|
+ CaseSerial = CaseSerial
|
|
|
+ });
|
|
|
+
|
|
|
+ var response = await pusher.PushGetCaseDistrecordSendAsync(request, cancellationToken);
|
|
|
+
|
|
|
+ if (response is null || response.status is null || response.custom is null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (response.status.code != "1")
|
|
|
+ return;
|
|
|
+
|
|
|
+ //这里处理业务
|
|
|
+ if (response.custom.STEP_List != null && response.custom.STEP_List.Count > 0)
|
|
|
+ {
|
|
|
+ //遍历返回的数据
|
|
|
+ foreach (var item in response.custom.STEP_List)
|
|
|
+ {
|
|
|
+ //检测当前数据是否存在,如果存在不处理,不存在新增到数据库并推送到业务系统
|
|
|
+ if (!await _getCaseDistrecordSendRepository.AnyAsync(p => p.CaseSerial == response.custom.CASE_SERIAL && p.RowGuid == item.RowGuid))
|
|
|
+ {
|
|
|
+ var tempData = _mapper.Map<DsGetCaseDistrecordSend>(item);
|
|
|
+ await _getCaseDistrecordSendRepository.AddAsync(tempData);
|
|
|
+
|
|
|
+ //这里调用业务接口,推送办理数据
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|