TANG JIANG 1 year ago
parent
commit
6c4d1fac37

+ 20 - 11
src/Sharing.Api/Controllers/HotlineMessageReceiveController.cs

@@ -206,19 +206,28 @@ namespace Sharing.Api.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [NonAction]
-        //[CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderGetCaseBackApply)]
-        public async Task GetCaseBackApply(GetCaseBackApplyInfo dto)
+        [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderSendBackApplyed)]
+        public async Task GetCaseBackApply(PublishOrderSendBackDto dto)
         {
-            var data = _mapper.Map<GetCaseBackApply>(dto);
-            data.AreaCode = _channelConfigurationManager.GetConfigurationCityCode().AreaCode;
-            //将上报信息写入本地库
-            var id = await _getCaseBackApplyRepository.AddAsync(data);
+            //处理省上的退回申请
+            if (dto.Order.Source == ESource.ProvinceStraight)
+            {
+                var data = _mapper.Map<GetCaseBackApply>(dto);
+                //将上报信息写入本地库
+                data.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);
+                //信息上报
+                await _mediator.Publish(new GetCaseBackApplyNotification(data));
+
+                //处理附件
+                await _provinceService.FileData(new List<Hotline.Share.Dtos.File.FileDto>(), dto.Order.ProvinceNo, dto.ClientGuid, dto.Order.AreaCode);
+            }
+
+            //处理110退回事件
+            if (dto.Order.Source==ESource.Police110)
+            {
+
+            }
         }
 
         /// <summary>

+ 0 - 2
src/Sharing.Api/ProvinceService.cs

@@ -218,7 +218,6 @@ namespace Sharing.Api
             {
                 foreach (var item in dto.WorkflowTrace.NextHandlers)
                 {
-
                     if (!string.IsNullOrEmpty(item.Value))
                     {
                         //需要判断是否需要往110推送
@@ -243,7 +242,6 @@ namespace Sharing.Api
                 }
             }
             #endregion
-
         }
 
         /// <summary>

+ 12 - 0
src/Sharing.Application/Mappers/MapperConfigs.cs

@@ -216,6 +216,18 @@ namespace Sharing.Application.Mappers
             .Map(d => d.RemindReasion, x => x.Urge.ApplyContent)
            .Map(d => d.AreaCode, x => x.Order.AreaCode)
            .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
+           ;
+
+            //服务工单退回申请
+            config.ForType<PublishOrderSendBackDto, GetCaseBackApply>()
+            .Map(d => d.OrderSendBackId, x => x.SendBack.Id)
+            .Map(d => d.BackType, x => x.SendBack.Handle)
+            .Map(d => d.DealDept, x => x.SendBack.CreatorOrgName)
+           .Map(d => d.DealName, x => x.SendBack.CreatorName)
+           .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
+           .Map(d=>d.AreaCode,x=>x.Order.AreaCode)
+           .Map(d=>d.ApplyTime,x=>x.SendBack.CreationTime)
+           .Map(d=>d.BackReason,x=>x.SendBack.Content)
            ;
 
             #region 汇聚扩展数据--拓展信息

+ 24 - 3
src/Sharing.Application/Province/PushDataBgService.cs

@@ -1,9 +1,13 @@
 using MediatR;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
+using Sharing.Notifications.HuiJu;
+using Sharing.Notifications.XieTong;
 using Sharing.Province.HuiJu.Send;
 using Sharing.Province.Other;
 using Sharing.Province.XieTong.Receive;
