Bläddra i källkod

fixed: 发起流程直接归档未给startStep赋值

xf 1 år sedan
förälder
incheckning
7bafb9be43

+ 5 - 0
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -149,6 +149,11 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
         var startStep = _workflowDomainService.CreateStartStep(workflow, startStepDefine, dto,
             new List<Kv> { new(_sessionContext.RequiredUserId, _sessionContext.UserName) });
 
+        startStep.Handle(_sessionContext.RequiredUserId, _sessionContext.UserName,
+            _sessionContext.RequiredOrgId, _sessionContext.OrgName,
+            _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
+            _sessionContext.OrgIsCenter, firstStepDefine.Code);
+
         if (dto.Files.Any())
             startStep.FileJson = await _fileRepository.AddFileAsync(dto.Files, workflow.ExternalId, startStep.Id, cancellationToken);
 

+ 50 - 161
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -462,32 +462,32 @@ public partial class Workflow
         ClearHandlers();
     }
 
-    /// <summary>
-    /// 更新实际办理节点、部门数据
-    /// </summary>
-    private void ActualHandle(
-        WorkflowStep currentStep,
-        string? actualHandlerId,
-        string? actualHandlerName,
-        string? actualHandleOrgCode,
-        string? actualHandleOrgName,
-        string? actualHandleOrgAreaCode,
-        string? actualHandleOrgAreaName)
-    {
-        ActualHandleStepCode = currentStep.Code;
-        ActualHandleStepName = currentStep.Name;
-        ActualHandleStepId = currentStep.Id;
-        ActualHandleStepCreateTime = currentStep.CreationTime;
-
-        ActualHandleStepAcceptTime = currentStep.AcceptTime;
-        ActualHandleTime = DateTime.Now;
-        ActualHandlerId = actualHandlerId;
-        ActualHandlerName = actualHandlerName;
-        ActualHandleOrgCode = actualHandleOrgCode;
-        ActualHandleOrgName = actualHandleOrgName;
-        ActualHandleOrgAreaCode = actualHandleOrgAreaCode;
-        ActualHandleOrgAreaName = actualHandleOrgAreaName;
-    }
+    ///// <summary>
+    ///// 更新实际办理节点、部门数据
+    ///// </summary>
+    //private void ActualHandle(
+    //    WorkflowStep currentStep,
+    //    string? actualHandlerId,
+    //    string? actualHandlerName,
+    //    string? actualHandleOrgCode,
+    //    string? actualHandleOrgName,
+    //    string? actualHandleOrgAreaCode,
+    //    string? actualHandleOrgAreaName)
+    //{
+    //    ActualHandleStepCode = currentStep.Code;
+    //    ActualHandleStepName = currentStep.Name;
+    //    ActualHandleStepId = currentStep.Id;
+    //    ActualHandleStepCreateTime = currentStep.CreationTime;
+
+    //    ActualHandleStepAcceptTime = currentStep.AcceptTime;
+    //    ActualHandleTime = DateTime.Now;
+    //    ActualHandlerId = actualHandlerId;
+    //    ActualHandlerName = actualHandlerName;
+    //    ActualHandleOrgCode = actualHandleOrgCode;
+    //    ActualHandleOrgName = actualHandleOrgName;
+    //    ActualHandleOrgAreaCode = actualHandleOrgAreaCode;
+    //    ActualHandleOrgAreaName = actualHandleOrgAreaName;
+    //}
 
     /// <summary>
     /// 归档时为最终办理意见赋值
@@ -513,34 +513,34 @@ public partial class Workflow
         ActualHandleStepAcceptTime = step.AcceptTime;
     }
 
