123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- 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
- {
- /// <summary>
- ///
- /// </summary>
- public class HotlineMessageReceiveController : Controller
- {
- #region 注入
- private readonly IMediator _mediator;
- private readonly ILogger<HotlineMsgReceiver> _logger;
- private readonly IMapper _mapper;
- private readonly IRepository<GetCaseResultReceive> _getCaseResultReceiveRepository;
- private readonly IRepository<GetCaseProcessReceive> _getCaseProcessReceiveRepository;
- private readonly IRepository<GetVisitInfoReceive> _getVisitInfoReceiveRepository;
- private readonly IRepository<GetCaseBackApply> _getCaseBackApplyRepository;
- private readonly IRepository<DelayCaseInfoSend> _delayCaseInfoSendRepository;
- private readonly IRepository<SendSuperviseProcessInfo> _sendSuperviseProcessInfoRepository;
- private readonly IRepository<SendSuperviseResultInfo> _sendSuperviseResultInfoRepository;
- private readonly IRepository<SubmitCaseRecord> _submitCaseRecordRepository;
- private readonly IRepository<SubmitCaseTotal> _submitCaseTotalRepository;
- private readonly IRepository<SendCaseInfo> _sendCaseInfoRepository;
- private readonly IRepository<SupplyCaseInfoSend> _supplyCaseInfoSendRepository;
- private readonly IRepository<RevokeCaseInfo> _revokeCaseInfoRepository;
- private readonly IRepository<RemindCaseInfo> _remindCaseInfoRepository;
- private readonly IRepository<GetKnowledgeInfoSend> _getKnowledgeInfoSendRepository;
- private readonly IRepository<GetKnowledgeInfoUpdate> _getKnowledgeInfoUpdateRepository;
- private readonly IRepository<GetKnowledgeInfoAbandon> _getKnowledgeInfoAbandonRepository;
- private readonly IRepository<SendRealTimeStatus> _sendRealTimeStatusRepository;
- private readonly IRepository<ScreenCaseInfoSend> _screenCaseInfoSendRepository;
- private readonly IRepository<ZMHDCaseInfoPublic> _zMHDCaseInfoPublicRepository;
- private readonly IProvinceService _provinceService;
- private readonly IRepository<KnowledgeRawData> _knowledgeRawDataRepository;
- private readonly IChannelConfigurationManager _channelConfigurationManager;
- private readonly IDataOrderRepository _dataOrderRepository;
- /// <summary>
- ///
- /// </summary>
- /// <param name="mediator"></param>
- /// <param name="logger"></param>
- /// <param name="mapper"></param>
- /// <param name="getCaseResultReceiveRepository"></param>
- /// <param name="getCaseProcessReceiveRepository"></param>
- /// <param name="getVisitInfoReceiveRepository"></param>
- /// <param name="getCaseBackApplyRepository"></param>
- /// <param name="delayCaseInfoSendRepository"></param>
- /// <param name="sendSuperviseProcessInfoRepository"></param>
- /// <param name="sendSuperviseResultInfoRepository"></param>
- /// <param name="submitCaseRecordRepository"></param>
- /// <param name="submitCaseTotalRepository"></param>
- /// <param name="sendCaseInfoRepository"></param>
- /// <param name="supplyCaseInfoSendRepository"></param>
- /// <param name="revokeCaseInfoRepository"></param>
- /// <param name="remindCaseInfoRepository"></param>
- /// <param name="getKnowledgeInfoSendRepository"></param>
- /// <param name="getKnowledgeInfoUpdateRepository"></param>
- /// <param name="getKnowledgeInfoAbandonRepository"></param>
- /// <param name="sendRealTimeStatusRepository"></param>
- /// <param name="screenCaseInfoSendRepository"></param>
- /// <param name="zMHDCaseInfoPublicRepository"></param>
- /// <param name="provinceService"></param>
- /// <param name="knowledgeRawDataRepository"></param>
- /// <param name="channelConfigurationManager"></param>
- /// <param name="dataOrderRepository"></param>
- public HotlineMessageReceiveController(IMediator mediator,
- ILogger<HotlineMsgReceiver> logger,
- IMapper mapper,
- IRepository<GetCaseResultReceive> getCaseResultReceiveRepository,
- IRepository<GetCaseProcessReceive> getCaseProcessReceiveRepository,
- IRepository<GetVisitInfoReceive> getVisitInfoReceiveRepository,
- IRepository<GetCaseBackApply> getCaseBackApplyRepository,
- IRepository<DelayCaseInfoSend> delayCaseInfoSendRepository,
- IRepository<SendSuperviseProcessInfo> sendSuperviseProcessInfoRepository,
- IRepository<SendSuperviseResultInfo> sendSuperviseResultInfoRepository,
- IRepository<SubmitCaseRecord> submitCaseRecordRepository,
- IRepository<SubmitCaseTotal> submitCaseTotalRepository,
- IRepository<SendCaseInfo> sendCaseInfoRepository,
- IRepository<SupplyCaseInfoSend> supplyCaseInfoSendRepository,
- IRepository<RevokeCaseInfo> revokeCaseInfoRepository,
- IRepository<RemindCaseInfo> remindCaseInfoRepository,
- IRepository<GetKnowledgeInfoSend> getKnowledgeInfoSendRepository,
- IRepository<GetKnowledgeInfoUpdate> getKnowledgeInfoUpdateRepository,
- IRepository<GetKnowledgeInfoAbandon> getKnowledgeInfoAbandonRepository,
- IRepository<SendRealTimeStatus> sendRealTimeStatusRepository,
- IRepository<ScreenCaseInfoSend> screenCaseInfoSendRepository,
- IRepository<ZMHDCaseInfoPublic> zMHDCaseInfoPublicRepository,
- IProvinceService provinceService,
- IRepository<KnowledgeRawData> 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 协同-第一批次
- /// <summary>
- /// 服务工单交办处理结果 ---已在汇聚中完成
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseResultReceive)]
- public async Task GetCaseResultReceive(GetCaseResultReceiveInfo dto)
- {
- var data = _mapper.Map<GetCaseResultReceive>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- //将上报信息写入本地库
- var id = await _getCaseResultReceiveRepository.AddAsync(data);
- data.Id = id;
- //信息上报
- await _mediator.Publish(new GetCaseResultReceiveNotification(data));
- }
- /// <summary>
- /// 服务工单交办处理过程 ---已在汇聚中完成
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseProcessReceive)]
- public async Task GetCaseProcessReceive(GetCaseProcessReceiveInfo dto)
- {
- var data = _mapper.Map<GetCaseProcessReceive>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- //将上报信息写入本地库
- var id = await _getCaseProcessReceiveRepository.AddAsync(data);
- data.Id = id;
- //信息上报
- await _mediator.Publish(new GetCaseProcessReceiveNotification(data));
- }
- /// <summary>
- /// 服务工单交办评价 ---已在汇聚中完成
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetVisitInfoReceive)]
- public async Task GetVisitInfoReceive(GetVisitInfoReceiveInfo dto)
- {
- var data = _mapper.Map<GetVisitInfoReceive>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- //将上报信息写入本地库
- var id = await _getVisitInfoReceiveRepository.AddAsync(data);
- data.Id = id;
- //信息上报
- await _mediator.Publish(new GetVisitInfoReceiveNotification(data));
- }
- /// <summary>
- /// 退回申请
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseBackApply)]
- public async Task GetCaseBackApply(GetCaseBackApplyInfo dto)
- {
- var data = _mapper.Map<GetCaseBackApply>(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<Hotline.Share.Dtos.File.FileDto>(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
- }
- /// <summary>
- /// 服务工单申请延时
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderDelayCaseInfoSend)]
- public async Task DelayCaseInfoSend(DelayCaseInfoSendInfo dto)
- {
- var data = _mapper.Map<DelayCaseInfoSend>(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<Hotline.Share.Dtos.File.FileDto>(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
- }
- /// <summary>
- /// 服务工单督办过程 --已对接
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSuperviseCourse)]
- public async Task SendSuperviseProcessInfo(PublishSuperviseDto dto)
- {
- //工单是省上派下来的,才能进行督办回复
- if (dto.Order.Source == ESource.ProvinceStraight)
- {
- var data = _mapper.Map<SendSuperviseProcessInfo>(dto);
- //将上报信息写入本地库
- data.Id = await _sendSuperviseProcessInfoRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new SendSuperviseProcessInfoNotification(data));
- }
- }
- /// <summary>
- /// 服务工单督办结果 --已对接
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSuperviseResult)]
- public async Task SendSuperviseResultInfo(PublishSuperviseDto dto)
- {
- //工单是省上派下来的,才能进行督办回复
- if (dto.Order.Source == ESource.ProvinceStraight)
- {
- var data = _mapper.Map<SendSuperviseResultInfo>(dto);
- //将上报信息写入本地库
- data.Id = await _sendSuperviseResultInfoRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new SendSuperviseResultInfoNotification(data));
- }
- }
- /// <summary>
- /// 工单发起甄别 --已对接
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderScreenApply)]
- public async Task ScreenCaseInfoSend(PublishScreenDto dto)
- {
- //如果是省上派下来的工单,才能调发起甄别的接口
- if (dto.Order.Source == ESource.ProvinceStraight)
- {
- var data = _mapper.Map<ScreenCaseInfoSend>(dto);
- data.ApplyType = dto.Screen.TypeDicName switch
- {
- "违反法律法规" => "10",
- "按正常流程处理" => "20",
- _ => "30",
- };
- //将上报信息写入本地库
- data.Id = await _screenCaseInfoSendRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new ScreenCaseInfoSendNotification(data));
- }
- }
- /// <summary>
- /// 政民互动提交公开
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderZMHDCaseInfoPublic)]
- public async Task ZMHDCaseInfoPublic(ZMHDCaseInfoPublicInfo dto)
- {
- var data = _mapper.Map<ZMHDCaseInfoPublic>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- //将上报信息写入本地库
- var id = await _zMHDCaseInfoPublicRepository.AddAsync(data);
- data.Id = id;
- //信息上报
- await _mediator.Publish(new ZMHDCaseInfoPublicNotification(data));
- }
- #endregion
- #region 汇聚-第二批次
- #region 已对接
- /// <summary>
- /// 热线工单流程开启 --服务工单受理
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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<Hotline.Share.Dtos.File.FileDto>(), submitCaseInfo.CaseSerial, submitCaseInfo.CliengGuid, submitCaseInfo.AreaCode);
- }
- }
- ///派单的时候,需要确定往哪里推,需要一个事件
- /// <summary>
- /// 热线工单期满时间变更--服务工单受理
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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));
- }
- }
- /// <summary>
- /// 派单是判断是否需要往第三方推送数据
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- // [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate)]
- public async Task OrderDispatch(OrderFlowDto dto)
- {
- await _provinceService.OrderDispatch(dto);
- }
- /// <summary>
- /// 热线工单一级部门办理完---服务工单处理--缺少附件
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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<GetCaseProcessReceive>(dto);
- data.TacheName = "70:" + data.DeptName;
- //将上报信息写入本地库
- data.Id = await _getCaseProcessReceiveRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new GetCaseProcessReceiveNotification(data));
- }
- }
- /// <summary>
- /// 回访完成---服务工单回访评价
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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<GetVisitInfoReceive>(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<Hotline.Share.Dtos.File.FileDto>(), data.CaseSerial, data.CliengGuid, data.AreaCode);
- }
- }
- /// <summary>
- /// 甄别通过---服务工单回访评价
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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<GetVisitInfoReceive>(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<Hotline.Share.Dtos.File.FileDto>(), data.CaseSerial, data.CliengGuid, data.AreaCode);
- }
- }
- /// <summary>
- ///热线工单归档---服务工单结果--缺少附件
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [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);
- }
- }
- /// <summary>
- /// 挂电话推送----电话记录
- /// </summary>
- /// <param name="dtos"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineCallBye)]
- public async Task SubmitCaseRecord(List<CallConnectOrderDto> dtos)
- {
- List<SubmitCaseRecord> recordList = new();
- foreach (var item in dtos)
- {
- var record = _mapper.Map<SubmitCaseRecord>(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));
- }
- /// <summary>
- /// 关联工单了推送----电话记录
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineCallConnectWithOrder)]
- public async Task SubmitCaseRecordOrder(CallConnectOrderDto dto)
- {
- var data = _mapper.Map<SubmitCaseRecord>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- data.CaseSerial = dto.Order.ProvinceNo;
- //将上报信息写入本地库
- data.Id = await _submitCaseRecordRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new SubmitCaseRecordNotification(new List<SubmitCaseRecord> { data }));
- }
- #endregion
- /// <summary>
- /// 统计数据
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSubmitCaseTotal)]
- public async Task SubmitCaseTotal(CaseTotal dto)
- {
- var data = _mapper.Map<SubmitCaseTotal>(dto);
- //将上报信息写入本地库
- var id = await _submitCaseTotalRepository.AddAsync(data);
- data.Id = id;
- //信息上报
- await _mediator.Publish(new SubmitCaseTotalNotification(data));
- }
- #endregion
- #region 协同-第三批次
- /// <summary>
- /// 服务工单上报 --- 在派单的时候,确定需不需要往各个平台推送数据--已在派单的推送事件中处理
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.SendCaseInfo)]
- public async Task SendCaseInfo(OrderDto dto)
- {
- var sendCaseInfo = _mapper.Map<SendCaseInfo>(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));
- }
- /// <summary>
- /// 上报补充诉求
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.SupplyCaseInfoSend)]
- public async Task SupplyCaseInfoSend(SupplyCaseInfoSendInfo dto)
- {
- var data = _mapper.Map<SupplyCaseInfoSend>(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<Hotline.Share.Dtos.File.FileDto>(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
- }
- /// <summary>
- /// 服务工单撤单
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.SendRevokeCaseInfo)]
- public async Task SendRevokeCaseInfo(RevokeCaseInfoInfo dto)
- {
- var data = _mapper.Map<RevokeCaseInfo>(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<Hotline.Share.Dtos.File.FileDto>(), dto.CaseSerial, dto.CliengGuid, dto.AreaCode);
- }
- /// <summary>
- /// 服务工单催单--已对接
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderUrgeInform)]
- public async Task SendRemindCaseInfo(PublishUrgeDto dto)
- {
- //被催办部门为省上,才能调用接口
- if (dto.Urge.OrgName == "")
- {
- var data = _mapper.Map<RemindCaseInfo>(dto);
- data.Direction = "1";
- //将上报信息写入本地库
- data.Id = await _remindCaseInfoRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new SendRemindCaseInfoNotification(data));
- //处理附件
- await _provinceService.FileData(new List<Hotline.Share.Dtos.File.FileDto>(), dto.Order.ProvinceNo, dto.ClientGuid, dto.Order.AreaCode);
- }
- }
- #endregion
- #region 协同-第四批次
- #region 知识库--已对接附件
- /// <summary>
- /// 知识库上报
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeAdd)]
- public async Task GetKnowledgeInfoSend(KnowledgeSendDto dto)
- {
- var data = _mapper.Map<GetKnowledgeInfoSend>(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<KnowledgeRawData>(data);
- await _knowledgeRawDataRepository.AddAsync(dataRaw);
- //信息上报
- await _mediator.Publish(new GetKnowledgeInfoSendNotification(data));
- //知识附件处理
- await _provinceService.FileData(new List<Hotline.Share.Dtos.File.FileDto>(), dto.UID, dto.CliengGuid, data.AreaCode);
- }
- /// <summary>
- /// 知识库变更
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeUpdate)]
- public async Task GetKnowledgeInfoUpdate(KnowledgeSendDto dto)
- {
- var data = _mapper.Map<GetKnowledgeInfoUpdate>(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<KnowledgeRawData>(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<Hotline.Share.Dtos.File.FileDto>(), dto.UID, dto.CliengGuid, data.AreaCode);
- }
- /// <summary>
- /// 知识库下架
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineKnowledgeRemove)]
- public async Task GetKnowledgeInfoAbandon(KnowledgeSendDto dto)
- {
- var data = _mapper.Map<GetKnowledgeInfoAbandon>(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
- /// <summary>
- /// 实时服务上报
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [NonAction]
- //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineSendRealTimeStatus)]
- public async Task SendRealTimeStatus(SendRealTimeStatusInfo dto)
- {
- var data = _mapper.Map<SendRealTimeStatus>(dto);
- data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
- //将上报信息写入本地库
- data.Id = await _sendRealTimeStatusRepository.AddAsync(data);
- //信息上报
- await _mediator.Publish(new SendRealTimeStatusNotification(data));
- }
- #endregion
- }
- }
|