浏览代码

Merge branch 'master' of http://git.12345lm.cn/Fengwo/hotline

Dun.Jason 1 年之前
父节点
当前提交
04bee1d43e

+ 14 - 11
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -137,13 +137,13 @@ public partial class Workflow : CreationEntity
     /// </summary>
     public string? ActualHandleOrgAreaName { get; set; }
 
-    /// <summary>
-    /// 实际办理对象(会签停留在顶级发起节点)
-    /// 办理时选择的办理对象,可能是部门也可能是用户
-    /// </summary>
-    public string? ActualHandlerValue { get; set; }
-    public string? ActualHandlerKey { get; set; }
-    public EHandlerType? ActualHandlerType { get; set; }
+    ///// <summary>
+    ///// 实际办理对象(会签停留在顶级发起节点)
+    ///// 办理时选择的办理对象,可能是部门也可能是用户
+    ///// </summary>
+    //public string? ActualHandlerValue { get; set; }
+    //public string? ActualHandlerKey { get; set; }
+    //public EHandlerType? ActualHandlerType { get; set; }
 
     /// <summary>
     /// 实际办理意见(办理中...or 最终办理意见)
@@ -545,16 +545,19 @@ public partial class Workflow
     /// <summary>
     /// 指派、未办理时调用
     /// </summary>
-    public void UpdateActualStepWhenAssign(WorkflowStep nextStep, Kv handler, EHandlerType handlerType)
+    public void UpdateActualStepWhenAssign(
+        WorkflowStep nextStep,
+        string? actualHandleOrgName = null,
+        string? actualHandleOrgCode = null
+        )
     {
         ResetActualStepInfo();
         ActualHandleStepCode = nextStep.Code;
         ActualHandleStepName = nextStep.Name;
         ActualHandleStepId = nextStep.Id;
         ActualHandleStepCreateTime = nextStep.CreationTime;
-        ActualHandlerKey = handler.Key;
-        ActualHandlerValue = handler.Value;
-        ActualHandlerType = handlerType;
+        ActualHandleOrgName = actualHandleOrgName;
+        ActualHandleOrgCode = actualHandleOrgCode;
     }
 
     /// <summary>

+ 43 - 10
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -2,6 +2,7 @@
 using Hotline.FlowEngine.Definitions;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WorkflowModules;
+using Hotline.SeedData;
 using Hotline.Settings;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.FlowEngine;
@@ -113,9 +114,9 @@ namespace Hotline.FlowEngine.Workflows
                     _sessionContext.RequiredOrgId, _sessionContext.OrgName,
                     _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
                     _sessionContext.OrgLevel);
-                workflow.ActualHandlerKey = _sessionContext.RequiredUserId;
-                workflow.ActualHandlerValue = _sessionContext.UserName;
-                workflow.ActualHandlerType = EHandlerType.AssignedUser;
+                //workflow.ActualHandlerKey = _sessionContext.RequiredUserId;
+                //workflow.ActualHandlerValue = _sessionContext.UserName;
+                //workflow.ActualHandlerType = EHandlerType.AssignedUser;
 
                 var endTrace = await EndAsync(workflow, dto, firstStepDefine, startStep, cancellationToken: cancellationToken);
                 return;
@@ -150,10 +151,22 @@ namespace Hotline.FlowEngine.Workflows
             //    startStep, firstSteps.First());
 
             //指派实际办理节点