-    /// <summary>
-    /// 更新workflow中实际办理节点数据(节点,时间,部门)
-    /// </summary>
-    public void UpdateWorkflowActualHandleInfo(WorkflowStep currentStep,
-        string actualHandlerId, string? actualHandlerName,
-        string actualHandleOrgCode, string? actualHandleOrgName,
-        string? actualHandleOrgAreaCode, string? actualHandleOrgAreaName,
-        int currentHandlerOrgLevel)
-    {
-        /*
-          a.会签中:记录顶级会签发起节点, 会签结束前不更新。会签结束后再发起会签才会记录下一次会签的顶级发起节点
-          b.非会签中,记录当前节点
-        */
-        if (currentStep.IsInCountersign()) return;
+    ///// <summary>
+    ///// 更新workflow中实际办理节点数据(节点,时间,部门)
+    ///// </summary>
+    //public void UpdateWorkflowActualHandleInfo(WorkflowStep currentStep,
+    //    string actualHandlerId, string? actualHandlerName,
+    //    string actualHandleOrgCode, string? actualHandleOrgName,
+    //    string? actualHandleOrgAreaCode, string? actualHandleOrgAreaName,
+    //    int currentHandlerOrgLevel)
+    //{
+    //    /*
+    //      a.会签中:记录顶级会签发起节点, 会签结束前不更新。会签结束后再发起会签才会记录下一次会签的顶级发起节点
+    //      b.非会签中,记录当前节点
+    //    */
+    //    if (currentStep.IsInCountersign()) return;
 
-        if (currentStep.StepType is EStepType.Summary or EStepType.End) return;
+    //    if (currentStep.StepType is EStepType.Summary or EStepType.End) return;
 
-        ActualHandle(currentStep,
-            actualHandlerId, actualHandlerName,
-            actualHandleOrgCode, actualHandleOrgName,
-            actualHandleOrgAreaCode, actualHandleOrgAreaName);
+    //    ActualHandle(currentStep,
+    //        actualHandlerId, actualHandlerName,
+    //        actualHandleOrgCode, actualHandleOrgName,
+    //        actualHandleOrgAreaCode, actualHandleOrgAreaName);
 
-        //SetHandleDuration();
+    //    //SetHandleDuration();
 
-        //实际办理部门为一级部门时记录
-        if (currentHandlerOrgLevel == 1)
-            UpdateLevelOneOrg(actualHandleOrgCode, actualHandleOrgName);
-    }
+    //    //实际办理部门为一级部门时记录
+    //    if (currentHandlerOrgLevel == 1)
+    //        UpdateLevelOneOrg(actualHandleOrgCode, actualHandleOrgName);
+    //}
 
     /// <summary>
     /// 指派、未办理时调用
@@ -591,117 +591,6 @@ public partial class Workflow
             UpdateLevelOneOrg(handleOrgId, handleOrgName);
     }
 