+using Sharing.Province.XieTong.Send;
+using XF.Domain.Repository;
 
 namespace Sharing.Application.Province
 {
@@ -37,8 +41,10 @@ namespace Sharing.Application.Province
             {
                 using var scope = _serviceScopeFactory.CreateScope();
                 var _waitingPushDataRepository = scope.ServiceProvider.GetService<IWaitingPushDataRepository>();
+                var _sendCaseInfoRepository = scope.ServiceProvider.GetService<IRepository<SendCaseInfo>>();
                 var _mediator = scope.ServiceProvider.GetService<IMediator>();
 
+                #region 批量推送省数据
                 //查询待推送数据
                 var listData = await _waitingPushDataRepository
                        .Queryable()
@@ -96,11 +102,26 @@ namespace Sharing.Application.Province
                     // await _mediator.Publish(new GetCaseMaterialInfoNotification(getCaseMaterialInfos));
                 }
                 else
-                    isContinue = false;
-
-                //请求查询
+                    isContinue = false; 
+                #endregion
 
+                #region 拉取12315工单办理信息
+                //查询是否存在需要拉取办理信息的工单
+                var listSendCaseInfo = await _sendCaseInfoRepository
+                    .Queryable()
+                    .OrderBy(p => p.CreationTime)
+                    .ToListAsync();
+                //处理数据
+                if (listSendCaseInfo != null && listSendCaseInfo.Count > 0)
+                {
+                    foreach (var item in listSendCaseInfo)
+                        await _mediator.Publish(new GetCaseDistrecordSendNotification(item.CaseSerial));
+                }
+                else
+                    isContinue = false; 
+                #endregion
 
+                //如果数据都为空,停止
                 if (!isContinue)
                     await Task.Delay(time, stoppingToken);
             }

+ 2 - 2
src/Sharing.Application/Sharing.Application.csproj

@@ -7,8 +7,8 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Hotline.Api.Sdk" Version="1.0.2" />
-    <PackageReference Include="Hotline.Share" Version="1.0.31" />
+    <PackageReference Include="Hotline.Api.Sdk" Version="1.0.4" />
+    <PackageReference Include="Hotline.Share" Version="1.0.33" />
     <PackageReference Include="XF.EasyCaching" Version="1.0.0" />
   </ItemGroup>
 

+ 33 - 5
src/Sharing.Province/Controllers/ReceiveController.cs

@@ -10,6 +10,7 @@ using Sharing.Province.Dtos;
 using Sharing.Province.Dtos.XieTong.Receive;
 using Sharing.Province.Extend;
 using Sharing.Province.XieTong.Receive;
+using Sharing.Province.XieTong.Send;
 using Sharing.Share.Dtos;
 using Sharing.WebCore;
 using XF.Domain.Repository;
@@ -50,6 +51,8 @@ namespace Sharing.Province.Controllers
         private readonly IRepository<ReceiveCaseExtends> _receiveCaseExtendsRepository;
         private readonly IRepository<GetCaseMaterialInfo> _getCaseMaterialInfoRepository;
         private readonly IHotlineClient _hotlineClient;
+        private readonly IRepository<SendCaseInfo> _sendCaseInfoRepository;
+        private readonly IRepository<GetCaseBackApply> _getCaseBackApplyRepository;
 
 
         /// <summary>
@@ -82,6 +85,8 @@ namespace Sharing.Province.Controllers
         /// <param name="receiveCaseExtendsRepository"></param>
         /// <param name="getCaseMaterialInfoRepository"></param>
         /// <param name="hotlineClient"></param>
+        /// <param name="sendCaseInfoRepository"></param>
+        /// <param name="getCaseBackApplyRepository"></param>
         public ReceiveController(IMapper mapper,
           ICapPublisher capPublisher,
           IRepository<ReceiveCaseInfo> receiveCaseInfoRepository,
@@ -108,7 +113,9 @@ namespace Sharing.Province.Controllers
           IRepository<FormTaxationConsulting> formTaxationConsultingRepository,
           IRepository<ReceiveCaseExtends> receiveCaseExtendsRepository,
           IRepository<GetCaseMaterialInfo> getCaseMaterialInfoRepository,
-          IHotlineClient hotlineClient)
+          IHotlineClient hotlineClient,
+          IRepository<SendCaseInfo> sendCaseInfoRepository,
+          IRepository<GetCaseBackApply> getCaseBackApplyRepository)
         {
             _mapper = mapper;
             _capPublisher = capPublisher;
@@ -137,6 +144,8 @@ namespace Sharing.Province.Controllers
             _receiveCaseExtendsRepository = receiveCaseExtendsRepository;
             _getCaseMaterialInfoRepository = getCaseMaterialInfoRepository;
             _hotlineClient = hotlineClient;
+            _sendCaseInfoRepository = sendCaseInfoRepository;
+            _getCaseBackApplyRepository = getCaseBackApplyRepository;
         }
         #endregion
 
@@ -269,16 +278,27 @@ namespace Sharing.Province.Controllers
             //转换数据
             var dto = _mapper.Map<GetCaseBackResult>(receiveBackResult.paras);
 