-            if (!workflow.IsInCountersign &&
+            if (workflow.FlowType is EFlowType.Handle &&
+                !workflow.IsInCountersign &&
                 firstStepDefine.StepType != EStepType.Summary &&
                 firstStepDefine.StepType != EStepType.End)
-                workflow.UpdateActualStepWhenAssign(firstSteps.First(), dto.NextHandlers.First(), dto.HandlerType);
+            {
+                if (firstStepDefine.BusinessType is EBusinessType.Center or EBusinessType.Send)
+                {
+                    workflow.UpdateActualStepWhenAssign(firstSteps.First(), actualHandleOrgCode: OrgSeedData.CenterId, actualHandleOrgName: "热线中心");
+                }
+                else
+                {
+                    var nextHandler = dto.NextHandlers.First();
+                    workflow.UpdateActualStepWhenAssign(firstSteps.First(),
+                        actualHandleOrgCode: nextHandler.Key, actualHandleOrgName: nextHandler.Value);
+                }
+            }
 
 
             //发起会签时记录顶层会签节点(必须在update currentStep之后)
@@ -479,11 +492,29 @@ namespace Hotline.FlowEngine.Workflows
             //    _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
             //    currentStep, nextSteps?.FirstOrDefault());
 
+            ////指派实际办理节点
+            //if (!workflow.IsInCountersign &&
+            //    nextStepDefine.StepType != EStepType.Summary &&
+            //    nextStepDefine.StepType != EStepType.End)
+            //    workflow.UpdateActualStepWhenAssign(nextSteps.First(), dto.NextHandlers.First(), dto.HandlerType);
+
             //指派实际办理节点
-            if (!workflow.IsInCountersign &&
+            if (workflow.FlowType is EFlowType.Handle &&
+                !workflow.IsInCountersign &&
                 nextStepDefine.StepType != EStepType.Summary &&
                 nextStepDefine.StepType != EStepType.End)
-                workflow.UpdateActualStepWhenAssign(nextSteps.First(), dto.NextHandlers.First(), dto.HandlerType);
+            {
+                if (nextStepDefine.BusinessType is EBusinessType.Center or EBusinessType.Send)
+                {
+                    workflow.UpdateActualStepWhenAssign(nextSteps.First(), actualHandleOrgCode: OrgSeedData.CenterId, actualHandleOrgName: "热线中心");
+                }
+                else
+                {
+                    var nextHandler = dto.NextHandlers.First();
+                    workflow.UpdateActualStepWhenAssign(nextSteps.First(),
+                        actualHandleOrgCode: nextHandler.Key, actualHandleOrgName: nextHandler.Value);
+                }
+            }
 
             //发起会签时记录顶层会签节点
             if (dto.IsStartCountersign && !workflow.IsInCountersign)
@@ -554,7 +585,9 @@ namespace Hotline.FlowEngine.Workflows
             //    operater.OrgId, operater.Organization.Name,
             //    operater.Organization.AreaCode, operater.Organization.AreaName,
             //    nextStep: newPrevStep);
-            workflow.UpdateActualStepWhenAssign(newPrevStep, prevStep.Handlers.First(), prevStep.HandlerType);
+            //workflow.UpdateActualStepWhenAssign(newPrevStep, prevStep.Handlers.First(), prevStep.HandlerType);
+            workflow.UpdateActualStepWhenAssign(newPrevStep, prevStep.HandlerOrgName, prevStep.HandlerOrgId);
+
 
             //更新流程可办理对象
             workflow.UpdatePreviousHandlers(operater.Id, operater.OrgId, newPrevStep);
@@ -618,7 +651,7 @@ namespace Hotline.FlowEngine.Workflows
             //    _sessionContext.RequiredOrgId, _sessionContext.OrgName,
             //    _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
             //    nextStep: newStartStep);
-            workflow.UpdateActualStepWhenAssign(startStep, startStep.Handlers.First(), startStep.HandlerType);
+            workflow.UpdateActualStepWhenAssign(startStep, startStep.HandlerOrgName, startStep.HandlerOrgId);
 
             var isOrgToCenter = CheckIfFlowFromOrgToCenter(workflow, startStep);
 
@@ -1553,7 +1586,7 @@ namespace Hotline.FlowEngine.Workflows
             //    _sessionContext.RequiredOrgId, _sessionContext.OrgName,
             //    _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
             //    nextStep: targetStepNew);
-            workflow.UpdateActualStepWhenAssign(targetStepNew, targetStep.Handlers.First(), targetStep.HandlerType);
+            workflow.UpdateActualStepWhenAssign(targetStepNew, targetStep.HandlerOrgName, targetStep.HandlerOrgId);
 
             //calc workflow expired time
             var isOrgToCenter = CheckIfFlowFromOrgToCenter(workflow, targetStep);

+ 7 - 7
src/Hotline/Orders/Order.cs

@@ -411,13 +411,13 @@ namespace Hotline.Orders
         /// </summary>
         public string? ActualHandleOrgAreaName { get; set; }
 
-        /// <summary>
-        /// 实际办理对象(会签停留在顶级发起节点)
-        /// 办理时选择的办理对象,可能是部门也可能是用户
-        /// </summary>
-        public string? ActualHandlerValue { get; set; }
-        public string? ActualHandlerKey { get; set; }
-        public EHandlerType? ActualHandlerType { get; set; }
+        ///// <summary>
+        ///// 实际办理对象(会签停留在顶级发起节点)
+        ///// 办理时选择的办理对象,可能是部门也可能是用户
+        ///// </summary>
+        //public string? ActualHandlerValue { get; set; }
+        //public string? ActualHandlerKey { get; set; }
+        //public EHandlerType? ActualHandlerType { get; set; }
 
         /// <summary>
         /// 实际办理意见(办理中...or 最终办理意见)