-    ///// <summary>
-    ///// 更新当前办理节点信息
-    ///// </summary>
-    //public void UpdateWorkflowCurrentStepInfo1(
-    //    bool isStartCountersign,
-    //    string? handlerId,
-    //    string? handlerName,
-    //    string? handleOrgCode,
-    //    string? handleOrgName,
-    //    string? handleOrgAreaCode,
-    //    string? handleOrgAreaName,
-    //    WorkflowStep? currentStep = null,
-    //    WorkflowStep? nextStep = null)
-    //{
-    //    //非会签:指当前被指派节点,会签:会签发起节点
-    //    if (IsInCountersign) return;
-
-    //    if (isStartCountersign && currentStep is null)
-    //        throw new UserFriendlyException("开启会签时,会签发起节点不能为空");
-
-    //    if (!isStartCountersign && nextStep is null)
-    //        throw new UserFriendlyException("未开启会签时,被指派节点不能为空");
-
-    //    CurrentHandle(
-    //        isStartCountersign ? currentStep : nextStep,
-    //        handlerId,
-    //        handlerName,
-    //        handleOrgCode,
-    //        handleOrgName,
-    //        handleOrgAreaCode,
-    //        handleOrgAreaName
-    //    );
-    //}
-
-    //public void CurrentHandle(
-    //    WorkflowStep step,
-    //    string? handlerId,
-    //    string? handlerName,
-    //    string? handleOrgCode,
-    //    string? handleOrgName,
-    //    string? handleOrgAreaCode,
-    //    string? handleOrgAreaName)
-    //{
-    //    CurrentStepCode = step.Code;
-    //    CurrentStepName = step.Name;
-    //    CurrentStepId = step.Id;
-    //    CurrentStepCreateTime = step.CreationTime;
-
-    //    CurrentHandleStepAcceptTime = step.AcceptTime;
-    //    CurrentHandleTime = DateTime.Now;
-    //    CurrentHandlerId = handlerId;
-    //    CurrentHandlerName = handlerName;
-    //    CurrentHandleOrgCode = handleOrgCode;
-    //    CurrentHandleOrgName = handleOrgName;
-    //    CurrentHandleOrgAreaCode = handleOrgAreaCode;
-    //    CurrentHandleOrgAreaName = handleOrgAreaName;
-    //}
-
-    ///// <summary>
-    ///// 指派、未办理时调用
-    ///// </summary>
-    //public void UpdateWorkflowCurrentStepInfo(WorkflowStep nextStep, Kv handler, EHandlerType handlerType)
-    //{
-    //    ResetCurrentStepInfo();
-    //    CurrentStepCode = nextStep.Code;
-    //    CurrentStepName = nextStep.Name;
-    //    CurrentStepId = nextStep.Id;
-    //    CurrentStepCreateTime = nextStep.CreationTime;
-    //    CurrentHandlerKey = handler.Key;
-    //    CurrentHandlerValue = handler.Value;
-    //    CurrentHandlerType = handlerType;
-    //}
-
-    ///// <summary>
-    ///// 办理时调用
-    ///// </summary>
-    //public void UpdateWorkflowCurrentStepInfo(
-    //    WorkflowStep currentStep,
-    //    string handlerId,
-    //    string? handlerName,
-    //    string handleOrgId,
-    //    string? handleOrgName,
-    //    string? handleOrgAreaCode,
-    //    string? handleOrgAreaName)
-    //{
-    //    CurrentStepCode = currentStep.Code;
-    //    CurrentStepName = currentStep.Name;
-    //    CurrentStepId = currentStep.Id;
-    //    CurrentStepCreateTime = currentStep.CreationTime;
-    //    CurrentHandleStepAcceptTime = currentStep.AcceptTime;
-    //    CurrentHandleTime = currentStep.HandleTime;
-    //    CurrentHandlerId = handlerId;
-    //    CurrentHandlerName = handlerName;
-    //    CurrentHandleOrgCode = handleOrgId;
-    //    CurrentHandleOrgName = handleOrgName;
-    //    CurrentHandleOrgAreaCode = handleOrgAreaCode;
-    //    CurrentHandleOrgAreaName = handleOrgAreaName;
-    //}
-
-    //private void ResetCurrentStepInfo()
-    //{
-    //    CurrentHandleStepAcceptTime = null;
-    //    CurrentHandleTime = null;
-    //    CurrentHandlerId = null;
-    //    CurrentHandlerName = null;
-    //    CurrentHandleOrgCode = null;
-    //    CurrentHandleOrgName = null;
-    //    CurrentHandleOrgAreaCode = null;
-    //    CurrentHandleOrgAreaName = null;
-    //}
-
     private void ResetActualStepInfo()
     {
         ActualHandleStepAcceptTime = null;

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

@@ -1252,8 +1252,8 @@ namespace Hotline.FlowEngine.Workflows
             //办理参数
             _mapper.Map(dto, step);
 
-            //step办理状态
-            HandleStep(step, dto.NextStepCode);
+            ////step办理状态
+            //HandleStep(step, dto.NextStepCode);
         }
 
         private bool CheckIsActualHandle(Workflow workflow, WorkflowStep step, StepDefine nextStepDefine,