Ver Fonte

恢复维护WorkflowCountersign

xf há 6 meses atrás
pai
commit
0a60664729

+ 1 - 3
src/Hotline.Api/Controllers/OrderController.cs

@@ -3755,9 +3755,7 @@ public class OrderController : BaseController
             .ToList().Adapt<List<SystemDicDataOutDto>>();
         return rsp;
     }
-
-
-
+    
     /// <summary>
     /// 临时保存
     /// </summary>

+ 18 - 30
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -345,23 +345,23 @@ namespace Hotline.FlowEngine.Workflows
 
                 if (countersignStartStep.IsStartCountersign)
                 {
-                    //var currentCountersign =
-                    //    workflow.Countersigns.FirstOrDefault(d => d.Id == countersignStartStep.StartCountersignId);
-                    //if (currentCountersign is null)
-                    //    throw new UserFriendlyException(
-                    //        $"未查询到对应会签信息,workflowId:{workflow.Id}, countersignId:{currentStep.CountersignId}",
-                    //        "无效会签编号");
+                    var currentCountersign =
+                        workflow.Countersigns.FirstOrDefault(d => d.Id == countersignStartStep.StartCountersignId);
+                    if (currentCountersign is null)
+                        throw new UserFriendlyException(
+                            $"未查询到对应会签信息,workflowId:{workflow.Id}, countersignId:{currentStep.CountersignId}",
+                            "无效会签编号");
 
                     //结束step会签信息
                     countersignStartStep.CountersignEnd();
                     updateSteps.Add(countersignStartStep);
 
-                    ////结束会签
-                    //currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
-                    //    current.UserId, current.UserName,
-                    //    current.OrgId, current.OrgName,
-                    //    current.OrgAreaCode, current.OrgAreaName);
-                    //await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
+                    //结束会签
+                    currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
+                        current.UserId, current.UserName,
+                        current.OrgId, current.OrgName,
+                        current.OrgAreaCode, current.OrgAreaName);
+                    await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
                 }
             }
 
@@ -370,12 +370,12 @@ namespace Hotline.FlowEngine.Workflows
             //创建会签数据
             if (isStartCountersign)
             {
-                //var exists = workflow.Countersigns.Any(d =>
-                //    !d.IsCompleted() && d.StarterId == current.UserId);
-                //if (exists)
-                //    throw new UserFriendlyException("该用户在当前流程存在未结束会签");
-                //await StartCountersignAsync(current, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
-                //    counterSignType, expiredTime, cancellationToken);
+                var exists = workflow.Countersigns.Any(d =>
+                    !d.IsCompleted() && d.StarterId == current.UserId);
+                if (exists)
+                    throw new UserFriendlyException("该用户在当前流程存在未结束会签");
+                await StartCountersignAsync(current, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
+                    counterSignType, expiredTime, cancellationToken);
             }
 
             currentStep.IsActualHandled = CheckIsActualHandle(workflow, currentStep, nextStepDefine, dto);
@@ -456,16 +456,6 @@ namespace Hotline.FlowEngine.Workflows
                 nextStepDefine, isNextDynamic, flowAssignInfo.FlowAssignType, expiredTime, isStartCountersign,
                 cancellationToken);
 
-            ////赋值当前节点的下级办理节点
-            //if (dto.IsStartCountersign
-            //   //|| (currentStep.IsInCountersign() &&
-            //   //    !currentStep.IsTopCountersignEndStep(workflow.TopCountersignStepId))
-            //   )
-            //{
-            //    currentStep.CreateCountersignSteps(nextSteps);
-            //    await _workflowStepRepository.UpdateAsync(currentStep, cancellationToken);
-            //}
-
             // //更新办理对象(nextSteps无元素表示当前节点为会签办理节点且当前会签没有全部办理完成)
             // workflow.UpdateHandlers(current.RequiredUserId, current.RequiredOrgId,
             //     flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects, nextSteps.Any());
@@ -588,9 +578,7 @@ namespace Hotline.FlowEngine.Workflows
 
             var unhandlePreviousTrace = workflow.Traces.FirstOrDefault(d =>
                     d.Status is not EWorkflowStepStatus.Handled
-            //&& d.TraceType is EWorkflowTraceType.Previous
             );
-            //var previousOpinion = unhandlePreviousTrace?.Opinion ?? null;
 
             var unCompletedCountersign = workflow.Countersigns
                 .FirstOrDefault(d => !d.IsCompleted() && d.StarterOrgId == orgId);