Sfoglia il codice sorgente

feature: 如果中心会签后仍然在往部门派,系统就把这个工单视为非会签工单

xf 6 mesi fa
parent
commit
fe7d697c5e

+ 32 - 45
src/Hotline.Application/Handlers/FlowEngine/WorkflowNextHandler.cs

@@ -53,7 +53,7 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
     private readonly ISystemSettingCacheManager _systemSettingCacheManager;
     private readonly Publisher _publisher;
 
-	public WorkflowNextHandler(
+    public WorkflowNextHandler(
         IOrderDomainService orderDomainService,
         IOrderRepository orderRepository,
         ICapPublisher capPublisher,
@@ -118,54 +118,35 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
 
                     if (_appOptions.Value.IsZiGong && data.FlowDirection is EFlowDirection.CenterToOrg)
                     {
-                        var expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg , order.Adapt<OrderTimeClacInfo>());
+                        var expiredTimeConfig =
+                            await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.Adapt<OrderTimeClacInfo>());
                         order.CenterToOrg(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
                             expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime
-                            , expiredTimeConfig.NearlyExpiredTimeOne, notification.Dto.Opinion,notification.Trace.HandlerId, notification.Trace.HandlerName,true);
+                            , expiredTimeConfig.NearlyExpiredTimeOne, notification.Dto.Opinion, notification.Trace.HandlerId,
+                            notification.Trace.HandlerName, true);
                     }
 
-                    //var expiredTimeChanged = false;
-                    //if (data.FlowDirection.HasValue
-                    //    && data.External.TimeLimit.HasValue                   
-                    //    && data.External.TimeLimitUnit.HasValue)
-                    //{
-                    //    // 1. calc expiredTime 2. update order.expiredTime 3. update workflow.expiredTime 4. publish province
-
-                    //    // var expiredTime = _timeLimitDomainService.CalcEndTime(DateTime.Now,
-                    //    //     data.External.TimeLimitUnit.Value,
-                    //    //     data.External.TimeLimit.Value, data.FlowDirection is EFlowDirection.OrgToCenter);
-
-                    //    var expiredTimeConfig = _timeLimitDomainService.CalcEndTime(DateTime.Now,
-                    //        new TimeConfig(data.External.TimeLimit.Value, data.External.TimeLimitUnit.Value), order.AcceptTypeCode);
-
-                    //    if (data.FlowDirection is EFlowDirection.OrgToCenter)
-                    //    {
-                    //        order.OrgToCenter(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
-                    //            expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime);
-                    //    }
-                    //    else if (data.FlowDirection is EFlowDirection.CenterToOrg)
-                    //    {
-                    //        order.CenterToOrg(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
-                    //            expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime);
-                    //        //写入质检
-                    //        await _qualityApplication.AddQualityAsync(EQualitySource.Send, order.Id, cancellationToken);
-                    //    }
-
-                    //    await _workflowDomainService.UpdateExpiredTimeAsync(workflow,
-                    //        expiredTimeConfig.ExpiredTime, expiredTimeConfig.TimeText,
-                    //        expiredTimeConfig.Count, expiredTimeConfig.TimeType, expiredTimeConfig.NearlyExpiredTime, cancellationToken);
+                    if (order.CounterSignType is ECounterSignType.Center &&
+                        notification.Trace.BusinessType is EBusinessType.Seat or EBusinessType.Send &&
+                        notification.Workflow.IsTopCountersignEndStep(notification.Trace) &&
+                        data.FlowDirection is EFlowDirection.CenterToOrg)
+                    {
+                        bool.TryParse(
+                            _systemSettingCacheManager.GetSetting(SettingConstants.IsResetCenterCountersignType)?.SettingValue[0],
+                            out bool isResetCenterCountersignType);
+                        if (isResetCenterCountersignType)
+                            order.CounterSignType = null;
+                    }
 
-                    //    expiredTimeChanged = true;
-                    //}
                     if (data.FlowDirection is EFlowDirection.CenterToOrg)
                         order.SendBackAuditEndTime = await _expireTime.GetWorkDay(DateTime.Now);
-					await _orderRepository.Updateable(order).ExecuteCommandAsync(cancellationToken);
-                    //await _orderRepository.UpdateAsync(order, cancellationToken);
+                    await _orderRepository.UpdateAsync(order, cancellationToken);
 
                     //司法行政监督管理-推诿工单
                     //如果没开启则不处理
                     var isOpenJudicialManagement = _systemSettingCacheManager.GetSetting(SettingConstants.IsOpenJudicialManagement)?.SettingValue[0];
