Jelajahi Sumber

fixed: 省工单特提方法传入期满时间

xf 6 bulan lalu
induk
melakukan
7b306a7cbc

File diff ditekan karena terlalu besar
+ 353 - 264
src/Hotline.Application/Orders/OrderApplication.cs


+ 25 - 18
src/Hotline.Application/Subscribers/DatasharingSubscriber.cs

@@ -95,8 +95,8 @@ namespace Hotline.Application.Subscribers
             IOrderApplication orderApplication,
             ISystemSettingCacheManager systemSettingCacheManager,
             IRepository<OrderWarning> orderWarningRepository,
-             IRepository<OrderRevoke> orderRevokeRepository,
-             IRepository<ContingencyManagementOrders> contingencyManagementOrdersRepository,
+            IRepository<OrderRevoke> orderRevokeRepository,
+            IRepository<ContingencyManagementOrders> contingencyManagementOrdersRepository,
             IOptionsSnapshot<AppConfiguration> appOptions,
             ICallApplication callApplication,
             IRepository<OrderPublish> orderPublishRepository,
@@ -173,6 +173,7 @@ namespace Hotline.Application.Subscribers
                 {
                     order.Status = EOrderStatus.WaitForAccept;
                 }
+
                 if (dto.Result is 1)
                     order.ProvinceSendBack = true;
                 else
@@ -226,7 +227,6 @@ namespace Hotline.Application.Subscribers
                 //}
                 await _orderSendBackRepository.UpdateAsync(sendBack, cancellationToken);
             }
-
         }
 
         /// <summary>
@@ -259,6 +259,8 @@ namespace Hotline.Application.Subscribers
             };
             await _orderRevokeRepository.AddAsync(orderRevoke, cancellationToken);
 
+            //todo 计算order 期满时间
+            
             //宜宾需求:特提至中心(优先派单组无派单组节点就特提至坐席),由派单员归档
             var current = SessionContextCreator.CreateSessionContext(_sessionContext, dto.Source, _cityBaseConfiguration.Value);
             if (string.IsNullOrEmpty(order?.WorkflowId))
@@ -273,7 +275,8 @@ namespace Hotline.Application.Subscribers
             }
             else
             {
-                await _workflowDomainService.RecallToCenterFirstToSendAsync(order.WorkflowId, dto.Opinion, current, order.Status >= EOrderStatus.Filed, cancellationToken);
+                await _workflowDomainService.RecallToCenterFirstToSendAsync(order.WorkflowId, dto.Opinion, current,
+                    order.Status >= EOrderStatus.Filed, order.ExpiredTime, cancellationToken);
             }
         }
 
@@ -392,7 +395,8 @@ namespace Hotline.Application.Subscribers
             if (exists)
                 throw new UserFriendlyException($"收到重复督办编号: {dto.ProvinceOrderSuperviseDto.SuperviseSerial}");
 
-            var order = await _orderRepository.Queryable().Where(x => x.ReceiveProvinceNo == dto.ProvinceOrderSuperviseDto!.CaseSerial).FirstAsync(cancellationToken);
+            var order = await _orderRepository.Queryable().Where(x => x.ReceiveProvinceNo == dto.ProvinceOrderSuperviseDto!.CaseSerial)
+                .FirstAsync(cancellationToken);
             var org = await _systemOrganizeRepository.GetAsync(x => x.Id == order.ActualHandleOrgCode, cancellationToken);
             var model = new OrderSupervise();
             model.InitId();
@@ -488,7 +492,7 @@ namespace Hotline.Application.Subscribers
                 .Includes(x => x.Order)
                 .Includes(x => x.OrderVisitDetails)
                 .Where(x => x.Order.ReceiveProvinceNo == dto.ProvinceNo &&
-             x.VisitState != Share.Enums.Order.EVisitState.None).FirstAsync(cancellationToken);
+                            x.VisitState != Share.Enums.Order.EVisitState.None).FirstAsync(cancellationToken);
 
             if (orderVisit != null)
             {
@@ -505,6 +509,7 @@ namespace Hotline.Application.Subscribers
                         orgProcessingResults.Key = dicData.DicDataValue;
                         orgProcessingResults.Value = dicData.DicDataName;
                     }
