|
@@ -0,0 +1,1997 @@
|
|
|
+using DataSharing.CityStateDataExchange;
|
|
|
+using DataSharing.RawData;
|
|
|
+using DataSharing.SendTask;
|
|
|
+using DataSharing.Share.Consts;
|
|
|
+using DataSharing.Share.Dtos;
|
|
|
+using DataSharing.Share.Dtos.HotlineWeb;
|
|
|
+using DataSharing.Share.Dtos.Province;
|
|
|
+using DataSharing.Share.Dtos.Province.Extend;
|
|
|
+using DataSharing.Share.Dtos.Province.HuiJu;
|
|
|
+using DataSharing.Share.Dtos.Province.XieTong.Knowledge;
|
|
|
+using DataSharing.Share.Dtos.Province.XieTong.Receive;
|
|
|
+using DataSharing.Share.Dtos.Province.XieTong.Send;
|
|
|
+using DataSharing.Share.Enums;
|
|
|
+using DataSharing.Validators.HuiJu;
|
|
|
+using DataSharing.Validators.XieTong;
|
|
|
+using DotNetCore.CAP;
|
|
|
+using Hotline.Share.Dtos.Knowledge;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Share.Dtos.TrCallCenter;
|
|
|
+using Hotline.Share.Enums.CallCenter;
|
|
|
+using Hotline.Share.Enums.FlowEngine;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
+using MapsterMapper;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using XF.Domain.Cache;
|
|
|
+using XF.Domain.Dependency;
|
|
|
+using XF.Domain.Exceptions;
|
|
|
+using XF.Domain.Repository;
|
|
|
+
|
|
|
+namespace DataSharing.Province
|
|
|
+{
|
|
|
+ public class ProvinceService : IProvinceService, IScopeDependency
|
|
|
+ {
|
|
|
+ #region 注入
|
|
|
+ private readonly IMapper _mapper;
|
|
|
+ private readonly ILogger<ProvinceService> _logger;
|
|
|
+ private readonly IRepository<DsSendTask> _dsSendTaskRepository;
|
|
|
+ private readonly IRepository<DsOrder> _dsOrderRepository;
|
|
|
+ private readonly IRepository<DsOrderWorkFlow> _dataOrderWorkFlowRepository;
|
|
|
+ private readonly IRepository<DsKnowledgeRawData> _knowledgeRawDataRepository;
|
|
|
+ private readonly IChannelConfigurationManager _channelConfigurationManager;
|
|
|
+ private readonly IRepository<DsSendCaseInfo> _sendCaseInfoRepository;
|
|
|
+ private readonly ITypedCache<MissedCallModelDto> _missedCallModelCache;
|
|
|
+ private readonly string MissedCallKey = "missedCallKey_";
|
|
|
+ private readonly IRepository<DsOrderVisit> _dsOrderVisitRepository;
|
|
|
+ private readonly IRepository<DsGetCaseBackApply> _getCaseBackApplyRepository;
|
|
|
+ private readonly ICapPublisher _capPublisher;
|
|
|
+ private readonly IRepository<DsTelCall> _dsTelCallRepository;
|
|
|
+ private readonly IRepository<DsReceiveDataExchangeData> _dsReceiveDataExchangeDataRepository;
|
|
|
+ private readonly ITypedCache<ConfigurationInformationDto> _configurationInformationCache;
|
|
|
+ private readonly IRepository<DsOrderVisitSend> _dsOrderVisitSendRepository;
|
|
|
+ private readonly IRepository<DsUserTokenInfo> _dsUserTokenInfoRepository;
|
|
|
+ private readonly ISharingConfigurationManager _sharingConfigurationManager;
|
|
|
+ private readonly IInitPushDataService _initPushDataService;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mapper"></param>
|
|
|
+ /// <param name="logger"></param>
|
|
|
+ /// <param name="dsSendTaskRepository"></param>
|
|
|
+ /// <param name="dsOrderRepository"></param>
|
|
|
+ /// <param name="dataOrderWorkFlowRepository"></param>
|
|
|
+ /// <param name="knowledgeRawDataRepository"></param>
|
|
|
+ /// <param name="channelConfigurationManager"></param>
|
|
|
+ /// <param name="sendCaseInfoRepository"></param>
|
|
|
+ /// <param name="missedCallModelCache"></param>
|
|
|
+ /// <param name="dsOrderVisitRepository"></param>
|
|
|
+ /// <param name="getCaseBackApplyRepository"></param>
|
|
|
+ /// <param name="capPublisher"></param>
|
|
|
+ /// <param name="dsTelCallRepository"></param>
|
|
|
+ /// <param name="dsReceiveDataExchangeDataRepository"></param>
|
|
|
+ /// <param name="configurationInformationCache"></param>
|
|
|
+ /// <param name="dsOrderVisitSendRepository"></param>
|
|
|
+ /// <param name="dsUserTokenInfoRepository"></param>
|
|
|
+ /// <param name="sharingConfigurationManager"></param>
|
|
|
+ /// <param name="initPushDataService"></param>
|
|
|
+ public ProvinceService(IMapper mapper, ILogger<ProvinceService> logger,
|
|
|
+ IRepository<DsSendTask> dsSendTaskRepository,
|
|
|
+ IRepository<DsOrder> dsOrderRepository,
|
|
|
+ IRepository<DsOrderWorkFlow> dataOrderWorkFlowRepository,
|
|
|
+ IRepository<DsKnowledgeRawData> knowledgeRawDataRepository,
|
|
|
+ IChannelConfigurationManager channelConfigurationManager,
|
|
|
+ IRepository<DsSendCaseInfo> sendCaseInfoRepository,
|
|
|
+ ITypedCache<MissedCallModelDto> missedCallModelCache,
|
|
|
+ IRepository<DsOrderVisit> dsOrderVisitRepository,
|
|
|
+ IRepository<DsGetCaseBackApply> getCaseBackApplyRepository,
|
|
|
+ ICapPublisher capPublisher,
|
|
|
+ IRepository<DsTelCall> dsTelCallRepository,
|
|
|
+ IRepository<DsReceiveDataExchangeData> dsReceiveDataExchangeDataRepository,
|
|
|
+ ITypedCache<ConfigurationInformationDto> configurationInformationCache,
|
|
|
+ IRepository<DsOrderVisitSend> dsOrderVisitSendRepository,
|
|
|
+ IRepository<DsUserTokenInfo> dsUserTokenInfoRepository,
|
|
|
+ ISharingConfigurationManager sharingConfigurationManager,
|
|
|
+ IInitPushDataService initPushDataService)
|
|
|
+ {
|
|
|
+ _mapper = mapper;
|
|
|
+ _logger = logger;
|
|
|
+ _dsSendTaskRepository = dsSendTaskRepository;
|
|
|
+ _dsOrderRepository = dsOrderRepository;
|
|
|
+ _dataOrderWorkFlowRepository = dataOrderWorkFlowRepository;
|
|
|
+ _knowledgeRawDataRepository = knowledgeRawDataRepository;
|
|
|
+ _channelConfigurationManager = channelConfigurationManager;
|
|
|
+ _sendCaseInfoRepository = sendCaseInfoRepository;
|
|
|
+ _missedCallModelCache = missedCallModelCache;
|
|
|
+ _dsOrderVisitRepository = dsOrderVisitRepository;
|
|
|
+ _getCaseBackApplyRepository = getCaseBackApplyRepository;
|
|
|
+ _capPublisher = capPublisher;
|
|
|
+ _dsTelCallRepository = dsTelCallRepository;
|
|
|
+ _dsReceiveDataExchangeDataRepository = dsReceiveDataExchangeDataRepository;
|
|
|
+ _configurationInformationCache = configurationInformationCache;
|
|
|
+ _dsOrderVisitSendRepository = dsOrderVisitSendRepository;
|
|
|
+ _dsUserTokenInfoRepository = dsUserTokenInfoRepository;
|
|
|
+ _sharingConfigurationManager = sharingConfigurationManager;
|
|
|
+ _initPushDataService = initPushDataService;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 协同-第一批次---已处理
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 退回申请
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dtos"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task GetCaseBackApplyAsync(PublishOrderSendBackDto dtos, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //验证数据
|
|
|
+ foreach (var dto in dtos.SendDatas)
|
|
|
+ {
|
|
|
+ var validator = new GetCaseBackApplyValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var dto in dtos.SendDatas)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ //处理省上的退回申请
|
|
|
+ if (dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ {
|
|
|
+ var data = _mapper.Map<GetCaseBackApplyInfo>(dto);
|
|
|
+ data.CliengGuid = dto.SendBack.Id;
|
|
|
+
|
|
|
+ var tempData = _mapper.Map<DsGetCaseBackApply>(data);
|
|
|
+ tempData.OrderSendBackId = dto.SendBack.Id;
|
|
|
+
|
|
|
+ var backId = await _getCaseBackApplyRepository.AddAsync(tempData, cancellationToken);
|
|
|
+ if (!string.IsNullOrEmpty(backId))
|
|
|
+ {
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<GetCaseBackApplyInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "get_case_back_apply";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetCaseBackApply", "get_case_back_apply", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.SendBack.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单督办过程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SendSuperviseProcessInfoAsync(PublishSuperviseDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new SendSuperviseProcessInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<SendSuperviseProcessInfo>(dto);
|
|
|
+
|
|
|
+ data.ReplyOpinion = "已签收";
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<SendSuperviseProcessInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "send_supervise_process_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendSuperviseProcessInfo", "send_supervise_process_info", jsonData, dto.Order.ProvinceNo, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单督办结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SendSuperviseResultInfoAsync(PublishSuperviseDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new SendSuperviseResultInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<SendSuperviseResultInfo>(dto);
|
|
|
+ data.CliengGuid = dto.Supervise.Id;
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<SendSuperviseResultInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "send_supervise_result_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendSuperviseResultInfo", "send_supervise_result_info", jsonData, dto.Order.ProvinceNo, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.Supervise.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Supervise, dto.Order.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单发起甄别
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task ScreenCaseInfoSendAsync(PublishScreenDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new ScreenCaseInfoSendInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<ScreenCaseInfoSendInfo>(dto);
|
|
|
+ data.CliengGuid = dto.Screen.Id;
|
|
|
+ data.ApplyType = dto.Screen.TypeDicName switch
|
|
|
+ {
|
|
|
+ "违反法律法规" => "10",
|
|
|
+ "按正常流程处理" => "20",
|
|
|
+ _ => "30",
|
|
|
+ };
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<ScreenCaseInfoSendInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "screen_case_info_send";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("ScreenCaseInfoSend", "screen_case_info_send", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.Screen.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单申请延时
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task DelayCaseInfoSendAsync(PublishOrderDelayDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new DelayCaseInfoSendInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<DelayCaseInfoSendInfo>(dto);
|
|
|
+ data.CliengGuid = dto.Id;
|
|
|
+ data.ApplyType = "1";
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<DelayCaseInfoSendInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "delay_case_info_send";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("DelayCaseInfoSend", "delay_case_info_send", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.FileJson, data.CaseSerial, data.CliengGuid, EMaterialType.Process, data.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 汇聚-第二批次
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热线工单流程开启
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="pushdto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task OrderFlowStartedAsync(PublishCallRecrodDto pushdto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(pushdto.Order.AreaCode) || pushdto.Order.AreaCode.Contains("519"))
|
|
|
+ pushdto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var dto = pushdto.Order;
|
|
|
+
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ //如果不是省上派下来的工单,需要汇聚到省上
|
|
|
+ if (dto is not null && !dto.IsProvince)
|
|
|
+ {
|
|
|
+ var data = InitDataAsync(dto);
|
|
|
+ var validator = new SubmitCaseInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseInfo", "submit_case_info", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 10, GenerationTime: pushdto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.FileJson, dto.ProvinceNo, data.CliengGuid, EMaterialType.Acceptance, data.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ //推送当前办理信息
|
|
|
+ await SubmitCaseProcessFlowAsync(new OrderFlowDto { Order = pushdto.Order, WorkflowTrace = pushdto.WorkflowTrace, ExpiredTimeChanged = false }, cancellationToken);
|
|
|
+
|
|
|
+ //再次推送通话记录
|
|
|
+ if (pushdto.TrCallRecordDto is not null)
|
|
|
+ {
|
|
|
+ //如果推送工单的时候判断通话记录是否是未接,并且是否已经上传,如果没有咋补再次推送通话记录
|
|
|
+ var tellCall = await _dsTelCallRepository.AnyAsync(p => p.CallId == pushdto.TrCallRecordDto.CallAccept, cancellationToken);
|
|
|
+ if (pushdto.TrCallRecordDto.OnState == EOnState.NoOn && !tellCall)
|
|
|
+ return;
|
|
|
+
|
|
|
+ var dataCall = _mapper.Map<SubmitCaseRecordInfo>(pushdto.TrCallRecordDto);
|
|
|
+ dataCall.AreaCode = dto.AreaCode.Length > 6 ? dto.AreaCode.Substring(0, 6) : dto.AreaCode;
|
|
|
+ dataCall.CaseSerial = dto.ProvinceNo;
|
|
|
+ if (string.IsNullOrEmpty(dataCall.AccordUrl))
|
|
|
+ dataCall.AccordUrl = "";
|
|
|
+
|
|
|
+ //处理通话记录时间
|
|
|
+ SetCallTime(dataCall);
|
|
|
+
|
|
|
+ var validator = new SubmitCaseRecordInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dataCall, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var requestCall = new ProvinceListRequest<SubmitCaseRecordInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ requestCall.SetData(new List<SubmitCaseRecordInfo>() { dataCall });
|
|
|
+ var jsonDataCall = requestCall.ToString();
|
|
|
+ jsonDataCall = jsonDataCall.Replace("0001-01-01 00:00:00", "");
|
|
|
+ var urlCall = configProvince.HuiJu + "submit_case_record";
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ var taskId = await _initPushDataService.InitPushDataAsync("SubmitCaseRecord", "submit_case_record", jsonDataCall, dataCall.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 20, GenerationTime: pushdto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //本地保存通话记录数据
|
|
|
+ await InitTelCallData(pushdto.TrCallRecordDto, dto.ProvinceNo, taskId, cancellationToken);
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热线工单期满时间变更--推送服务工单受理
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task HotlineOrderFlowRecalledAsync(OrderDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.AreaCode) || dto.AreaCode.Contains("519"))
|
|
|
+ dto.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ //如果不是省上派下来的工单,需要汇聚到省上
|
|
|
+ if (!dto.IsProvince)
|
|
|
+ {
|
|
|
+ var data = InitDataAsync(dto);
|
|
|
+ var validator = new SubmitCaseInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseInfo", "submit_case_info", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 10, GenerationTime: dto.StartTime, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热线工单办理---服务工单处理/服务工单交办处理过程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SubmitCaseProcessAsync(OrderFlowDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(dto.WorkflowTrace.HandlerOrgAreaCode))
|
|
|
+ {
|
|
|
+ dto.WorkflowTrace.HandlerOrgAreaCode = dto.Order.AreaCode;
|
|
|
+ if (dto.WorkflowTrace.HandlerOrgAreaCode.Length > 6)
|
|
|
+ dto.WorkflowTrace.HandlerOrgAreaCode = dto.WorkflowTrace.HandlerOrgAreaCode.Substring(0, 6);
|
|
|
+ }
|
|
|
+
|
|
|
+ await SubmitCaseProcessFlowAsync(dto, cancellationToken);
|
|
|
+ //期满时间变更或者办理节点为话务部,重新推送数据
|
|
|
+ if ((dto.ExpiredTimeChanged || dto.Order.ActualHandleStepName == "话务部") && !dto.Order.IsProvince)
|
|
|
+ {
|
|
|
+ var submitCaseInfo = InitDataAsync(dto.Order);
|
|
|
+ var validator = new SubmitCaseInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(submitCaseInfo, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var requestSubmitCaseInfo = new ProvinceListRequest<SubmitCaseInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ requestSubmitCaseInfo.SetData(new List<SubmitCaseInfo>() { submitCaseInfo });
|
|
|
+ var jsonDataSubmitCaseInfo = requestSubmitCaseInfo.ToString();
|
|
|
+ var urlSubmitCaseInfo = configProvince.HuiJu + "submit_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseInfo", "submit_case_info", jsonDataSubmitCaseInfo, submitCaseInfo.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 10, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ //如果话务部派出去,再次上传附件
|
|
|
+ if (dto.Order.ActualHandleStepName == "话务部")
|
|
|
+ {
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.Order.FileJson, dto.Order.ProvinceNo, submitCaseInfo.CliengGuid, EMaterialType.Acceptance, submitCaseInfo.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单回访评价/服务工单交办评价
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SubmitVisitInfoDataAsync(PublishVisitDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ dto.AreaCode = dto.Order.AreaCode.Length > 6 ? dto.Order.AreaCode.Substring(0, 6) : dto.Order.AreaCode;
|
|
|
+
|
|
|
+ //存在更新,不存在新增
|
|
|
+ var visitData = await _dsOrderVisitSendRepository.GetAsync(p => p.OrderId == dto.Order.Id, cancellationToken);
|
|
|
+ if (visitData != null)
|
|
|
+ {
|
|
|
+ visitData.VisitType = dto.VisitType.ToString();
|
|
|
+ visitData.VisitName = dto.VisitName;
|
|
|
+ visitData.VisitTime = dto.VisitTime;
|
|
|
+ visitData.VisitRemark = dto.VisitRemark;
|
|
|
+ visitData.SubjectResultSatifyCode = dto.SubjectResultSatifyCode;
|
|
|
+ await _dsOrderVisitSendRepository.UpdateAsync(visitData, cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ///写入推送数据表,用于统计满意度
|
|
|
+ visitData = new()
|
|
|
+ {
|
|
|
+ OrderId = dto.Order.Id,
|
|
|
+ OrderNo = dto.No,
|
|
|
+ ProvinceNo = dto.Order.ProvinceNo,
|
|
|
+ VisitType = dto.VisitType.ToString(),
|
|
|
+ VisitName = dto.VisitName,
|
|
|
+ VisitTime = dto.VisitTime,
|
|
|
+ VisitRemark = dto.VisitRemark,
|
|
|
+ SubjectResultSatifyCode = dto.SubjectResultSatifyCode,
|
|
|
+ IsProvince = dto.Order.IsProvince,
|
|
|
+ Source = dto.Order.Source.ToString()
|
|
|
+ };
|
|
|
+ await _dsOrderVisitSendRepository.AddAsync(visitData, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ var visitType = dto.VisitType switch
|
|
|
+ {
|
|
|
+ EVisitType.ArtificialVisit => "DH",
|
|
|
+ EVisitType.SmsVisit => "DX",
|
|
|
+ EVisitType.WebVisit => "WZ",
|
|
|
+ EVisitType.WeChatVisit => "WX",
|
|
|
+ EVisitType.AppVisit => "AP",
|
|
|
+ _ => "DH",
|
|
|
+ };
|
|
|
+
|
|
|
+ //将未接通未做评价的默认为满意
|
|
|
+ switch (dto.SubjectResultSatifyCode)
|
|
|
+ {
|
|
|
+ case "5":
|
|
|
+ case "4":
|
|
|
+ case "2":
|
|
|
+ break;
|
|
|
+ case "-1":
|
|
|
+ case "0":
|
|
|
+ dto.SubjectResultSatifyCode = "4";
|
|
|
+ break;
|
|
|
+ case "6":
|
|
|
+ case "7":
|
|
|
+ dto.SubjectResultSatifyCode = "3";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ dto.SubjectResultSatifyCode = "3";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+
|
|
|
+ //如果省上下来的工单走服务工单交办评价接口,不是省上派下来的工单,走服务工单评价接口
|
|
|
+ if (dto.Order.IsProvince && dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ {
|
|
|
+ var data = _mapper.Map<GetVisitInfoReceiveInfo>(dto);
|
|
|
+
|
|
|
+ data.VisitType = visitType;
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+ var validator = new GetVisitInfoReceiveInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var request = new ProvinceRequest<GetVisitInfoReceiveInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "get_visit_info_receive";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetVisitInfoReceive", "get_visit_info_receive", jsonData, data.CaseSerial, pathType: EPathType.XieTong, taskPriority: 5, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(null, data.CaseSerial, data.CliengGuid, EMaterialType.Visit, data.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var data = _mapper.Map<SubmitVisitInfo>(dto);
|
|
|
+ data.VisitType = visitType;
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+
|
|
|
+ var validator = new SubmitVisitInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var request = new ProvinceListRequest<SubmitVisitInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitVisitInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_visit_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitVisitInfo", "submit_visit_info", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 5, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(null, data.CaseSerial, data.CliengGuid, EMaterialType.Visit, data.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热线工单归档---服务工单结果/服务工单交办处理结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task OrderFiledAsync(OrderFlowDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.ActualHandleOrgAreaCode))
|
|
|
+ {
|
|
|
+ dto.Order.ActualHandleOrgAreaCode = dto.Order.AreaCode;
|
|
|
+ if (dto.Order.ActualHandleOrgAreaCode.Length > 6)
|
|
|
+ dto.Order.ActualHandleOrgAreaCode = dto.Order.ActualHandleOrgAreaCode.Substring(0, 6);
|
|
|
+ }
|
|
|
+
|
|
|
+ //先看看需要处理工单数据不
|
|
|
+ SubmitCaseInfo data = new();
|
|
|
+ if (dto != null && dto.Order != null && !dto.Order.IsProvince)
|
|
|
+ {
|
|
|
+ data = InitDataAsync(dto.Order);
|
|
|
+ var validator = new SubmitCaseInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ }
|
|
|
+
|
|
|
+ //推送办理记录
|
|
|
+ dto.ExpiredTimeChanged = false;
|
|
|
+
|
|
|
+ //推送办理过程
|
|
|
+ await SubmitCaseProcessFlowAsync(dto, cancellationToken);
|
|
|
+
|
|
|
+ //判断是否是热线中心
|
|
|
+ if (!string.IsNullOrEmpty(dto.Order.ActualHandleOrgCode) && dto.Order.ActualHandleOrgCode == "001")
|
|
|
+ dto.Order.ActualHandleOrgName = "热线中心";
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ //IsProvince 如果是false 则推送服务工单受理
|
|
|
+ if (dto != null && dto.Order != null && !dto.Order.IsProvince)
|
|
|
+ {
|
|
|
+
|
|
|
+ #region 处理请求参数--推送工单数据
|
|
|
+
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseInfo", "submit_case_info", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 10, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //推送服务工单结果信息
|
|
|
+ await SubmitCaseResultAsync(dto, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改工单基础数据
|
|
|
+ var dataOrder = await _dsOrderRepository.GetAsync(p => p.OrderId == dto.Order.Id, cancellationToken);
|
|
|
+ if (dataOrder != null)
|
|
|
+ {
|
|
|
+ dataOrder.HandleState = "办理完成";
|
|
|
+ dataOrder.ActualHandleOrgName = dto.Order.ActualHandleOrgName;
|
|
|
+ dataOrder.ActualHandleOrgCode = dto.Order.ActualHandleOrgCode;
|
|
|
+ dataOrder.ActualHandlerId = dto.Order.ActualHandlerId;
|
|
|
+ dataOrder.ActualHandlerName = dto.Order.ActualHandlerName;
|
|
|
+ dataOrder.ActualOpinion = string.IsNullOrEmpty(dto.Order.ActualOpinion) == false ? dto.Order.ActualOpinion : dto.WorkflowTrace.Opinion;
|
|
|
+ dataOrder.ActualHandleTime = dto.Order.ActualHandleTime;
|
|
|
+ dataOrder.AllDuration = dto.Order.AllDuration;
|
|
|
+ dataOrder.ExpiredTime = dto.Order.ExpiredTime;
|
|
|
+ await _dsOrderRepository.UpdateAsync(dataOrder, cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var order = dto.Order;
|
|
|
+ dataOrder = new()
|
|
|
+ {
|
|
|
+ OrderId = order.Id,
|
|
|
+ OrderNo = order.No,
|
|
|
+ ProvinceNo = order.ProvinceNo,
|
|
|
+ WorkflowId = order.WorkflowId,
|
|
|
+ Password = order.Password,
|
|
|
+ Title = order.Title,
|
|
|
+ FromName = order.FromName,
|
|
|
+ Contact = order.Contact,
|
|
|
+ Content = order.Content,
|
|
|
+ CaseDate = Convert.ToDateTime(order.CreationTime),
|
|
|
+ Source = order.Source.ToString(),
|
|
|
+ CaseSource = order.SourceChannel,
|
|
|
+ CaseSourceCode = order.SourceChannelCode,
|
|
|
+ HotspotId = order.HotspotId,
|
|
|
+ HotspotName = order.HotspotName,
|
|
|
+ HotspotSpliceName = order.HotspotSpliceName,
|
|
|
+ ExpiredTime = order.ExpiredTime,
|
|
|
+ CaseType = order.AcceptType,
|
|
|
+ CaseTypeCode = order.AcceptTypeCode,
|
|
|
+ AllDuration = dto.Order.AllDuration,
|
|
|
+ IsProvince = order.IsProvince,
|
|
|
+ HandleState = "办理完成",
|
|
|
+ ActualHandleOrgName = order.ActualHandleOrgName,
|
|
|
+ ActualHandleOrgCode = order.ActualHandleOrgCode,
|
|
|
+ ActualHandlerId = order.ActualHandlerId,
|
|
|
+ ActualHandlerName = order.ActualHandlerName,
|
|
|
+ ActualOpinion = string.IsNullOrEmpty(order.ActualOpinion) == false ? order.ActualOpinion : dto.WorkflowTrace.Opinion,
|
|
|
+ ActualHandleTime = order.ActualHandleTime,
|
|
|
+ StartTime = order.StartTime,
|
|
|
+ CallId = order.CallId,
|
|
|
+ FileJson = _mapper.Map<List<DataSharing.Share.Dtos.FileJson>>(order.FileJson)
|
|
|
+ };
|
|
|
+
|
|
|
+ await _dsOrderRepository.AddAsync(dataOrder, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ //再次推送通话记录
|
|
|
+ if (dto.TrCallRecordDto is not null)
|
|
|
+ {
|
|
|
+ //如果推送工单的时候判断通话记录是否是未接,并且是否已经上传,如果没有咋补再次推送通话记录
|
|
|
+ var tellCall = await _dsTelCallRepository.AnyAsync(p => p.CallId == dto.TrCallRecordDto.CallAccept, cancellationToken);
|
|
|
+ if (dto.TrCallRecordDto.OnState == EOnState.NoOn && !tellCall)
|
|
|
+ return;
|
|
|
+
|
|
|
+ var dataCall = _mapper.Map<SubmitCaseRecordInfo>(dto.TrCallRecordDto);
|
|
|
+ dataCall.AreaCode = dto.Order.AreaCode.Length > 6 ? dto.Order.AreaCode.Substring(0, 6) : dto.Order.AreaCode;
|
|
|
+ dataCall.CaseSerial = dto.Order.ProvinceNo;
|
|
|
+ if (string.IsNullOrEmpty(dataCall.AccordUrl))
|
|
|
+ dataCall.AccordUrl = "";
|
|
|
+
|
|
|
+ //处理通话记录时间
|
|
|
+ SetCallTime(dataCall);
|
|
|
+
|
|
|
+ var validator = new SubmitCaseRecordInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dataCall, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var requestCall = new ProvinceListRequest<SubmitCaseRecordInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ requestCall.SetData(new List<SubmitCaseRecordInfo>() { dataCall });
|
|
|
+ var jsonDataCall = requestCall.ToString();
|
|
|
+ jsonDataCall = jsonDataCall.Replace("0001-01-01 00:00:00", "");
|
|
|
+ var urlCall = configProvince.HuiJu + "submit_case_record";
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ var taskId = await _initPushDataService.InitPushDataAsync("SubmitCaseRecord", "submit_case_record", jsonDataCall, dataCall.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 20, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //本地保存通话记录数据
|
|
|
+ await InitTelCallData(dto.TrCallRecordDto, dto.Order.ProvinceNo, taskId, cancellationToken);
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 挂电话推送----电话记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SubmitCaseRecordAsync(PublishCallRecrodDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //验证是否需要推送未接数据
|
|
|
+ if (dto != null && dto.TrCallRecordDto != null && dto.TrCallRecordDto.OnState == EOnState.NoOn && dto.Order == null)
|
|
|
+ {
|
|
|
+ if (!await IsPublishMissedCall(dto.TrCallRecordDto, cancellationToken))
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = _mapper.Map<SubmitCaseRecordInfo>(dto.TrCallRecordDto);
|
|
|
+ if (dto.Order != null)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode))
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ else
|
|
|
+ data.AreaCode = dto.Order.AreaCode;
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.Order.ProvinceNo))
|
|
|
+ data.CaseSerial = dto.Order.ProvinceNo;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (data.AreaCode.Contains("519"))
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (data.AreaCode.Length > 6)
|
|
|
+ data.AreaCode = data.AreaCode.Substring(0, 6);
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(data.CaseSerial))
|
|
|
+ data.CaseSerial = "";
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(data.AccordUrl))
|
|
|
+ data.AccordUrl = "";
|
|
|
+
|
|
|
+ //处理通话记录时间
|
|
|
+ SetCallTime(data);
|
|
|
+ var validator = new SubmitCaseRecordInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseRecordInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseRecordInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ jsonData = jsonData.Replace("0001-01-01 00:00:00", "");
|
|
|
+ var url = configProvince.HuiJu + "submit_case_record";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ var startTime = dto.Order == null ? dto.TrCallRecordDto.BeginIvrTime : dto.Order.StartTime;
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ var taskId = await _initPushDataService.InitPushDataAsync("SubmitCaseRecord", "submit_case_record", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 20, GenerationTime: startTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //本地保存通话记录数据
|
|
|
+ await InitTelCallData(dto.TrCallRecordDto, data.CaseSerial, taskId, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 关联工单了推送----电话记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SubmitCaseRecordOrderAsync(PublishCallRecrodDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //如果推送工单的时候判断通话记录是否是未接,并且是否已经上传,如果没有咋补再次推送通话记录
|
|
|
+ var tellCall = await _dsTelCallRepository.AnyAsync(p => p.CallId == dto.TrCallRecordDto.CallAccept, cancellationToken);
|
|
|
+ if (dto.TrCallRecordDto.OnState == EOnState.NoOn && !tellCall)
|
|
|
+ return;
|
|
|
+
|
|
|
+ var data = _mapper.Map<SubmitCaseRecordInfo>(dto.TrCallRecordDto);
|
|
|
+ if (dto.Order != null)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode))
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ else
|
|
|
+ data.AreaCode = dto.Order.AreaCode;
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.Order.ProvinceNo))
|
|
|
+ data.CaseSerial = dto.Order.ProvinceNo;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (data.AreaCode.Contains("519"))
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ if (data.AreaCode.Length > 6)
|
|
|
+ data.AreaCode = data.AreaCode.Substring(0, 6);
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(data.CaseSerial))
|
|
|
+ data.CaseSerial = "";
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(data.AccordUrl))
|
|
|
+ data.AccordUrl = "";
|
|
|
+
|
|
|
+ //处理通话记录时间
|
|
|
+ SetCallTime(data);
|
|
|
+ var validator = new SubmitCaseRecordInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseRecordInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseRecordInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ jsonData = jsonData.Replace("0001-01-01 00:00:00", "");
|
|
|
+ var url = configProvince.HuiJu + "submit_case_record";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ var startTime = dto.Order == null ? dto.TrCallRecordDto.BeginIvrTime : dto.Order.StartTime;
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ var taskId = await _initPushDataService.InitPushDataAsync("SubmitCaseRecord", "submit_case_record", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, taskPriority: 20, GenerationTime: startTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //本地保存通话记录数据
|
|
|
+ await InitTelCallData(dto.TrCallRecordDto, data.CaseSerial, taskId, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 统计数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SubmitCaseTotalAsync(SubmitCaseTotalInfo dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseTotalInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseTotalInfo>() { dto });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_total";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseTotal", "submit_case_total", jsonData, "", pathType: EPathType.HuiJu, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 协同-第三批次
|
|
|
+ /// <summary>
|
|
|
+ /// 上报补充诉求
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SupplyCaseInfoSendAsync(SupplyCaseInfoSendInfo dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ dto.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ dto.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<SupplyCaseInfoSendInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(dto);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "supply_case_info_send";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SupplyCaseInfoSend", "supply_case_info_send", jsonData, dto.CaseSerial, pathType: EPathType.XieTong, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(null, dto.CaseSerial, dto.CliengGuid, EMaterialType.Process, dto.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 撤单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task RevokeOrderAsync(PublishSpecialDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new RevokeCaseInfoModelValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ RevokeCaseInfoModel dsRevoke = new()
|
|
|
+ {
|
|
|
+ CaseSerial = dto.Order.ProvinceNo,
|
|
|
+ AreaCode = dto.Order.AreaCode,
|
|
|
+ RevokeTime = dto.Special.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ RevokeName = dto.Special.CreatorName,
|
|
|
+ RevokeReasion = dto.Special.Reason,
|
|
|
+ CliengGuid = dto.Special.Id
|
|
|
+ };
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(dto.Special.Cause))
|
|
|
+ dsRevoke.RevokeType = "other";
|
|
|
+ else if (dto.Special.Cause.Contains("内容错误"))
|
|
|
+ dsRevoke.RevokeType = "2";
|
|
|
+ else if (dto.Special.Cause == "撤销工单")
|
|
|
+ dsRevoke.RevokeType = "1";
|
|
|
+ else
|
|
|
+ dsRevoke.RevokeType = "other";
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<RevokeCaseInfoModel>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(dsRevoke);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "revoke_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendRevokeCaseInfo", "revoke_case_info", jsonData, dsRevoke.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ await FileDataAsync(dto.Special.FileJson, dto.Order.ProvinceNo, dsRevoke.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单催单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task SendRemindCaseInfoAsync(PublishUrgeDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var validator = new RemindCaseInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<RemindCaseInfoModel>(dto);
|
|
|
+ data.CliengGuid = dto.Urge.Id;
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<RemindCaseInfoModel>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "remind_case_info";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendRemindCaseInfo", "remind_case_info", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.Urge.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 接收发布数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task PublishOrderAsync(PublishPublishOrderDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Order.AreaCode) || dto.Order.Source == ESource.ProvinceStraight || dto.Order.AreaCode.Contains("519"))
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ //政民互动提交公开数据验证
|
|
|
+ if (dto.Order.SourceChannelCode == "SZMHD" && dto.ProPublishState == true)
|
|
|
+ {
|
|
|
+ var validator = new ZmhdCaseInfoPublicInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.Order.IsProvince && dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ {
|
|
|
+ if (dto.Order.RealCommunicationMode == null)
|
|
|
+ dto.Order.RealCommunicationMode = ERealCommunicationMode.Phone;
|
|
|
+
|
|
|
+ var validator = new CaseResultReceiveValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ #region 服务工单交办处理结果
|
|
|
+ //判断是否是热线中心
|
|
|
+ if (!string.IsNullOrEmpty(dto.Order.ActualHandleOrgCode) && dto.Order.ActualHandleOrgCode == "001")
|
|
|
+ dto.Order.ActualHandleOrgName = "热线中心";
|
|
|
+
|
|
|
+ ///如果是省上派下来的,直接将区域设置为宜宾市
|
|
|
+ if (dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var data = _mapper.Map<GetCaseResultReceiveInfo>(dto.Order);
|
|
|
+ data.ConcactType = "40";
|
|
|
+ data.FinishType = "1";
|
|
|
+ data.HandleTimeLong = (decimal)dto.Order.AllDuration;
|
|
|
+ data.ConcactType = dto.Order.RealCommunicationMode switch
|
|
|
+ {
|
|
|
+ ERealCommunicationMode.Phone => "10",
|
|
|
+ ERealCommunicationMode.Locale => "20",
|
|
|
+ _ => "40",
|
|
|
+ };
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+
|
|
|
+ //中国政府网的数据处理
|
|
|
+ if (dto.Order.ProvinceNo.Contains("ZGZFW"))
|
|
|
+ {
|
|
|
+ data.Notes = dto.Remark;
|
|
|
+ data.MsgOpenByArea = dto.ProPublishState == true ? "1" : "0";
|
|
|
+ data.AreaNotPublicReason = dto.NoPubReason;
|
|
|
+ data.FeedBackAnswerContent = dto.ArrangeOpinion;
|
|
|
+ data.FeedBackTel = dto.FeedBackPhone;
|
|
|
+ data.EventType = "";
|
|
|
+ data.Eventname = "";
|
|
|
+ data.ContactFlag = dto.IsContact == true ? "1" : "0";
|
|
|
+ data.AssessFlag = dto.IsVisited == true ? "1" : "0";
|
|
|
+ data.AssessContent = dto.EvaluateContent;
|
|
|
+ if (dto.NetizenEvaluate != null)
|
|
|
+ {
|
|
|
+ data.AssessOpinion = dto.NetizenEvaluate.Value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<GetCaseResultReceiveInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "get_case_result_receive";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetCaseResultReceive", "get_case_result_receive", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(null, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Result, dto.Order.AreaCode, cancellationToken);
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+
|
|
|
+ //政民互动提交公开
|
|
|
+ if (dto.Order.SourceChannelCode == "SZMHD" && dto.ProPublishState == true)
|
|
|
+ {
|
|
|
+ var data = _mapper.Map<ZmhdCaseInfoPublicInfo>(dto);
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<ZmhdCaseInfoPublicInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "zmhd_case_info_public";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("ZmhdCaseInfoPublic", "zmhd_case_info_public", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 接收发布的时候生成的待回访部门数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task PublishVisitAllAsync(PublishVisitAllDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (dto != null)
|
|
|
+ {
|
|
|
+ List<DsOrderVisit> orderVisits = new List<DsOrderVisit>();
|
|
|
+ //1、待回访和已回访要将接收的数据写入库
|
|
|
+ //2、其他状态的时候需要将工单的回访状态改成不能回访
|
|
|
+
|
|
|
+ //处理待回访和已回访的数据
|
|
|
+ if (dto.VisitState == EVisitState.WaitForVisit || dto.VisitState == EVisitState.Visited)
|
|
|
+ {
|
|
|
+ if (dto.OrderVisitDetails != null && dto.OrderVisitDetails.Count > 0)
|
|
|
+ {
|
|
|
+ //组装回访数据
|
|
|
+ foreach (var item in dto.OrderVisitDetails)
|
|
|
+ {
|
|
|
+ DsOrderVisit dsOrderVisit = new()
|
|
|
+ {
|
|
|
+ OrderId = dto.Order.Id,
|
|
|
+ VisitDetailId = item.Id,
|
|
|
+ VisitId = item.VisitId,
|
|
|
+ VoiceEvaluate = item.VoiceEvaluate.ToString(),
|
|
|
+ SeatEvaluate = item.SeatEvaluate.ToString(),
|
|
|
+ OrgProcessingResults = _mapper.Map<Kv>(item.OrgProcessingResults),
|
|
|
+ OrgNoSatisfiedReason = _mapper.Map<List<Kv>>(item.OrgNoSatisfiedReason),
|
|
|
+ OrgHandledAttitude = _mapper.Map<Kv>(item.OrgHandledAttitude),
|
|
|
+ VisitContent = item.VisitContent,
|
|
|
+ VisitOrgName = item.VisitOrgName,
|
|
|
+ VisitOrgCode = item.VisitOrgCode,
|
|
|
+ VisitTarget = item.VisitTarget.ToString(),
|
|
|
+ VisitType = dto.VisitType.ToString(),
|
|
|
+ VisitTime = dto.VisitTime,
|
|
|
+ IsEffective = true
|
|
|
+ };
|
|
|
+ orderVisits.Add(dsOrderVisit);
|
|
|
+ }
|
|
|
+
|
|
|
+ //// 方式一: 保留数据
|
|
|
+ //var tempList = await _dsOrderVisitRepository.Queryable().Where(p => p.OrderId == dto.Order.Id && p.IsEffective == true).ToListAsync();
|
|
|
+ //foreach (var item in tempList)
|
|
|
+ //{
|
|
|
+ // item.IsEffective = false;
|
|
|
+ // await _dsOrderVisitRepository.UpdateAsync(item, cancellationToken);
|
|
|
+ //}
|
|
|
+ //方式二:直接删除原始数据
|
|
|
+ await _dsOrderVisitRepository.RemoveAsync(p => p.OrderId == dto.Order.Id);
|
|
|
+
|
|
|
+ //写入新数据
|
|
|
+ await _dsOrderVisitRepository.AddRangeAsync(orderVisits, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理是否可以评价,如果是
|
|
|
+ var orderData = await _dsOrderRepository.GetAsync(p => p.OrderId == dto.Order.Id);
|
|
|
+ if (orderData is not null)
|
|
|
+ {
|
|
|
+ var tempState = orderData.VisitTypeState;
|
|
|
+ switch (dto.VisitState)
|
|
|
+ {
|
|
|
+ case EVisitState.WaitForVisit:
|
|
|
+ orderData.VisitTypeState = DataSharing.Share.Enums.EVisitTypeState.Visit;
|
|
|
+ break;
|
|
|
+ case EVisitState.Visited:
|
|
|
+ orderData.VisitTypeState = DataSharing.Share.Enums.EVisitTypeState.Reviewed;
|
|
|
+ break;
|
|
|
+ case EVisitState.Visiting:
|
|
|
+ case EVisitState.NoSatisfiedWaitForVisit:
|
|
|
+ case EVisitState.None:
|
|
|
+ orderData.VisitTypeState = DataSharing.Share.Enums.EVisitTypeState.UnVisit;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (tempState != orderData.VisitTypeState)
|
|
|
+ await _dsOrderRepository.UpdateAsync(orderData, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 往省上派单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SendCaseInfoDataAsync(OrderDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //先上传拓展信息
|
|
|
+ if (dto.OrderExtension != null)
|
|
|
+ await SubmitCaseExtendsAsync(dto, cancellationToken);
|
|
|
+
|
|
|
+ //在处理工单信息
|
|
|
+ var sendCaseInfo = _mapper.Map<SendCaseInfo>(dto);
|
|
|
+
|
|
|
+ if (dto.OrderExtension != null)
|
|
|
+ sendCaseInfo.IsExtends = "1";
|
|
|
+ else
|
|
|
+ sendCaseInfo.IsExtends = "0";
|
|
|
+
|
|
|
+ #region 处理数据
|
|
|
+ //处理性别
|
|
|
+ switch (dto.FromGender)
|
|
|
+ {
|
|
|
+ case EGender.Female:
|
|
|
+ sendCaseInfo.AppLicantSex = "0";
|
|
|
+ break;
|
|
|
+ case EGender.Male:
|
|
|
+ sendCaseInfo.AppLicantSex = "1";
|
|
|
+ break;
|
|
|
+ case EGender.Unknown:
|
|
|
+ sendCaseInfo.AppLicantSex = "2";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ sendCaseInfo.AppLicantSex = "2";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理证件类型
|
|
|
+ sendCaseInfo.CertifiCateType = dto.LicenceTypeCode switch
|
|
|
+ {
|
|
|
+ "10" => "10",
|
|
|
+ "40" => "20",
|
|
|
+ "55" => "30",
|
|
|
+ "57" => "40",
|
|
|
+ _ => "50",
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理紧急程度
|
|
|
+ sendCaseInfo.CaseIsUrgent = dto.EmergencyLevel switch
|
|
|
+ {
|
|
|
+ EEmergencyLevel.QuiteEmergency => "10",
|
|
|
+ EEmergencyLevel.Emergency => "20",
|
|
|
+ _ => "30",
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理诉求类型
|
|
|
+ switch (sendCaseInfo.CaseType)
|
|
|
+ {
|
|
|
+ case "10":
|
|
|
+ case "15":
|
|
|
+ case "20":
|
|
|
+ case "25":
|
|
|
+ case "30":
|
|
|
+ case "35":
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ sendCaseInfo.CaseType = "40";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ switch (dto.SourceChannelCode.ToUpper())
|
|
|
+ {
|
|
|
+ case "RGDH":
|
|
|
+ case "WX":
|
|
|
+ case "WB":
|
|
|
+ case "AP":
|
|
|
+ case "WZ":
|
|
|
+ case "YJ":
|
|
|
+ case "SCZWFWW":
|
|
|
+ case "XCX":
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ sendCaseInfo.CaseSource = "QT";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ sendCaseInfo.CaseSource = sendCaseInfo.CaseSource;
|
|
|
+
|
|
|
+ var sendCaseInfoData = _mapper.Map<DsSendCaseInfo>(sendCaseInfo);
|
|
|
+ sendCaseInfoData.OrderID = dto.Id;
|
|
|
+ sendCaseInfoData.No = dto.No;
|
|
|
+ await _sendCaseInfoRepository.AddAsync(sendCaseInfoData, cancellationToken);
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<SendCaseInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(sendCaseInfo);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "send_case_info";
|
|
|
+ #endregion
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendCaseInfo", "send_case_info", jsonData, sendCaseInfo.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.FileJson, dto.ProvinceNo, sendCaseInfoData.CliengGuid, EMaterialType.Acceptance, sendCaseInfoData.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 汇聚-第四批次--已处理
|
|
|
+
|
|
|
+ #region 知识库
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库上报
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task GetKnowledgeInfoSendAsync(KnowledgeSendDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var validator = new KnowledgeInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<KnowledgeInfoSendInfo>(dto);
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+ if (data.DisableDate == null)//如果没得有失效时间,默认在生效日期上面加10年
|
|
|
+ data.DisableDate = data.BeginDate.Value.AddYears(10);
|
|
|
+
|
|
|
+ data.CategoryCode = "01";
|
|
|
+ data.CategoryName = "公共服务";
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<KnowledgeInfoSendInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "get_knowledge_info_send";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetKnowledgeInfoSend", "get_knowledge_info_send", jsonData, data.UID, pathType: EPathType.HuiJu, GenerationTime: dto.CreatDate, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ #region 处理知识库原始数据
|
|
|
+ //查询原有数据,如果有修改原始数据,没有直接新增
|
|
|
+ var dataRaw = await _knowledgeRawDataRepository.GetAsync(p => p.UID == data.UID);
|
|
|
+ var raw = _mapper.Map<DsKnowledgeRawData>(data);
|
|
|
+ if (dataRaw != null)
|
|
|
+ {
|
|
|
+ raw.Id = dataRaw.Id;
|
|
|
+ await _knowledgeRawDataRepository.UpdateAsync(raw, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ await _knowledgeRawDataRepository.AddAsync(raw, cancellationToken: cancellationToken);
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //知识附件处理
|
|
|
+ await FileDataAsync(dto.FileJson, dto.UID, data.CliengGuid, EMaterialType.Knowledge, data.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库变更
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task GetKnowledgeInfoUpdateAsync(KnowledgeSendDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var validator = new KnowledgeInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<GetKnowledgeInfoUpdateInfo>(dto);
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+ if (data.DisableDate == null)//如果没得有失效时间,默认在生效日期上面加10年
|
|
|
+ data.DisableDate = data.BeginDate.Value.AddYears(10);
|
|
|
+ data.CategoryCode = "01";
|
|
|
+ data.CategoryName = "公共服务";
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<GetKnowledgeInfoUpdateInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "get_knowledge_info_update";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetKnowledgeInfoUpdate", "get_knowledge_info_update", jsonData, data.UID, pathType: EPathType.HuiJu, GenerationTime: dto.CreatDate, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ #region 处理知识库原始数据
|
|
|
+ //查询原有数据,如果有修改原始数据,没有直接新增
|
|
|
+ var dataRaw = await _knowledgeRawDataRepository.GetAsync(p => p.UID == data.UID);
|
|
|
+ var raw = _mapper.Map<DsKnowledgeRawData>(data);
|
|
|
+ if (dataRaw != null)
|
|
|
+ {
|
|
|
+ raw.Id = dataRaw.Id;
|
|
|
+ await _knowledgeRawDataRepository.UpdateAsync(raw, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ await _knowledgeRawDataRepository.AddAsync(raw, cancellationToken: cancellationToken);
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //知识附件处理
|
|
|
+ await FileDataAsync(dto.FileJson, dto.UID, data.CliengGuid, EMaterialType.Knowledge, data.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库下架
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ public async Task GetKnowledgeInfoAbandonAsync(KnowledgeSendDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var validator = new KnowledgeInfoAbandonValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(dto, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ var data = _mapper.Map<GetKnowledgeInfoAbandonInfo>(dto);
|
|
|
+ data.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+ data.CategoryCode = "01";
|
|
|
+ data.CategoryName = "公共服务";
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<GetKnowledgeInfoAbandonInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "get_knowledge_info_abandon";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetKnowledgeInfoAbandon", "get_knowledge_info_abandon", jsonData, data.UID, pathType: EPathType.HuiJu, GenerationTime: dto.CreatDate, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //知识下架删除原有原始数据
|
|
|
+ await _knowledgeRawDataRepository.RemoveAsync(p => p.UID == data.UID, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 实时服务上报
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SendRealTimeStatusAsync(SendRealTimeStatusInfo dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ dto.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<SendRealTimeStatusInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(dto);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "sendrealtimestatus";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ await _initPushDataService.InitPushDataAsync("SendRealTimeStatus", "sendrealtimestatus", jsonData, "", pathType: EPathType.HuiJu, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 私有方法
|
|
|
+
|
|
|
+ #region 省数据处理
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热线工单办理---服务工单处理/服务工单交办处理过程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ private async Task SubmitCaseProcessFlowAsync(OrderFlowDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //判断是否是热线中心
|
|
|
+ if (!string.IsNullOrEmpty(dto.Order.ActualHandleOrgCode) && dto.Order.ActualHandleOrgCode == "001")
|
|
|
+ dto.Order.ActualHandleOrgName = "热线中心";
|
|
|
+
|
|
|
+ #region 写本地办理数据-用于查询办理流程
|
|
|
+ //写本地办理数据-用于查询办理流程
|
|
|
+ var orderWorkFlow = _mapper.Map<DsOrderWorkFlow>(dto.WorkflowTrace);
|
|
|
+ orderWorkFlow.OrderId = dto.Order.Id;
|
|
|
+
|
|
|
+ await _dataOrderWorkFlowRepository.AddAsync(orderWorkFlow, cancellationToken);
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+
|
|
|
+ ///如果是省上派下来的,直接将区域设置为宜宾市
|
|
|
+ if (dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ //省上下来的工单走协同的接口
|
|
|
+ if (dto.Order.Source == ESource.ProvinceStraight && dto.Order.IsProvince)
|
|
|
+ {
|
|
|
+ var data = _mapper.Map<GetCaseProcessReceiveInfo>(dto);
|
|
|
+ data.TacheName = "70:" + data.DeptName;
|
|
|
+ var validator = new GetCaseProcessReceiveInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+ #region 处理请求参数
|
|
|
+ var request = new ProvinceRequest<GetCaseProcessReceiveInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(data);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.XieTong + "get_case_process_receive";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetCaseProcessReceive", "get_case_process_receive", jsonData, data.CaseSerial, pathType: EPathType.XieTong, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.WorkflowTrace.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+ else //如果不是省上派下来的工单
|
|
|
+ {
|
|
|
+ //本地工单走市州接口
|
|
|
+ var data = _mapper.Map<SubmitCaseProcessInfo>(dto);
|
|
|
+ data.TacheName = "70:" + data.DeptName;
|
|
|
+
|
|
|
+ var validator = new SubmitCaseProcessInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var requestSubmitCaseProcessInfo = new ProvinceListRequest<SubmitCaseProcessInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ requestSubmitCaseProcessInfo.SetData(new List<SubmitCaseProcessInfo>() { data });
|
|
|
+ var jsonDataSubmitCaseProcessInfo = requestSubmitCaseProcessInfo.ToString();
|
|
|
+ var urlSubmitCaseProcessInfo = configProvince.HuiJu + "submit_case_process";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseProcess", "submit_case_process", jsonDataSubmitCaseProcessInfo, data.CaseSerial, pathType: EPathType.HuiJu, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ await FileDataAsync(dto.WorkflowTrace.FileJson, dto.Order.ProvinceNo, data.CliengGuid, EMaterialType.Process, dto.Order.AreaCode, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ ////这里判断是否需要往其他平台推送数据
|
|
|
+ //await OrderDispatchAsync(dto, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task SubmitCaseResultAsync(OrderFlowDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ ///如果是省上派下来的,直接将区域设置为宜宾市
|
|
|
+ if (dto.Order.Source == ESource.ProvinceStraight)
|
|
|
+ dto.Order.AreaCode = _sharingConfigurationManager.GetCityCode();
|
|
|
+
|
|
|
+ var data = _mapper.Map<SubmitCaseResultInfo>(dto);
|
|
|
+ data.ConcactType = "40";
|
|
|
+ data.FinishType = "1";
|
|
|
+ data.HandleTimeLong = (int)dto.Order.AllDuration;
|
|
|
+ data.CliengGuid = Guid.NewGuid().ToString();
|
|
|
+
|
|
|
+ //宜宾工单不超期,如果在推送省上数据时,实际办理时间大于过期时间,则将办理时间改成过期时间减2个小时
|
|
|
+ if (_sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
|
|
|
+ {
|
|
|
+ if (dto.Order.ExpiredTime < dto.Order.ActualHandleTime)
|
|
|
+ {
|
|
|
+ var finishTime = dto.Order.ExpiredTime.Value.AddHours(-2);
|
|
|
+ data.FinishTime = finishTime;
|
|
|
+ data.FdBackTime = finishTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var validator = new SubmitCaseResultInfoValidator();
|
|
|
+ var validResult = await validator.ValidateAsync(data, cancellationToken);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ throw new UserFriendlyException(string.Join(',', validResult.Errors.Select(d => d.ErrorMessage)));
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceListRequest<SubmitCaseResultInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(new List<SubmitCaseResultInfo>() { data });
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_result";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseResult", "submit_case_result", jsonData, data.CaseSerial, pathType: EPathType.HuiJu, GenerationTime: dto.Order.StartTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //处理附件
|
|
|
+ if (dto.WorkflowTrace != null && dto.WorkflowTrace.FileJson != null && dto.WorkflowTrace.FileJson.Count > 0)
|
|
|
+ await FileDataAsync(dto.WorkflowTrace.FileJson, data.CaseSerial, data.CliengGuid, EMaterialType.Result, dto.Order.AreaCode, cancellationToken);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单创建数据处理
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private SubmitCaseInfo InitDataAsync(OrderDto dto)
|
|
|
+ {
|
|
|
+ var submitCaseInfo = _mapper.Map<SubmitCaseInfo>(dto);
|
|
|
+
|
|
|
+ //处理性别
|
|
|
+ submitCaseInfo.AppLicantSex = dto.FromGender switch
|
|
|
+ {
|
|
|
+ EGender.Female => "0",
|
|
|
+ EGender.Male => "1",
|
|
|
+ EGender.Unknown => "2",
|
|
|
+ _ => "2",
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理证件类型
|
|
|
+ submitCaseInfo.CertifiCateType = dto.LicenceTypeCode switch
|
|
|
+ {
|
|
|
+ "10" => "10",
|
|
|
+ "40" => "20",
|
|
|
+ "55" => "30",
|
|
|
+ "57" => "40",
|
|
|
+ _ => "50",
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理紧急程度
|
|
|
+ submitCaseInfo.CaseIsUrgent = dto.EmergencyLevel switch
|
|
|
+ {
|
|
|
+ EEmergencyLevel.QuiteEmergency => "10",
|
|
|
+ EEmergencyLevel.Emergency => "20",
|
|
|
+ _ => "30",
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理诉求类型
|
|
|
+ switch (submitCaseInfo.CaseType)
|
|
|
+ {
|
|
|
+ case "10":
|
|
|
+ case "15":
|
|
|
+ case "20":
|
|
|
+ case "25":
|
|
|
+ case "30":
|
|
|
+ case "35":
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ submitCaseInfo.CaseType = "40";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ submitCaseInfo.CaseValid = "1";
|
|
|
+ submitCaseInfo.CaseIsPublic = string.IsNullOrEmpty(submitCaseInfo.CaseIsPublic) == true ? "0" : submitCaseInfo.CaseIsPublic;
|
|
|
+ submitCaseInfo.ThemeSerial = "20";
|
|
|
+
|
|
|
+ if (dto.SourceChannelCode == "SZMHD" && dto.IsProvince == false && dto.Source == ESource.ProvinceStraight)
|
|
|
+ submitCaseInfo.TrowGuid = "【政民互动直派】";
|
|
|
+
|
|
|
+ switch (dto.SourceChannelCode.ToUpper())
|
|
|
+ {
|
|
|
+ case "RGDH":
|
|
|
+ case "WX":
|
|
|
+ case "WB":
|
|
|
+ case "AP":
|
|
|
+ case "WZ":
|
|
|
+ case "YJ":
|
|
|
+ case "SCZWFWW":
|
|
|
+ case "XCX":
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ submitCaseInfo.CaseSource = "QT";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return submitCaseInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 服务工单拓展信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task SubmitCaseExtendsAsync(OrderDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var orderExtension = dto.OrderExtension;
|
|
|
+ if (orderExtension is null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ //工单类型
|
|
|
+ string formType = orderExtension.OrderTypeCode;
|
|
|
+
|
|
|
+ //处理为统一的市场监管表单
|
|
|
+ if (formType == "scjgjts" || formType == "scjgjjb")
|
|
|
+ formType = "scjgj";
|
|
|
+
|
|
|
+ DataSharing.Share.Dtos.Province.HuiJu.SubmitCaseExtendsInfo submitCaseExtendsInfo = new()
|
|
|
+ {
|
|
|
+ CaseSerial = dto.ProvinceNo,
|
|
|
+ FormType = formType
|
|
|
+ };
|
|
|
+
|
|
|
+ //处理扩展信息
|
|
|
+ switch (formType.ToLower())
|
|
|
+ {
|
|
|
+ case "yl"://医疗表单
|
|
|
+ //转换数据
|
|
|
+ submitCaseExtendsInfo.FormMedical = _mapper.Map<FormMedicalInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "zwfw"://四川政务服务网技术工单
|
|
|
+ submitCaseExtendsInfo.FormNetWorktec = _mapper.Map<FormNetWorktecInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "th"://电视购物及商铺购买退换货工单
|
|
|
+ submitCaseExtendsInfo.FormReturnexChange = _mapper.Map<FormReturnexChangeInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "gsgl"://高速公路工单
|
|
|
+ submitCaseExtendsInfo.FormExpressWay = _mapper.Map<FormExpressWayInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "xjgg"://电视台虚假广告工单
|
|
|
+ submitCaseExtendsInfo.FormShamPub = _mapper.Map<FormShamPubInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "swfwsq"://12366热线诉求交办
|
|
|
+ submitCaseExtendsInfo.FormTaxationComplaint = _mapper.Map<FormTaxationComplaintInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "swfwzx"://12366热线咨询交办
|
|
|
+ submitCaseExtendsInfo.FormTaxationConsulting = _mapper.Map<FormTaxationConsultingInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "jtfwjd"://12328服务监督
|
|
|
+ submitCaseExtendsInfo.FormTraffic = _mapper.Map<FormTrafficInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "yzxf"://邮政业消费者申诉
|
|
|
+ submitCaseExtendsInfo.FormPost = _mapper.Map<FormPostInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "hbjb"://环保举报业务
|
|
|
+ submitCaseExtendsInfo.FormEnvironMent = _mapper.Map<FormEnvironMentInfo>(orderExtension);
|
|
|
+ break;
|
|
|
+ case "scjgj"://12315个性化表单
|
|
|
+ var formMarket = _mapper.Map<FormMarketInfo>(orderExtension);
|
|
|
+ //转换数据
|
|
|
+ switch (orderExtension.OrderTypeCode)
|
|
|
+ {
|
|
|
+ case "scjgjjb":
|
|
|
+ formMarket.Rqsttypy = "25";
|
|
|
+ break;
|
|
|
+ case "scjgjts":
|
|
|
+ formMarket.Rqsttypy = "20";
|
|
|
+ foreach (var item in orderExtension.ComplainTypes)
|
|
|
+ formMarket.AppealContent += item.Value + ",";
|
|
|
+ formMarket.AppealContent = formMarket.AppealContent.TrimEnd(',');
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ formMarket.HandDepCode = dto.AcceptorOrgCode;
|
|
|
+ formMarket.HandDep = dto.AcceptorOrgName;
|
|
|
+ formMarket.Zxgh = dto.AcceptorStaffNo;
|
|
|
+ formMarket.AccregperId = dto.AcceptorId;
|
|
|
+ formMarket.AccregperName = dto.AcceptorName;
|
|
|
+ formMarket.RegTime = Convert.ToDateTime(dto.CreationTime);
|
|
|
+ formMarket.CmTime = dto.StartTime;
|
|
|
+ submitCaseExtendsInfo.FormMarket = formMarket;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 处理请求参数
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<DataSharing.Share.Dtos.Province.HuiJu.SubmitCaseExtendsInfo>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(submitCaseExtendsInfo);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+ var url = configProvince.HuiJu + "submit_case_extends";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //将待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("SubmitCaseExtends", "submit_case_extends", jsonData, submitCaseExtendsInfo.CaseSerial, pathType: EPathType.HuiJu, GenerationTime: dto.StartTime, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 附件处理
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="fileJson">附件</param>
|
|
|
+ /// <param name="caseSerial">工单编号</param>
|
|
|
+ /// <param name="cliengGuid">附件ID</param>
|
|
|
+ /// <param name="materialType">附件类型 10:受理材料,20:环节材料,30:结果材料,40:回访评价材料,50:督办材料,60:知识库材料</param>
|
|
|
+ /// <param name="areaCode">区域ID</param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task FileDataAsync(List<Hotline.Share.Dtos.File.FileJson> fileJson, string caseSerial, string cliengGuid, EMaterialType materialType, string areaCode, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (fileJson != null && fileJson.Count > 0)
|
|
|
+ {
|
|
|
+ //将受到的数据写入本地数据库
|
|
|
+ GetCaseMaterialInfoModel materialInfo = new()
|
|
|
+ {
|
|
|
+ CaseSerial = caseSerial,
|
|
|
+ CliengGuid = cliengGuid,
|
|
|
+ AreaCode = areaCode.Length > 6 ? areaCode.Substring(0, 6) : areaCode,
|
|
|
+ MaterialType = materialType switch
|
|
|
+ {
|
|
|
+ EMaterialType.Acceptance => "10",
|
|
|
+ EMaterialType.Process => "20",
|
|
|
+ EMaterialType.Result => "30",
|
|
|
+ EMaterialType.Visit => "40",
|
|
|
+ EMaterialType.Supervise => "50",
|
|
|
+ EMaterialType.Knowledge => "60",
|
|
|
+ _ => "20",
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var configProvince = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ var request = new ProvinceRequest<GetCaseMaterialInfoModel>(configProvince.ClientId, configProvince.ClientSecret);
|
|
|
+ request.SetData(materialInfo);
|
|
|
+ var jsonData = request.ToString();
|
|
|
+
|
|
|
+ foreach (var item in fileJson)
|
|
|
+ {
|
|
|
+ List<FileJson> fileJsons = new() { _mapper.Map<FileJson>(item) };
|
|
|
+
|
|
|
+ //待推送数据写入待推送表
|
|
|
+ await _initPushDataService.InitPushDataAsync("GetCaseMaterialInfo", "get_case_material_info", jsonData, materialInfo.CaseSerial, pathType: EPathType.File, fileJson: fileJsons, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 处理通话记录队列时间
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="recordInfo"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private void SetCallTime(SubmitCaseRecordInfo recordInfo)
|
|
|
+ {
|
|
|
+ // 电话进入顺序 进IVR时间→进队列时间→振铃时间→开始时间→结束时间
|
|
|
+
|
|
|
+ //进入IVR时间为空
|
|
|
+ if (recordInfo.InIvr == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ if (recordInfo.InQueue == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ if (recordInfo.CallStart == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ recordInfo.CallStart = recordInfo.CallEnd.AddSeconds(-2);
|
|
|
+ }
|
|
|
+ recordInfo.InQueue = recordInfo.CallStart.AddSeconds(-2);
|
|
|
+ }
|
|
|
+ recordInfo.InIvr = recordInfo.InQueue.AddSeconds(-2);
|
|
|
+ }
|
|
|
+
|
|
|
+ //进入队列时间为空
|
|
|
+ if (recordInfo.InQueue == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ if (recordInfo.InIvr == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ if (recordInfo.CallStart == DateTime.MinValue)
|
|
|
+ {
|
|
|
+ recordInfo.CallStart = recordInfo.CallEnd.AddSeconds(-2);
|
|
|
+ }
|
|
|
+ recordInfo.InQueue = recordInfo.CallStart.AddSeconds(-2);
|
|
|
+ recordInfo.InIvr = recordInfo.InQueue.AddSeconds(-2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ recordInfo.InQueue = recordInfo.InIvr.AddSeconds(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ //振铃时间为空
|
|
|
+ if (recordInfo.CallTime == DateTime.MinValue && recordInfo.CallStart != DateTime.MinValue)
|
|
|
+ recordInfo.CallTime = recordInfo.CallStart.AddSeconds(-2);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 检查是否需要推送未接通话记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<bool> IsPublishMissedCall(TrCallDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var key = MissedCallKey + DateTime.Now.ToString("yyyyMMdd");
|
|
|
+ int missedCallCount;
|
|
|
+ //获取系统配置
|
|
|
+ var configurationInformation = await _configurationInformationCache.GetAsync(ConstantSettings.ConfigurationInformationCacheKey, cancellationToken);
|
|
|
+ if (configurationInformation == null)
|
|
|
+ {
|
|
|
+ //获取配置信息
|
|
|
+ var provinceConfiguration = _channelConfigurationManager.GetConfigurationProvince();
|
|
|
+ missedCallCount = provinceConfiguration.MissedCallCount;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ missedCallCount = configurationInformation.MissedCallCount;
|
|
|
+
|
|
|
+
|
|
|
+ var dataCache = await _missedCallModelCache.GetAsync(key, cancellationToken);
|
|
|
+ if (dataCache != null)
|
|
|
+ {
|
|
|
+ //如果存在值,检查是否已经达到推送最大值
|
|
|
+ if (!dataCache.IsMax && dataCache.DateTimeList.Count > 0)
|
|
|
+ {
|
|
|
+ //没有达到最大值
|
|
|
+ //检查第一条数据是否匹配当前推送时间
|
|
|
+ var list = dataCache.DateTimeList;
|
|
|
+ if (list[0] < dto.OverTime)
|
|
|
+ {
|
|
|
+ //处理数据
|
|
|
+ list.RemoveAt(0);
|
|
|
+
|
|
|
+ dataCache.DateTimeList = list;
|
|
|
+ //是否推送完成
|
|
|
+ if (list == null || list.Count == 0)
|
|
|
+ dataCache.IsMax = true;
|
|
|
+
|
|
|
+ //从新写入数据
|
|
|
+ await _missedCallModelCache.SetAsync(key, dataCache, TimeSpan.FromDays(1), cancellationToken);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ #region 生成时间
|
|
|
+ //生成时间
|
|
|
+ List<DateTime> timeLists = new();
|
|
|
+ Random random = new((int)(DateTime.Now.Ticks));
|
|
|
+ for (int i = 0; i < missedCallCount; i++)
|
|
|
+ {
|
|
|
+ int hour = random.Next(2, 23);
|
|
|
+ int minute = random.Next(0, 60);
|
|
|
+ int second = random.Next(0, 60);
|
|
|
+ string tempStr = string.Format("{0} {1}:{2}:{3}", DateTime.Now.ToString("yyyy-MM-dd"), hour, minute, second);
|
|
|
+ DateTime rTime = Convert.ToDateTime(tempStr);
|
|
|
+ timeLists.Add(rTime);
|
|
|
+ }
|
|
|
+ timeLists.Sort();
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (timeLists[0] < dto.OverTime)
|
|
|
+ //处理数据
|
|
|
+ timeLists.RemoveAt(0);
|
|
|
+
|
|
|
+ MissedCallModelDto missedCall = new()
|
|
|
+ {
|
|
|
+ DateTimeList = timeLists
|
|
|
+ };
|
|
|
+ if (timeLists == null || timeLists.Count == 0)
|
|
|
+ missedCall.IsMax = true;
|
|
|
+
|
|
|
+ await _missedCallModelCache.SetAsync(key, missedCall, TimeSpan.FromDays(1), cancellationToken);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化上传通话记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="ProvinceNo"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task InitTelCallData(TrCallDto dto, string ProvinceNo, string taskId, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var tellCall = await _dsTelCallRepository.GetAsync(p => p.CallId == dto.CallAccept, cancellationToken);
|
|
|
+ if (tellCall != null)
|
|
|
+ {
|
|
|
+ //修改
|
|
|
+ _mapper.Map(dto, tellCall);
|
|
|
+ tellCall.ProvinceNo = ProvinceNo;
|
|
|
+ tellCall.CallId = dto.CallAccept;
|
|
|
+ tellCall.TaskId = taskId;
|
|
|
+ await _dsTelCallRepository.UpdateAsync(tellCall, cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //新增
|
|
|
+ tellCall = new DsTelCall();
|
|
|
+ tellCall = _mapper.Map<DsTelCall>(dto);
|
|
|
+ tellCall.ProvinceNo = ProvinceNo;
|
|
|
+ tellCall.CallId = dto.CallAccept;
|
|
|
+ tellCall.TaskId = taskId;
|
|
|
+ await _dsTelCallRepository.AddAsync(tellCall, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+}
|