using DotNetCore.CAP;
using Hotline.Share.Dtos.Knowledge;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.Order;
using MapsterMapper;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Sharing.Application;
using Sharing.Notifications.HuiJu;
using Sharing.Notifications.Knowledge;
using Sharing.Notifications.XieTong;
using Sharing.Orders;
using Sharing.Province.Dtos.HuiJu.Send;
using Sharing.Province.Dtos.XieTong.Send;
using Sharing.Province.HuiJu.Send;
using Sharing.Province.XieTong.Knowledge;
using Sharing.Province.XieTong.Receive;
using Sharing.Province.XieTong.Send;
using XF.Domain.Repository;
namespace Sharing.Api.Controllers
{
///
///
///
public class HotlineMessageReceiveController : Controller
{
#region 注入
private readonly IMediator _mediator;
private readonly ILogger _logger;
private readonly IMapper _mapper;
private readonly IRepository _getCaseResultReceiveRepository;
private readonly IRepository _getCaseProcessReceiveRepository;
private readonly IRepository _getVisitInfoReceiveRepository;
private readonly IRepository _getCaseBackApplyRepository;
private readonly IRepository _delayCaseInfoSendRepository;
private readonly IRepository _sendSuperviseProcessInfoRepository;
private readonly IRepository _sendSuperviseResultInfoRepository;
private readonly IRepository _submitCaseRecordRepository;
private readonly IRepository _submitCaseTotalRepository;
private readonly IRepository _sendCaseInfoRepository;
private readonly IRepository _supplyCaseInfoSendRepository;
private readonly IRepository _revokeCaseInfoRepository;
private readonly IRepository _remindCaseInfoRepository;
private readonly IRepository _getKnowledgeInfoSendRepository;
private readonly IRepository _getKnowledgeInfoUpdateRepository;
private readonly IRepository _getKnowledgeInfoAbandonRepository;
private readonly IRepository _sendRealTimeStatusRepository;
private readonly IRepository _screenCaseInfoSendRepository;
private readonly IRepository _zMHDCaseInfoPublicRepository;
private readonly IProvinceService _provinceService;
private readonly IRepository _knowledgeRawDataRepository;
private readonly IChannelConfigurationManager _channelConfigurationManager;
private readonly IDataOrderRepository _dataOrderRepository;
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
public HotlineMessageReceiveController(IMediator mediator,
ILogger logger,
IMapper mapper,
IRepository getCaseResultReceiveRepository,
IRepository getCaseProcessReceiveRepository,
IRepository getVisitInfoReceiveRepository,
IRepository getCaseBackApplyRepository,
IRepository delayCaseInfoSendRepository,
IRepository sendSuperviseProcessInfoRepository,
IRepository sendSuperviseResultInfoRepository,
IRepository submitCaseRecordRepository,
IRepository submitCaseTotalRepository,
IRepository sendCaseInfoRepository,
IRepository supplyCaseInfoSendRepository,
IRepository revokeCaseInfoRepository,
IRepository remindCaseInfoRepository,
IRepository getKnowledgeInfoSendRepository,
IRepository getKnowledgeInfoUpdateRepository,
IRepository getKnowledgeInfoAbandonRepository,
IRepository sendRealTimeStatusRepository,
IRepository screenCaseInfoSendRepository,
IRepository zMHDCaseInfoPublicRepository,
IProvinceService provinceService,
IRepository knowledgeRawDataRepository,
IChannelConfigurationManager channelConfigurationManager,
IDataOrderRepository dataOrderRepository)
{
_mediator = mediator;
_logger = logger;
_mapper = mapper;
_getCaseResultReceiveRepository = getCaseResultReceiveRepository;
_getCaseProcessReceiveRepository = getCaseProcessReceiveRepository;
_getVisitInfoReceiveRepository = getVisitInfoReceiveRepository;
_getCaseBackApplyRepository = getCaseBackApplyRepository;
_delayCaseInfoSendRepository = delayCaseInfoSendRepository;
_sendSuperviseProcessInfoRepository = sendSuperviseProcessInfoRepository;
_sendSuperviseResultInfoRepository = sendSuperviseResultInfoRepository;
_submitCaseRecordRepository = submitCaseRecordRepository;
_submitCaseTotalRepository = submitCaseTotalRepository;
_sendCaseInfoRepository = sendCaseInfoRepository;
_supplyCaseInfoSendRepository = supplyCaseInfoSendRepository;
_revokeCaseInfoRepository = revokeCaseInfoRepository;
_remindCaseInfoRepository = remindCaseInfoRepository;
_getKnowledgeInfoSendRepository = getKnowledgeInfoSendRepository;
_getKnowledgeInfoUpdateRepository = getKnowledgeInfoUpdateRepository;
_getKnowledgeInfoAbandonRepository = getKnowledgeInfoAbandonRepository;
_sendRealTimeStatusRepository = sendRealTimeStatusRepository;
_screenCaseInfoSendRepository = screenCaseInfoSendRepository;
_zMHDCaseInfoPublicRepository = zMHDCaseInfoPublicRepository;
_provinceService = provinceService;
_knowledgeRawDataRepository = knowledgeRawDataRepository;
_channelConfigurationManager = channelConfigurationManager;
_dataOrderRepository = dataOrderRepository;
}
#endregion
#region 协同-第一批次
///
/// 服务工单交办处理结果 ---已在汇聚中完成
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseResultReceive)]
public async Task GetCaseResultReceive(GetCaseResultReceiveInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _getCaseResultReceiveRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new GetCaseResultReceiveNotification(data));
}
///
/// 服务工单交办处理过程 ---已在汇聚中完成
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseProcessReceive)]
public async Task GetCaseProcessReceive(GetCaseProcessReceiveInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _getCaseProcessReceiveRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new GetCaseProcessReceiveNotification(data));
}
///
/// 服务工单交办评价 ---已在汇聚中完成
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetVisitInfoReceive)]
public async Task GetVisitInfoReceive(GetVisitInfoReceiveInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _getVisitInfoReceiveRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new GetVisitInfoReceiveNotification(data));
}
///
/// 退回申请
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseBackApply)]
public async Task GetCaseBackApply(GetCaseBackApplyInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _getCaseBackApplyRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new GetCaseBackApplyNotification(data));
//处理附件
await _provinceService.FileData(new List(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
}
///
/// 服务工单申请延时
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderDelayCaseInfoSend)]
public async Task DelayCaseInfoSend(DelayCaseInfoSendInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _delayCaseInfoSendRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new DelayCaseInfoSendNotification(data));
//处理附件
await _provinceService.FileData(new List(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
}
///
/// 服务工单督办过程 --已对接
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSuperviseCourse)]
public async Task SendSuperviseProcessInfo(PublishSuperviseDto dto)
{
//工单是省上派下来的,才能进行督办回复
if (dto.Order.Source == ESource.ProvinceStraight)
{
var data = _mapper.Map(dto);
//将上报信息写入本地库
data.Id = await _sendSuperviseProcessInfoRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new SendSuperviseProcessInfoNotification(data));
}
}
///
/// 服务工单督办结果 --已对接
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSuperviseResult)]
public async Task SendSuperviseResultInfo(PublishSuperviseDto dto)
{
//工单是省上派下来的,才能进行督办回复
if (dto.Order.Source == ESource.ProvinceStraight)
{
var data = _mapper.Map(dto);
//将上报信息写入本地库
data.Id = await _sendSuperviseResultInfoRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new SendSuperviseResultInfoNotification(data));
}
}
///
/// 工单发起甄别 --已对接
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderScreenApply)]
public async Task ScreenCaseInfoSend(PublishScreenDto dto)
{
//如果是省上派下来的工单,才能调发起甄别的接口
if (dto.Order.Source == ESource.ProvinceStraight)
{
var data = _mapper.Map(dto);
data.ApplyType = dto.Screen.TypeDicName switch
{
"违反法律法规" => "10",
"按正常流程处理" => "20",
_ => "30",
};
//将上报信息写入本地库
data.Id = await _screenCaseInfoSendRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new ScreenCaseInfoSendNotification(data));
}
}
///
/// 政民互动提交公开
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderZMHDCaseInfoPublic)]
public async Task ZMHDCaseInfoPublic(ZMHDCaseInfoPublicInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _zMHDCaseInfoPublicRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new ZMHDCaseInfoPublicNotification(data));
}
#endregion
#region 汇聚-第二批次
#region 已对接
///
/// 热线工单流程开启 --服务工单受理
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderFlowStarted)]
public async Task OrderFlowStarted(OrderDto dto)
{
//如果不是省上派下来的工单,需要汇聚到省上
if (dto.Source != ESource.ProvinceStraight)
{
var submitCaseInfo = await _provinceService.InitData(dto);
await _mediator.Publish(new OrderCreatedNotification(submitCaseInfo));
//处理数据
var dataOrder = await _dataOrderRepository.GetAsync(p => p.OrderId == submitCaseInfo.OrderID);
if (dataOrder == null)
{
dataOrder = new()
{
OrderId = submitCaseInfo.OrderID,
OrderNo = submitCaseInfo.No,
ProvinceNo = submitCaseInfo.CaseSerial,
CaseDate = submitCaseInfo.CaseDate,
FirstSyncProvinceTime = DateTime.Now,
SyncInterval = 0,
IsTimelyUpload = true,
CaseSource = dto.SourceChannel,
CaseSourceCode=dto.SourceChannelCode,
ExpiredTime = submitCaseInfo.TfdBackTimeBf,
CaseType = submitCaseInfo.CaseType,
CaseTypeCode = dto.AcceptTypeCode,
AllDuration = 0,
IsProvince = false,
HandleState = "办理中",
Title= dto.Title,
FromName=dto.FromName,
Contact=dto.Contact,
Content=dto.Content,
HotspotId=dto.HotspotId,
HotspotName=dto.HotspotName,
HotspotSpliceName=dto.HotspotSpliceName,
Source=dto.Source.ToString()
};
await _dataOrderRepository.AddAsync(dataOrder);
}
else
{
//修改
dataOrder.NewSyncProvinceTime = DateTime.Now;
dataOrder.SyncInterval = new TimeSpan(DateTime.Now.Ticks - dataOrder.FirstSyncProvinceTime.Value.Ticks).TotalSeconds;
dataOrder.IsTimelyUpload = false;
await _dataOrderRepository.UpdateAsync(dataOrder);
}
//处理附件
await _provinceService.FileData(new List(), submitCaseInfo.CaseSerial, submitCaseInfo.CliengGuid, submitCaseInfo.AreaCode);
}
}
///派单的时候,需要确定往哪里推,需要一个事件
///
/// 热线工单期满时间变更--服务工单受理
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate)]
public async Task OrderExpiredTimeUpdate(OrderDto dto)
{
//如果不是省上派下来的工单,需要汇聚到省上
if (dto.Source != ESource.ProvinceStraight)
{
var submitCaseInfo = await _provinceService.InitData(dto);
await _mediator.Publish(new OrderCreatedNotification(submitCaseInfo));
}
}
///
/// 派单是判断是否需要往第三方推送数据
///
///
///
[NonAction]
// [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate)]
public async Task OrderDispatch(OrderFlowDto dto)
{
await _provinceService.OrderDispatch(dto);
}
///
/// 热线工单一级部门办理完---服务工单处理--缺少附件
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderLevelOneOrgHandled)]
public async Task SubmitCaseProcess(OrderFlowDto dto)
{
//判断是否是热线中心
if (!string.IsNullOrEmpty(dto.Order.ActualHandleOrgCode))
{
if (dto.Order.ActualHandleOrgCode.Substring(0, 3) == "001")
{
dto.Order.ActualHandleOrgName = "热线中心";
}
}
//如果不是省上派下来的工单
if (dto.Order.Source != ESource.ProvinceStraight)
await _provinceService.SubmitCaseProcess(dto);//本地工单走市州接口
else
{
//省上下来的工单走协同的接口
var data = _mapper.Map(dto);
data.TacheName = "70:" + data.DeptName;
//将上报信息写入本地库
data.Id = await _getCaseProcessReceiveRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new GetCaseProcessReceiveNotification(data));
}
}
///
/// 回访完成---服务工单回访评价
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderVisited)]
public async Task SubmitVisitInfo(PublishVisitDto dto)
{
// dto.Order.ProvinceNo = dto.Order.No;
//如果不是省上派下来的工单,走服务工单评价接口,是省上下来的工单走服务工单交办评价接口
if (dto.Order.Source != ESource.ProvinceStraight && dto.Order.IsProvince == false)
await _provinceService.SubmitVisitInfo(dto);
else
{
var data = _mapper.Map(dto);
switch (dto.VisitType)
{
case EVisitType.ArtificialVisit:
data.VisitType = "DH";
break;
case EVisitType.SmsVisit:
data.VisitType = "DX";
break;
case EVisitType.WebVisit:
data.VisitType = "WZ";
break;
case EVisitType.WeChatVisit:
data.VisitType = "WX";
break;
case EVisitType.AppVisit:
data.VisitType = "AP";
break;
default:
break;
}
data.CliengGuid = Guid.NewGuid().ToString();
//将上报信息写入本地库
data.Id = await _getVisitInfoReceiveRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new GetVisitInfoReceiveNotification(data));
//处理附件
await _provinceService.FileData(new List(), data.CaseSerial, data.CliengGuid, data.AreaCode);
}
}
///
/// 甄别通过---服务工单回访评价
///
///
///
[NonAction]
// [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderScreenSuccess)]
public async Task SubmitOrderScreenSuccess(PublishVisitDto dto)
{
//如果不是省上派下来的工单,走服务工单评价接口,是省上下来的工单走服务工单交办评价接口(除开政民互动直派)
if (dto.Order.Source != ESource.ProvinceStraight && dto.Order.IsProvince == false)
await _provinceService.SubmitVisitInfo(dto);
else
{
var data = _mapper.Map(dto);
switch (dto.VisitType)
{
case EVisitType.ArtificialVisit:
data.VisitType = "DH";
break;
case EVisitType.SmsVisit:
data.VisitType = "DX";
break;
case EVisitType.WebVisit:
data.VisitType = "WZ";
break;
case EVisitType.WeChatVisit:
data.VisitType = "WX";
break;
case EVisitType.AppVisit:
data.VisitType = "AP";
break;
default:
break;
}
data.CliengGuid = Guid.NewGuid().ToString();
//将上报信息写入本地库
data.Id = await _getVisitInfoReceiveRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new GetVisitInfoReceiveNotification(data));
//处理附件
await _provinceService.FileData(new List(), data.CaseSerial, data.CliengGuid, data.AreaCode);
}
}
///
///热线工单归档---服务工单结果--缺少附件
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderFiled)]
public async Task OrderFiled(OrderFlowDto dto)
{
//判断是否是热线中心
if (!string.IsNullOrEmpty(dto.Order.ActualHandleOrgCode))
{
if (dto.Order.ActualHandleOrgCode.Substring(0, 3) == "001")
{
dto.Order.ActualHandleOrgName = "热线中心";
}
}
//IsProvince 如果是false 则推送服务工单受理
if (dto != null && dto.Order != null && !dto.Order.IsProvince)
{
//推送工单信息
var submitCaseInfo = await _provinceService.InitData(dto.Order);
await _mediator.Publish(new OrderCreatedNotification(submitCaseInfo));
}
//推送服务工单处理信息
await _provinceService.SubmitCaseProcess(dto);
//推送服务工单结果信息-组装110数据
await _provinceService.SubmitCaseResult(dto);
var data = await _dataOrderRepository.GetAsync(p => p.OrderId == dto.Order.Id);
if (data != null)
{
data.HandleState = "办理完成";
data.ActualHandleOrgName = dto.Order.ActualHandleOrgName;
data.ActualHandleOrgCode= dto.Order.ActualHandleOrgCode;
data.ActualOpinion = dto.Order.ActualOpinion;
await _dataOrderRepository.UpdateAsync(data);
}
}
///
/// 挂电话推送----电话记录
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineCallBye)]
public async Task SubmitCaseRecord(List dtos)
{
List recordList = new();
foreach (var item in dtos)
{
var record = _mapper.Map(item);
record.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
if (item.Order != null && !string.IsNullOrEmpty(item.Order.ProvinceNo))
record.CaseSerial = item.Order.ProvinceNo;
//将上报信息写入本地库
record.Id = await _submitCaseRecordRepository.AddAsync(record);
if (!string.IsNullOrEmpty(record.Id))
recordList.Add(record);
}
if (recordList != null && recordList.Count > 0)
//信息上报
await _mediator.Publish(new SubmitCaseRecordNotification(recordList));
}
///
/// 关联工单了推送----电话记录
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineCallConnectWithOrder)]
public async Task SubmitCaseRecordOrder(CallConnectOrderDto dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
data.CaseSerial = dto.Order.ProvinceNo;
//将上报信息写入本地库
data.Id = await _submitCaseRecordRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new SubmitCaseRecordNotification(new List { data }));
}
#endregion
///
/// 统计数据
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSubmitCaseTotal)]
public async Task SubmitCaseTotal(CaseTotal dto)
{
var data = _mapper.Map(dto);
//将上报信息写入本地库
var id = await _submitCaseTotalRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new SubmitCaseTotalNotification(data));
}
#endregion
#region 协同-第三批次
///
/// 服务工单上报 --- 在派单的时候,确定需不需要往各个平台推送数据--已在派单的推送事件中处理
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.SendCaseInfo)]
public async Task SendCaseInfo(OrderDto dto)
{
var sendCaseInfo = _mapper.Map(dto);
//处理性别
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;
}
sendCaseInfo.Id = await _sendCaseInfoRepository.AddAsync(sendCaseInfo, HttpContext.RequestAborted);
await _mediator.Publish(new SendCaseInfoNotification(sendCaseInfo));
}
///
/// 上报补充诉求
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.SupplyCaseInfoSend)]
public async Task SupplyCaseInfoSend(SupplyCaseInfoSendInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _supplyCaseInfoSendRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new SupplyCaseInfoSendNotification(data));
//处理附件
await _provinceService.FileData(new List(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
}
///
/// 服务工单撤单
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.SendRevokeCaseInfo)]
public async Task SendRevokeCaseInfo(RevokeCaseInfoInfo dto)
{
var data = _mapper.Map(dto);
data.Direction = "1";
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
var id = await _revokeCaseInfoRepository.AddAsync(data);
data.Id = id;
//信息上报
await _mediator.Publish(new SendRevokeCaseInfoNotification(data));
//处理附件
await _provinceService.FileData(new List(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
}
///
/// 服务工单催单--已对接
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderUrgeInform)]
public async Task SendRemindCaseInfo(PublishUrgeDto dto)
{
//被催办部门为省上,才能调用接口
if (dto.Urge.OrgName == "")
{
var data = _mapper.Map(dto);
data.Direction = "1";
//将上报信息写入本地库
data.Id = await _remindCaseInfoRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new SendRemindCaseInfoNotification(data));
//处理附件
await _provinceService.FileData(new List(), dto.Order.ProvinceNo, dto.ClientGuid, dto.Order.AreaCode);
}
}
#endregion
#region 协同-第四批次
#region 知识库--已对接附件
///
/// 知识库上报
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeAdd)]
public async Task GetKnowledgeInfoSend(KnowledgeSendDto dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
dto.CliengGuid = Guid.NewGuid().ToString();
if (data.DisableDate == null)//如果没得有失效时间,默认在生效日期上面加10年
data.DisableDate = data.BeginDate.Value.AddYears(10);
//将上报信息写入本地库
data.Id = await _getKnowledgeInfoSendRepository.AddAsync(data);
//保存原始数据
var dataRaw = _mapper.Map(data);
await _knowledgeRawDataRepository.AddAsync(dataRaw);
//信息上报
await _mediator.Publish(new GetKnowledgeInfoSendNotification(data));
//知识附件处理
await _provinceService.FileData(new List(), dto.UID, dto.CliengGuid, data.AreaCode);
}
///
/// 知识库变更
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeUpdate)]
public async Task GetKnowledgeInfoUpdate(KnowledgeSendDto dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
dto.CliengGuid = Guid.NewGuid().ToString();
if (data.DisableDate == null)//如果没得有失效时间,默认在生效日期上面加10年
data.DisableDate = data.BeginDate.Value.AddYears(10);
//将上报信息写入本地库
data.Id = await _getKnowledgeInfoUpdateRepository.AddAsync(data);
//查询原有数据,如果有修改原始数据,没有直接新增
var dataRaw = await _knowledgeRawDataRepository.GetAsync(p => p.UID == data.UID);
var raw = _mapper.Map(data);
if (dataRaw != null)
{
raw.Id = dataRaw.Id;
await _knowledgeRawDataRepository.UpdateAsync(raw);
}
else
await _knowledgeRawDataRepository.AddAsync(raw);
//信息上报
await _mediator.Publish(new GetKnowledgeInfoUpdateNotification(data));
//知识附件处理
await _provinceService.FileData(new List(), dto.UID, dto.CliengGuid, data.AreaCode);
}
///
/// 知识库下架
///
///
///
[NonAction]
[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeRemove)]
public async Task GetKnowledgeInfoAbandon(KnowledgeSendDto dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
data.Id = await _getKnowledgeInfoAbandonRepository.AddAsync(data);
//知识下架删除原有原始数据
await _knowledgeRawDataRepository.RemoveAsync(p => p.UID == data.UID, false);
//信息上报
await _mediator.Publish(new GetKnowledgeInfoAbandonNotification(data));
}
#endregion
///
/// 实时服务上报
///
///
///
[NonAction]
//[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineSendRealTimeStatus)]
public async Task SendRealTimeStatus(SendRealTimeStatusInfo dto)
{
var data = _mapper.Map(dto);
data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
//将上报信息写入本地库
data.Id = await _sendRealTimeStatusRepository.AddAsync(data);
//信息上报
await _mediator.Publish(new SendRealTimeStatusNotification(data));
}
#endregion
}
}