+
                     if (orgProcessingResults != null)
                     {
                         //主表
@@ -527,8 +532,10 @@ namespace Hotline.Application.Subscribers
                             {
                                 orderVisit.OrderVisitDetails[i].OrgProcessingResults = orgProcessingResults;
                             }
+
                             orderVisit.OrderVisitDetails[i].VisitContent = dto.VisitContent;
                         }
+
                         await _orderVisitedDetailRepository.UpdateRangeAsync(orderVisit.OrderVisitDetails, cancellationToken);
                         //工单
                         orderVisit.Order.Visited(orgProcessingResults.Key, orgProcessingResults.Value);
@@ -570,8 +577,7 @@ namespace Hotline.Application.Subscribers
                 {
                     //判断是否有发布数据
                     var orderPublish = await _orderPublishRepository.Queryable()
-                        .Includes(x => x.Order).
-                        Where(x => x.Order.ReceiveProvinceNo == dto.ProvinceNo).FirstAsync(cancellationToken);
+                        .Includes(x => x.Order).Where(x => x.Order.ReceiveProvinceNo == dto.ProvinceNo).FirstAsync(cancellationToken);
                     if (orderPublish == null)
                     {
                         orderPublish = new OrderPublish();
@@ -600,7 +606,9 @@ namespace Hotline.Application.Subscribers
                     orderVisit.VisitType = dto.VisitType;
                     orderVisit.IsCanAiVisit = false;
                     orderVisit.IsCanHandle = false;
-                    var VisitSatisfaction = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.VisitSatisfaction).Where(x => x.DicDataValue == dto.OrgProcessingResults).Select(m => new Kv { Key = m.DicDataValue, Value = m.DicDataName }).FirstOrDefault();
+                    var VisitSatisfaction = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.VisitSatisfaction)
+                        .Where(x => x.DicDataValue == dto.OrgProcessingResults).Select(m => new Kv { Key = m.DicDataValue, Value = m.DicDataName })
+                        .FirstOrDefault();
                     var satisfy = VisitSatisfaction;
                     orderVisit.NowEvaluate = satisfy;
                     string visitId = await _orderVisitRepository.AddAsync(orderVisit);
@@ -634,10 +642,7 @@ namespace Hotline.Application.Subscribers
                     order.Visited(satisfy.Key, satisfy.Value);
                     order.Status = EOrderStatus.Visited;
                     await _orderRepository.UpdateAsync(order, cancellationToken);
-
                 }
-
-
             }
         }
 
@@ -710,7 +715,8 @@ namespace Hotline.Application.Subscribers
             {
                 case "0":
                     //退回:撤回至发起人
-                    await _workflowDomainService.RecallToStartStepAsync(order.WorkflowId, dto.Opinion, current, order.Status >= EOrderStatus.Filed, cancellationToken);//todo think是否需要保存附件至省平台办理节点?
+                    await _workflowDomainService.RecallToStartStepAsync(order.WorkflowId, dto.Opinion, current, order.Status >= EOrderStatus.Filed,
+                        cancellationToken); //todo think是否需要保存附件至省平台办理节点?
                     break;
                 case "1":
                     //办结:归档
@@ -899,7 +905,8 @@ namespace Hotline.Application.Subscribers
         [CapSubscribe(EventNames.SharingOrderTranspondCity)]
         public async Task RecTranspondCityRawDataAsync(TranspondCityRawDataDto dto, CancellationToken cancellationToken)
         {
-            var data = await _transpondCityRawDataRepository.GetAsync(p => p.OrderCode == dto.OrderCode && p.Direction == ETranspondDirection.Out, cancellationToken);
+            var data = await _transpondCityRawDataRepository.GetAsync(p => p.OrderCode == dto.OrderCode && p.Direction == ETranspondDirection.Out,
+                cancellationToken);
             if (data != null)
             {
                 data.IsSuccess = dto.IsSuccess;
@@ -936,8 +943,10 @@ namespace Hotline.Application.Subscribers
                     //后面还需要处理流程中的意见
                 }
             }
+
             //修改推送数据办理结果
-            var data = await _transpondCityRawDataRepository.GetAsync(p => p.OrderCode == dto.No && p.Direction == ETranspondDirection.Out, cancellationToken);
+            var data = await _transpondCityRawDataRepository.GetAsync(p => p.OrderCode == dto.No && p.Direction == ETranspondDirection.Out,
+                cancellationToken);
             if (data != null)
             {
                 data.ActualOpinion = dto.Opinion;
@@ -1007,7 +1016,6 @@ namespace Hotline.Application.Subscribers
                 //这里需要判断是否是警情退回
                 orderFlowDto.IsNonPoliceReturn = false;
                 await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: cancellationToken);
-
             }
         }
 
