Browse Source

结束会签时,取消对workflow.TopCountersignStepId赋值

xf 5 tháng trước cách đây
mục cha
commit
63fff889bd

+ 2 - 2
src/Hotline.Api/config/appsettings.Development.json

@@ -62,13 +62,13 @@
     }
   },
   "ConnectionStrings": {
-    "Hotline": "PORT=5432;DATABASE=hotline_dev;HOST=110.188.24.182;PASSWORD=fengwo11!!;USER ID=dev;"
+    "Hotline": "PORT=5432;DATABASE=hotline;HOST=110.188.24.182;PASSWORD=fengwo11!!;USER ID=dev;"
   },
   "Cache": {
     "Host": "110.188.24.182",
     "Port": 50179,
     "Password": "fengwo123!$!$",
-    "Database": 5 //release:3, dev:5
+    "Database": 3 //test:3, dev:5
   },
   "Swagger": true,
   "AccLog":  false,

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

@@ -638,7 +638,11 @@ public partial class Workflow
     /// <summary>
     /// 结束流程会签状态(保留topStepId创建节点时判断用,直到下次会签开启时更新)
     /// </summary>
-    public void EndCountersign() => IsInCountersign = false;
+    public void EndCountersign()
+    {
+        IsInCountersign = false;
+        TopCountersignStepId = null;
+    }
 
     /// <summary>
     /// 重置最终办理意见

+ 21 - 22
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -345,8 +345,7 @@ namespace Hotline.FlowEngine.Workflows
             //结束当前会签流程
             if (currentStep.IsCountersignEndStep)
             {
-                var countersignStartStep =
-                    workflow.Steps.FirstOrDefault(d => d.Id == currentStep.CountersignStartStepId);
+                var countersignStartStep = workflow.Steps.FirstOrDefault(d => d.Id == currentStep.CountersignStartStepId);
                 if (countersignStartStep is null)
                     throw new UserFriendlyException(
                         $"未查询到会签开始step, workflowId: {workflow.Id}, currentStepId: {currentStep.Id}",
@@ -406,8 +405,7 @@ namespace Hotline.FlowEngine.Workflows
                 if (!string.IsNullOrEmpty(currentStep.CountersignId))
                 {
                     //会签中正常办理节点,更新会签members办理状态
-                    var countersign =
-                        workflow.Countersigns.FirstOrDefault(d =>
+                    var countersign = workflow.Countersigns.FirstOrDefault(d =>
                             !d.IsCompleted() && d.Id == currentStep.CountersignId);
                     if (countersign is not null)
                     {
@@ -2506,12 +2504,11 @@ namespace Hotline.FlowEngine.Workflows
             newStep.IsOrigin = step.IsOrigin;
             //newStep.ParentId = step.ParentId;
             newStep.Handlers = step.Handlers;
-            //newStep.StepHandlers = _mapper.Map<List<WorkflowStepHandler>>(step.StepHandlers);
             newStep.StartCountersignId = step.StartCountersignId;
             newStep.CountersignId = step.CountersignId;
             newStep.IsStartedCountersignEnd = step.IsStartedCountersignEnd;
 
-            //退回场景:指派给原办理人,其余场景:按照原节点原始指派方式复制
+            //退回场景:指派给原办理人,其余场景:按照原节点原始指派方式复制 //todo 重构为参数传入办理对象
             if (traceType is EWorkflowTraceType.Previous)
             {
                 //newStep.FlowAssignType = EFlowAssignType.User;
@@ -3115,9 +3112,7 @@ namespace Hotline.FlowEngine.Workflows
 
                 //cp会签发起节点变为待办节点
                 //1. create terminal trace 2. 撤回至startStep
-                var newStep = await DuplicateStepWithTraceAsync(workflow, startCountersignStep,
-                    EWorkflowTraceType.Normal,
-                    cancellationToken);
+                var newStep = await DuplicateStepWithTraceAsync(workflow, startCountersignStep, EWorkflowTraceType.Normal, cancellationToken);
 
                 //当topcsStep结束cs时,实际办理节点应该更新为newStep
                 if (startCountersignStep.Id == workflow.TopCountersignStepId)
@@ -3128,7 +3123,9 @@ namespace Hotline.FlowEngine.Workflows
                             UserId = startCountersignStep.HandlerId,
                             Username = startCountersignStep.HandlerName,
                             OrgId = startCountersignStep.HandlerOrgId,
-                            OrgName = startCountersignStep.HandlerOrgName
+                            OrgName = startCountersignStep.HandlerOrgName,
+                            RoleId = startCountersignStep.RoleId,
+                            RoleName = startCountersignStep.RoleName
                         });
 
                     workflow.UpdateCurrentStepWhenAssign(newStep,
@@ -3137,25 +3134,27 @@ namespace Hotline.FlowEngine.Workflows
                             UserId = startCountersignStep.HandlerId,
                             Username = startCountersignStep.HandlerName,
                             OrgId = startCountersignStep.HandlerOrgId,
-                            OrgName = startCountersignStep.HandlerOrgName
+                            OrgName = startCountersignStep.HandlerOrgName,
+                            RoleId = startCountersignStep.RoleId,
+                            RoleName = startCountersignStep.RoleName
                         });
                 }
 
-                //csEndStep又开启了cs,在结束会签时,如果该节点是topcs的end节点, workflow.topcsStep应该更新为前一cs开启stepId
-                if (startCountersignStep.IsTopCountersignEndStep(workflow.TopCountersignStepId))
-                    workflow.TopCountersignStepId = startCountersignStep.CountersignStartStepId;
+                // //csEndStep又开启了cs,在结束会签时,如果该节点是topcs的end节点, workflow.topcsStep应该更新为前一cs开启stepId
+                // if (startCountersignStep.IsTopCountersignEndStep(workflow.TopCountersignStepId))
+                //     workflow.TopCountersignStepId = startCountersignStep.CountersignStartStepId;
 
                 if (workflow.CheckIfCountersignOver())
                     workflow.EndCountersign();
 
-                var removeHandlers = updateSteps.SelectMany(d => d.Handlers).Select(d => d.Key).ToList();
-
-                var handlerObjs = newStep.Handlers.Select(d => new HandlerGroupItem
-                {
-                    GroupId = Guid.NewGuid().ToString(),
-                    Key = d.Key,
-                    Value = d.Value
-                }).ToList();
+                // var removeHandlers = updateSteps.SelectMany(d => d.Handlers).Select(d => d.Key).ToList();
+                //
+                // var handlerObjs = newStep.Handlers.Select(d => new HandlerGroupItem
+                // {
+                //     GroupId = Guid.NewGuid().ToString(),
+                //     Key = d.Key,
+                //     Value = d.Value
+                // }).ToList();
                 //workflow.UpdateHandlers(removeHandlers, newStep.FlowAssignType.Value, handlerObjs);
 
                 await _workflowRepository.UpdateAsync(workflow, cancellationToken);