李昊 před 4 roky
rodič
revize
ef69f3b22d

+ 24 - 1
GxPress/Service/GxPress.Service.Implement/Flow/FlowService.Nodes.cs

@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using Datory;
 using GxPress.Common.Tools;
 using GxPress.Entity.WorkFlow;
 using GxPress.Entity.WorkFlowDto;
@@ -305,7 +306,29 @@ namespace GxPress.Service.Implement
                 }
                 await TaskApproverCheckAsync(userIdList.Distinct(), flow);
             }
-
+            var flowTodoCount = await _flowTodoRepository.CountAsync(Q.Where(nameof(Entity.WorkFlow.FlowTodo.IsOperate), true).Where(nameof(Entity.WorkFlow.FlowTodo.FlowId), flow.Id).Where(nameof(Entity.WorkFlow.FlowTodo.Type), nameof(TodoTypeConst.ApproverCheck)));
+            if (flowTodoCount == 0)
+            {
+                //修改可操作人
+                var flowTodo = await _flowTodoRepository.GetAsync(Q.Where(nameof(Entity.WorkFlow.FlowTodo.IsChecked), false).Where(nameof(Entity.WorkFlow.FlowTodo.IsDone), false).Where(nameof(Entity.WorkFlow.FlowTodo.Type), nameof(TodoTypeConst.ApproverCheck)).Where(nameof(Entity.WorkFlow.FlowTodo.FlowId), flow.Id).OrderBy(nameof(Entity.WorkFlow.FlowTodo.Sort)));
+                if (flowTodo != null && flowTodo.IsCaseOr && flowTodo.ParentId > 0)
+                {
+                    var flowDtos = await _flowTodoRepository.GetAllAsync(Q.Where(nameof(Entity.WorkFlow.FlowTodo.ParentId), flowTodo.ParentId).Where(nameof(Entity.WorkFlow.FlowTodo.IsCaseOr), true).Where(nameof(Entity.WorkFlow.FlowTodo.FlowId), flowTodo.FlowId));
+                    foreach (var item in flowDtos)
+                    {
+                        item.IsOperate = true;
+                        await _flowTodoRepository.UpdateAsync(item);
+                    }
+                }
+                else
+                {
+                    if (flowTodo != null)
+                    {
+                        flowTodo.IsOperate = true;
+                        await _flowTodoRepository.UpdateAsync(flowTodo);
+                    }
+                }
+            }
 
         }