@@ -1033,5 +1041,4 @@ namespace Hotline.Application.Subscribers
             //todo
         }
     }
-
-}
+}

+ 20 - 15
src/Hotline/FlowEngine/Workflows/IWorkflowDomainService.cs

@@ -72,19 +72,22 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 撤回至开始节点
         /// </summary>
-        Task RecallToStartStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, CancellationToken cancellationToken);
+        Task RecallToStartStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, DateTime? expiredTime,
+            CancellationToken cancellationToken);
 
         /// <summary>
         /// 特提至派单节点(无派单节点会抛异常)
         /// </summary>
-        Task RecallToSendStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, CancellationToken cancellationToken);
+        Task RecallToSendStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, DateTime? expiredTime,
+            CancellationToken cancellationToken);
 
         /// <summary>
         /// 特提至中心(优先派单组其次坐席)
         /// </summary>
         /// <returns></returns>
-        Task RecallToCenterFirstToSendAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, CancellationToken cancellationToken);
-        
+        Task RecallToCenterFirstToSendAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled, DateTime? expiredTime,
+            CancellationToken cancellationToken);
+
         ///// <summary>
         ///// 跳转(直接将流程跳转至任意节点)
         ///// </summary>
@@ -237,7 +240,8 @@ namespace Hotline.FlowEngine.Workflows
         /// 批量修改工单办理对象
         /// </summary>
         Task ChangeHandlerBatchAsync(
-            IReadOnlyList<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers,
+            IReadOnlyList<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep>
+                steps)> handlers,
             CancellationToken cancellationToken);
 
         /// <summary>
@@ -256,21 +260,22 @@ namespace Hotline.FlowEngine.Workflows
         /// <returns></returns>
         Task<WorkflowStep> FindLastHandleStepAsync(string workflowId, string orgId, CancellationToken cancellation);
 
-		/// <summary>
-		/// 部门会签工单获取流程最顶级办理节点
-		/// </summary>
-		/// <returns></returns>
-		Task<WorkflowStep> FindTopHandleStepAsync(string workflowId, CancellationToken cancellation);
+        /// <summary>
+        /// 部门会签工单获取流程最顶级办理节点
+        /// </summary>
+        /// <returns></returns>
+        Task<WorkflowStep> FindTopHandleStepAsync(string workflowId, CancellationToken cancellation);
 
-		/// <summary>
-		/// 查询流转方向
-		/// </summary>
-		EFlowDirection GetFlowDirection(EBusinessType sourceStepBusinessType, EBusinessType directionStepBusinessType);
+        /// <summary>
+        /// 查询流转方向
+        /// </summary>
+        EFlowDirection GetFlowDirection(EBusinessType sourceStepBusinessType, EBusinessType directionStepBusinessType);
 
         /// <summary>
         /// 流程被签收至某个用户(更新流转对象,办理对象,节点办理对象以及stepHandlers)
         /// </summary>