-                    if (isOpenJudicialManagement == "true" && notification.Trace.StepType != EStepType.Summary && notification.Trace.StepType != EStepType.End && !notification.Trace.IsCountersignEndStep)
+                    if (isOpenJudicialManagement == "true" && notification.Trace.StepType != EStepType.Summary &&
+                        notification.Trace.StepType != EStepType.End && !notification.Trace.IsCountersignEndStep)
                         await _publisher.PublishAsync(new AddPassTheBuckOrderNotify(order, _sessionContext.RequiredOrgId, _sessionContext.OrgName),
                             PublishStrategy.ParallelWhenAll, cancellationToken);
 
@@ -176,7 +157,8 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                             switch (notification.FlowAssignInfo.FlowAssignType)
                             {
                                 case EFlowAssignType.Org:
-                                    var orgCodes = notification.Trace.NextHandlers.Select(x => x.OrgId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
+                                    var orgCodes = notification.Trace.NextHandlers.Select(x =>
+                                        x.OrgId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
                                     var acceptSmsRoleIds = _systemSettingCacheManager.GetSetting(SettingConstants.AcceptSmsRoleIds)?.SettingValue;
                                     var orgList = await _userRepository.Queryable()
                                         .Where(x => orgCodes.Contains(x.OrgId) && x.Roles.Any(d => acceptSmsRoleIds.Contains(d.Id)))
@@ -196,14 +178,16 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                                                 TemplateCode = "1007",
                                                 Params = new List<string>() { order.No },
                                                 TelNumber = item.PhoneNo,
-
                                             };
                                             await _mediator.Publish(new PushMessageNotify(messageDto), cancellationToken);
                                         }
                                     }
+
                                     break;
                                 case EFlowAssignType.User:
-                                    var userCodes = notification.Trace.NextHandlers.Select(x => x.UserId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
+                                    var userCodes =
+                                        notification.Trace.NextHandlers.Select(x =>
+                                            x.UserId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
                                     var userList = await _userRepository.Queryable()
                                         .Where(x => userCodes.Contains(x.Id) && !string.IsNullOrEmpty(x.PhoneNo))
                                         .ToListAsync(cancellationToken);
@@ -220,17 +204,20 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                                             TemplateCode = "1007",
                                             Params = new List<string>() { order.No },
                                             TelNumber = item.PhoneNo,
-
                                         };
                                         await _mediator.Publish(new PushMessageNotify(messageDto), cancellationToken);
                                     }
+
                                     break;
                                 default:
                                     break;
                             }
                         }
                     }
-                    catch { }
+                    catch
+                    {
+                    }
+
                     var orderDto = _mapper.Map<OrderDto>(order);
                     await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFlowHandled, new OrderFlowDto
                     {
@@ -337,7 +324,8 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                                         await _orderDelayRepository.UpdateAsync(orderDelay);
                                         //推送
                                         var publishOrderDelay = _mapper.Map<PublishOrderDelayDto>(orderDelay);
-                                        await _capPublisher.PublishAsync(EventNames.HotlineOrderApplyDelay, publishOrderDelay, cancellationToken: cancellationToken);
+                                        await _capPublisher.PublishAsync(EventNames.HotlineOrderApplyDelay, publishOrderDelay,
+                                            cancellationToken: cancellationToken);
 
                                         //await _provinceService.DelayCaseInfoSend(publishOrderDelay, cancellationToken);
                                     }
@@ -354,7 +342,6 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
 
                     break;
             }
-
         }
         catch (Exception e)
         {

+ 1 - 1
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -900,7 +900,7 @@ public partial class Workflow
             CsActualHandleOrgIds.Add(orgId);
     }
 
-    public bool IsTopCountersignEndStep(WorkflowStep step)
+    public bool IsTopCountersignEndStep(StepBasicEntity step)
     {
         if (string.IsNullOrEmpty(TopCountersignStepId))
             throw new UserFriendlyException("该流程当前未开启会签");

+ 5 - 2
src/Hotline/Settings/SettingConstants.cs

@@ -524,8 +524,6 @@ namespace Hotline.Settings
 
 		#endregion
 
-        
-
         /// <summary>
         /// 定量查询返回数据条数上限
         /// </summary>
@@ -535,5 +533,10 @@ namespace Hotline.Settings
         /// 旧数据通知公告知识库附件地址	
         /// </summary>
         public const string OldFilesUrls = "OldFilesUrls";
+        
+        /// <summary>
+        /// 是否重置中心会签类型
+        /// </summary>
+        public const string IsResetCenterCountersignType = "IsResetCenterCountersignType";
     }
 }