+            var data = await _getCaseBackApplyRepository.GetAsync(p => p.CaseSerial == dto.CaseSerial);
+            if (data == null)
+                return Reponse.Failed("接口调用失败!");
+
             //添加数据
             var id = await _getCaseBackResultRepository.AddAsync(dto, HttpContext.RequestAborted);
 
             if (!string.IsNullOrEmpty(id))
             {
-                //向业务系统推送消息
-                await _capPublisher.PublishAsync(Sharing.Share.Mq.EventNames.SharingOrderReturnFeedback, _mapper.Map<ReturnFeedbackDto>(dto), cancellationToken: HttpContext.RequestAborted);
-                return Reponse.Success("您已成功提交数据!");
-            }
+                var result = await _hotlineClient.OrderSendBackResultAsync(new OrderSendBackResultDto()
+                {
+                    Id = data.OrderSendBackId,
+                    Reason = dto.BackReason,
+                    Result = dto.Result == true ? 1 : 0
+                }, default);
 
+                if (result.IsSuccess)
+                    return Reponse.Success("您已成功提交数据!");
+                else
+                    return Reponse.Failed("接口调用失败!");
+            }
             else
                 return Reponse.Failed("接口调用失败!");
         }
@@ -574,6 +594,14 @@ namespace Sharing.Province.Controllers
 
             if (!string.IsNullOrEmpty(id))
             {
+                //查询此工单
+                var tempData = await _sendCaseInfoRepository.GetAsync(p => p.CaseSerial == dto.CaseSerial, HttpContext.RequestAborted);
+                if (tempData != null)
+                {
+                    //将工单的办理状态改为办理完成,终止拉取办理信息
+                    tempData.IsEnd = true;
+                    await _sendCaseInfoRepository.UpdateAsync(tempData, HttpContext.RequestAborted);
+                }
                 //向业务系统推送消息
                 await _capPublisher.PublishAsync(Sharing.Share.Mq.EventNames.SharingOrderReultSend, _mapper.Map<ReultSendDto>(dto), cancellationToken: HttpContext.RequestAborted);
                 return Reponse.Success("您已成功提交数据!");

+ 2 - 2
src/Sharing.Province/Dtos/XieTong/Receive/GetCaseBackResultRequest.cs

@@ -70,9 +70,9 @@ namespace Sharing.Province.Dtos.XieTong.Receive
         /// <summary>
         /// 退回原因
         /// </summary>
-        [JsonPropertyName("REASON")]
+        [JsonPropertyName("BACKREASON")]
         [MDisplayName("原因")]
         [VRequired]
-        public string Reason { get; set; }
+        public string BackReason { get; set; }
     }
 }

+ 1 - 1
src/Sharing/Province/XieTong/Receive/GetCaseBackResult.cs

@@ -43,6 +43,6 @@ namespace Sharing.Province.XieTong.Receive
         /// 退回原因
         /// </summary>
         [SugarColumn(ColumnDescription = "退回原因", ColumnDataType = "text")]
-        public string Reason { get; set; }
+        public string BackReason { get; set; }
     }
 }

+ 6 - 0
src/Sharing/Province/XieTong/Send/GetCaseBackApply.cs

@@ -10,6 +10,12 @@ namespace Sharing.Province.XieTong.Send
     [Description("退回申请")]
     public class GetCaseBackApply : BaseSendAllResult
     {
+        /// <summary>
+        /// 业务系统退回编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "业务系统退回编号", ColumnDataType = "varchar(10)")]
+        public string OrderSendBackId { get; set; }
+
         /// <summary>
         /// 办理操作
         /// </summary>

+ 6 - 0
src/Sharing/Province/XieTong/Send/SendCaseInfo.cs

@@ -171,5 +171,11 @@ namespace Sharing.Province.XieTong.Send
         /// </summary>
         [SugarColumn(ColumnDescription = "是否存在拓展信息", ColumnDataType = "varchar(50)", IsNullable = true)]
         public string IsExtends { get; set; }
+
+        /// <summary>
+        /// 当前工单是否办理完成
+        /// </summary>
+        [SugarColumn(ColumnDescription = "当前工单是否办理完成")]
+        public bool IsEnd { get; set; }
     }
 }