-        Task<Workflow> SignToSomebodyAsync(string workflowId, string userId, string username, string orgId, string orgName, CancellationToken cancellationToken);
+        Task<Workflow> SignToSomebodyAsync(string workflowId, string userId, string username, string orgId, string orgName,
+            CancellationToken cancellationToken);
 
         /// <summary>
         /// 非节点办理人员查询待办节点

+ 7 - 7
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -1088,7 +1088,7 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 撤回至开始节点
         /// </summary>
-        public async Task RecallToStartStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled,
+        public async Task RecallToStartStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled,DateTime? expiredTime,
             CancellationToken cancellationToken)
         {
             //todo 1.当前待办节点删掉 2.当前待办trace更新(status, opinion) 3.复制startStep为待办 4.更新workflow(status, csStatus, handlers) 5.publish event
@@ -1123,13 +1123,13 @@ namespace Hotline.FlowEngine.Workflows
             var flowAssignInfo = await GetNextStepFlowAssignInfoByDefineAsync(targetStepDefine, dto.HandlerType, dto.IsStartCountersign,
                 dto.NextHandlers.Select(d => new Kv(d.Key, d.Value)).ToList(), cancellationToken);
             //flowAssignInfo.FlowAssignType = EFlowAssignType.Role;
-            await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, null, isOrderFiled, cancellationToken);
+            await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, expiredTime, isOrderFiled, cancellationToken);
         }
 
         /// <summary>
         /// 撤回至派单节点
         /// </summary>
-        public async Task RecallToSendStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled,
+        public async Task RecallToSendStepAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled,DateTime? expiredTime,
             CancellationToken cancellationToken)
         {
             var workflow = await GetWorkflowAsync(workflowId, withDefine: true, withSteps: true, withTraces: true, withCountersigns: true,
@@ -1163,7 +1163,7 @@ namespace Hotline.FlowEngine.Workflows
             var flowAssignInfo = await GetNextStepFlowAssignInfoByDefineAsync(targetStepDefine, dto.HandlerType, dto.IsStartCountersign,
                 dto.NextHandlers.Select(d => new Kv(d.Key, d.Value)).ToList(), cancellationToken);
             //flowAssignInfo.FlowAssignType = EFlowAssignType.Role;
-            await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, null, isOrderFiled, cancellationToken);
+            await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, expiredTime, isOrderFiled, cancellationToken);
         }
 
         /// <summary>
@@ -1171,7 +1171,7 @@ namespace Hotline.FlowEngine.Workflows
         /// </summary>
         /// <returns></returns>
         public async Task RecallToCenterFirstToSendAsync(string workflowId, string opinion, ISessionContext current, bool isOrderFiled,
-            CancellationToken cancellationToken)
+            DateTime? expiredTime,  CancellationToken cancellationToken)
         {
             var workflow = await GetWorkflowAsync(workflowId, withDefine: true, withSteps: true, withTraces: true, withCountersigns: true,
                 cancellationToken: cancellationToken);
@@ -1200,7 +1200,7 @@ namespace Hotline.FlowEngine.Workflows
                 };
                 var flowAssignInfo = await GetNextStepFlowAssignInfoByDefineAsync(targetStepDefine, dto.HandlerType, dto.IsStartCountersign,
                     dto.NextHandlers.Select(d => new Kv(d.Key, d.Value)).ToList(), cancellationToken);
-                await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, null, isOrderFiled, cancellationToken);
+                await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, expiredTime, isOrderFiled, cancellationToken);
             }
             else
             {
@@ -1233,7 +1233,7 @@ namespace Hotline.FlowEngine.Workflows
                 var flowAssignInfo = await GetNextStepFlowAssignInfoByDefineAsync(targetStepDefine, dto.HandlerType, dto.IsStartCountersign,
                     dto.NextHandlers.Select(d => new Kv(d.Key, d.Value)).ToList(), cancellationToken);
                 //flowAssignInfo.FlowAssignType = EFlowAssignType.Role;
-                await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, null, isOrderFiled, cancellationToken);
+                await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, expiredTime, isOrderFiled, cancellationToken);
             }
         }
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini