Quellcode durchsuchen

增加分支节点

ylchen vor 4 Jahren
Ursprung
Commit
fa88f9c9a8

+ 195 - 152
WorkFlowApi/WorkFlowApi.Business/Scheme/WFProcessBusiness.cs

@@ -39,7 +39,7 @@ namespace WorkFlowApi.Business.Scheme
39 39
         /// <param name="level">流程等级</param>
40 40
         /// <param name="auditors">下一节点审核人</param>
41 41
         /// <param name="userInfo">当前操作人信息</param>
42
-        public void CreateFlow(string schemeCode, string processId, string title, int level, string auditors, T_Sys_UserAccount userInfo, out List<T_WF_TaskView>   t_WF_TaskViews)
42
+        public void CreateFlow(string schemeCode, string processId, string title, int level,string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView>   t_WF_TaskViews, List<WFAuditor> auditors = null )
43 43
         {
44 44
 
45 45
             // 初始化流程引擎
@@ -50,11 +50,11 @@ namespace WorkFlowApi.Business.Scheme
50 50
             WFNodeInfo nodeInfo = nWFIEngine.GetStartNode();
51 51
             // 获取下一节点信息
52 52
             List<WFLineInfo> lineList = new List<WFLineInfo>();
53
-            List<WFNodeInfo> list = nWFIEngine.GetNextTaskNode(nodeInfo, "agree", false, lineList);
53
+            List<WFNodeInfo> list = nWFIEngine.GetNextTaskNode(nodeInfo, "agree", false, lineList, branchnodeCode);
54 54
 
55
-           
55
+            string codelist = nWFIEngine.GetButonList(list.FirstOrDefault().id, lineList);
56 56
             // 创建任务
57
-            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig);
57
+            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig, codelist);
58 58
             List<T_WF_Task> taskListEntity =  taskList.MapToList<T_WF_Task>();
59 59
             t_WF_TaskViews = taskList;
60 60
             // nextTaskinfos = taskList.MapToList<NextTaskinfo>();
@@ -106,6 +106,14 @@ namespace WorkFlowApi.Business.Scheme
106 106
             };
107 107
             nWFTaskLogEntity.Create();
108 108
             // 保存信息
109
+            save(nWFProcessEntity, taskList, nWFTaskLogEntity);
110
+         
111
+
112
+
113
+        }
114
+
115
+        private void save(T_WF_Process nWFProcessEntity, List<T_WF_TaskView> taskList, T_WF_TaskLog nWFTaskLogEntity)
116
+        {
109 117
             var wFProcessEntityTmp = GetEntity(nWFProcessEntity.F_Id);
110 118
             if (wFProcessEntityTmp == null)
111 119
             {
@@ -118,28 +126,30 @@ namespace WorkFlowApi.Business.Scheme
118 126
 
119 127
             foreach (var task in taskList)
120 128
             {
121
-                task.F_ModifyDate = DateTime.Now;
122
-                wFTaskBusiness.InsertExe(task);
123
-                int num = 1;
124
-                if (task.nWFUserInfoList != null)
129
+                if (task.nWFUserInfoList != null && task.nWFUserInfoList.Count > 0 && task.F_Type != null)
125 130
                 {
126
-                    foreach (var taskUser in task.nWFUserInfoList)
131
+                    task.F_ModifyDate = DateTime.Now;
132
+                    wFTaskBusiness.InsertExe(task);
133
+                    int num = 1;
134
+                    if (task.nWFUserInfoList != null)
127 135
                     {
128
-                        T_WF_TaskRelation nWFTaskRelationEntity = new T_WF_TaskRelation();
129
-                        nWFTaskRelationEntity.Create();
130
-                        nWFTaskRelationEntity.F_TaskId = task.F_Id;
131
-                        nWFTaskRelationEntity.F_UserId = taskUser.Id;
132
-                        nWFTaskRelationEntity.F_Mark = taskUser.Mark;
133
-                        nWFTaskRelationEntity.F_Result = 0;
134
-                        nWFTaskRelationEntity.F_Sort = num;
135
-                        wFTaskTaskRelationBusiness.InsertExe(nWFTaskRelationEntity);
136
-                        num++;
136
+                        foreach (var taskUser in task.nWFUserInfoList)
137
+                        {
138
+                            T_WF_TaskRelation nWFTaskRelationEntity = new T_WF_TaskRelation();
139
+                            nWFTaskRelationEntity.Create();
140
+                            nWFTaskRelationEntity.F_TaskId = task.F_Id;
141
+                            nWFTaskRelationEntity.F_UserId = taskUser.Id;
142
+                            nWFTaskRelationEntity.F_Mark = taskUser.Mark;
143
+                            nWFTaskRelationEntity.F_Result = 0;
144
+                            nWFTaskRelationEntity.F_Sort = num;
145
+                            wFTaskTaskRelationBusiness.InsertExe(nWFTaskRelationEntity);
146
+                            num++;
147
+                        }
137 148
                     }
138 149
                 }
150
+
139 151
             }
140 152
             logBusiness.InsertExe(nWFTaskLogEntity);
141
-
142
-
143 153
         }
144 154
 
145 155
         /// <summary>
@@ -148,7 +158,7 @@ namespace WorkFlowApi.Business.Scheme
148 158
         /// <param name="processId"></param>
149 159
         /// <param name="userInfo"></param>
150 160
         /// <param name=""></param>
151
-        public void AgainCreateFlow(string processId, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews)
161
+        public void AgainCreateFlow(string processId, string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews)
152 162
         {
153 163
 
154 164
             // 初始化流程引擎
@@ -211,9 +221,9 @@ namespace WorkFlowApi.Business.Scheme
211 221
             // 获取下一节点信息
212 222
             List<WFLineInfo> lineList = new List<WFLineInfo>();
213 223
             List<WFNodeInfo> list = nWFIEngine.GetNextTaskNode(nodeInfo, "agree", false, lineList);
214
-
224
+            string codelist = nWFIEngine.GetButonList(nodeInfo.id, lineList);
215 225
             // 创建任务
216
-            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig);
226
+            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig,codelist);
217 227
             List<T_WF_Task> taskListEntity = taskList.MapToList<T_WF_Task>();
218 228
             t_WF_TaskViews = taskList;
219 229
 
@@ -249,24 +259,28 @@ namespace WorkFlowApi.Business.Scheme
249 259
 
250 260
             foreach (var task in taskList)
251 261
             {
252
-                task.F_ModifyDate = DateTime.Now;
253
-                wFTaskBusiness.InsertExe(task);
254
-                int num = 1;
255
-                if (task.nWFUserInfoList != null)
262
+                if (task.nWFUserInfoList != null && task.nWFUserInfoList.Count > 0 && task.F_Type != null)
256 263
                 {
257
-                    foreach (var taskUser in task.nWFUserInfoList)
264
+                    task.F_ModifyDate = DateTime.Now;
265
+                    wFTaskBusiness.InsertExe(task);
266
+                    int num = 1;
267
+                    if (task.nWFUserInfoList != null)
258 268
                     {
259
-                        T_WF_TaskRelation _WF_TaskRelation = new T_WF_TaskRelation();
260
-                        _WF_TaskRelation.Create();
261
-                        _WF_TaskRelation.F_TaskId = task.F_Id;
262
-                        _WF_TaskRelation.F_UserId = taskUser.Id;
263
-                        _WF_TaskRelation.F_Mark = taskUser.Mark;
264
-                        _WF_TaskRelation.F_Result = 0;
265
-                        _WF_TaskRelation.F_Sort = num;
266
-                        wFTaskTaskRelationBusiness.InsertExe(_WF_TaskRelation);
267
-                        num++;
269
+                        foreach (var taskUser in task.nWFUserInfoList)
270
+                        {
271
+                            T_WF_TaskRelation _WF_TaskRelation = new T_WF_TaskRelation();
272
+                            _WF_TaskRelation.Create();
273
+                            _WF_TaskRelation.F_TaskId = task.F_Id;
274
+                            _WF_TaskRelation.F_UserId = taskUser.Id;
275
+                            _WF_TaskRelation.F_Mark = taskUser.Mark;
276
+                            _WF_TaskRelation.F_Result = 0;
277
+                            _WF_TaskRelation.F_Sort = num;
278
+                            wFTaskTaskRelationBusiness.InsertExe(_WF_TaskRelation);
279
+                            num++;
280
+                        }
268 281
                     }
269 282
                 }
283
+                  
270 284
             }
271 285
 
272 286
 
@@ -283,7 +297,7 @@ namespace WorkFlowApi.Business.Scheme
283 297
         /// <param name="stamp"></param>
284 298
         /// <param name="signUrl"></param>
285 299
         /// <param name="userInfo"></param>
286
-        public void AuditFlow(string operationCode, string operationName, string processId, string taskId, string des, string auditors, string stamp, string signUrl, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews)
300
+        public void AuditFlow(string operationCode, string operationName, string processId, string taskId, string des , string stamp, string signUrl, string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews, List<WFAuditor> auditors = null)
287 301
         {
288 302
             // 初始化流程引擎
289 303
             WFIEngine nWFIEngine = _Bootstraper("", processId, taskId, userInfo);
@@ -356,7 +370,7 @@ namespace WorkFlowApi.Business.Scheme
356 370
                 {
357 371
                     nWFTaskRelationEntity.F_Result = 1;
358 372
                 }
359
-                else if (operationCode == "disagree")
373
+                else if (operationCode == "refuse")
360 374
                 {
361 375
                     nWFTaskRelationEntity.F_Result = 2;
362 376
                 }
@@ -368,13 +382,17 @@ namespace WorkFlowApi.Business.Scheme
368 382
 
369 383
             // 获取下一节点信息
370 384
             List<WFLineInfo> lineList = new List<WFLineInfo>();
371
-            List<WFNodeInfo> list = nWFIEngine.GetNextTaskNode(nodeInfo, operationCode, false, lineList);
372
-
373
-            List<T_WF_Task> closeTaskList = new List<T_WF_Task>();
385
+            List<WFNodeInfo> list = nWFIEngine.GetNextTaskNode(nodeInfo, operationCode, false, lineList, branchnodeCode);
386
+            var codelist = string.Empty;
387
+            if (list != null && list.Count() > 0)
388
+            {
389
+               codelist = nWFIEngine.GetButonList(list.FirstOrDefault().id, lineList);
390
+            }
374 391
           
375 392
 
393
+
376 394
             // 创建任务
377
-            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig);
395
+            List<T_WF_TaskView> taskList = _CreateTask(list, nodeInfo, nWFEngineParamConfig, codelist);
378 396
             List<T_WF_Task> taskListEntity = taskList.MapToList<T_WF_Task>();
379 397
             t_WF_TaskViews = taskList;
380 398
 
@@ -429,24 +447,28 @@ namespace WorkFlowApi.Business.Scheme
429 447
 
430 448
             foreach (var task in taskList)
431 449
             {
432
-                task.F_ModifyDate = DateTime.Now;
433
-                wFTaskBusiness.InsertExe(task);
434
-                int num = 1;
435
-                if (task.nWFUserInfoList != null)
450
+                if(task.nWFUserInfoList!= null&& task.nWFUserInfoList.Count>0&& task.F_Type!=null)
436 451
                 {
437
-                    foreach (var taskUser in task.nWFUserInfoList)
452
+                    task.F_ModifyDate = DateTime.Now;
453
+                    wFTaskBusiness.InsertExe(task);
454
+                    int num = 1;
455
+                    if (task.nWFUserInfoList != null)
438 456
                     {
439
-                        T_WF_TaskRelation  _WF_TaskRelation = new T_WF_TaskRelation();
440
-                        _WF_TaskRelation.Create();
441
-                        _WF_TaskRelation.F_TaskId = task.F_Id;
442
-                        _WF_TaskRelation.F_UserId = taskUser.Id;
443
-                        _WF_TaskRelation.F_Mark = taskUser.Mark;
444
-                        _WF_TaskRelation.F_Result = 0;
445
-                        _WF_TaskRelation.F_Sort = num;
446
-                        wFTaskTaskRelationBusiness.InsertExe(_WF_TaskRelation);
447
-                        num++;
457
+                        foreach (var taskUser in task.nWFUserInfoList)
458
+                        {
459
+                            T_WF_TaskRelation _WF_TaskRelation = new T_WF_TaskRelation();
460
+                            _WF_TaskRelation.Create();
461
+                            _WF_TaskRelation.F_TaskId = task.F_Id;
462
+                            _WF_TaskRelation.F_UserId = taskUser.Id;
463
+                            _WF_TaskRelation.F_Mark = taskUser.Mark;
464
+                            _WF_TaskRelation.F_Result = 0;
465
+                            _WF_TaskRelation.F_Sort = num;
466
+                            wFTaskTaskRelationBusiness.InsertExe(_WF_TaskRelation);
467
+                            num++;
468
+                        }
448 469
                     }
449 470
                 }
471
+               
450 472
             }
451 473
          
452 474
 
@@ -590,7 +612,7 @@ namespace WorkFlowApi.Business.Scheme
590 612
         /// <param name="nodeList">节点信息</param>
591 613
         /// <param name="paramConfig">流程配置信息</param>
592 614
         /// <returns></returns>
593
-        private List<T_WF_TaskView> _CreateTask(List<WFNodeInfo> nodeList, WFNodeInfo currentNodeInfo, WFEngineParamConfig paramConfig)
615
+        private List<T_WF_TaskView> _CreateTask(List<WFNodeInfo> nodeList, WFNodeInfo currentNodeInfo, WFEngineParamConfig paramConfig,string codelist)
594 616
         {
595 617
             List<T_WF_TaskView> list = new List<T_WF_TaskView>();
596 618
             foreach (var node in nodeList)
@@ -623,7 +645,13 @@ namespace WorkFlowApi.Business.Scheme
623 645
                     nWFTaskEntity.F_TimeoutStrategy = node.timeoutStrategy;
624 646
                 }
625 647
                 nWFTaskEntity.nWFUserInfoList = _GetNodeAuditors(node.auditors, node, paramConfig);
626
-                nWFTaskEntity.auditors = node.auditors;
648
+                nWFTaskEntity.auditors = _GetNodeAuditors3(node.auditors, node, paramConfig);
649
+                nWFTaskEntity.btnList = codelist;
650
+
651
+
652
+
653
+
654
+                nWFTaskEntity.nodeType = node.type;
627 655
 
628 656
                 switch (node.type)
629 657
                 {
@@ -645,10 +673,11 @@ namespace WorkFlowApi.Business.Scheme
645 673
                      
646 674
                         break;
647 675
                 }
648
-                if (nWFTaskEntity.nWFUserInfoList.Count > 0 && nWFTaskEntity.F_Type != null)
649
-                {
650
-                    list.Add(nWFTaskEntity);
651
-                }
676
+                list.Add(nWFTaskEntity);
677
+                //if (nWFTaskEntity.nWFUserInfoList.Count > 0 && nWFTaskEntity.F_Type != null)
678
+                //{
679
+                //    list.Add(nWFTaskEntity);
680
+                //}
652 681
             }
653 682
             return list;
654 683
         }
@@ -681,44 +710,7 @@ namespace WorkFlowApi.Business.Scheme
681 710
                     }
682 711
 
683 712
                     List<T_WF_TaskRelation> taskUserList = wFTaskTaskRelationBusiness.GetList($"F_TaskId='{taskEntiy.F_Id}'", "");
684
-
685
-                    if (nodeInfo.type == "stepnode" && nodeInfo.isAllAuditor == "2")
686
-                    {
687
-                        List<T_WF_TaskRelation> taskUserList2;
688
-                        // 如果普通节点设置了所有人都需要审核的情况
689
-                        if (nodeInfo.auditorAgainType == "1")
690
-                        {
691
-                            //审核通过的人不需要再审核:获取未审核通过的人。但是在大家都通过的情况下就获取所有人
692
-                            taskUserList2 = taskUserList.FindAll(t => t.F_Result != 1);
693
-                            if (taskUserList2.Count == 0)
694
-                            {
695
-                                taskUserList2 = taskUserList;
696
-                            }
697
-                        }
698
-                        else
699
-                        {
700
-                            taskUserList2 = taskUserList;
701
-                        }
702
-                        if (taskUserList2.Count > 0)
703
-                        {
704
-                            foreach (var item in taskUserList2)
705
-                            {
706
-                                var taskUserEntity = user.GetEntity(item.F_UserId);
707
-                                if (taskUserEntity != null)
708
-                                {
709
-                                    list.Add(new WFUserInfo()
710
-                                    {
711
-                                        Id = taskUserEntity.F_UserId.ToString(),
712
-                                        Account = taskUserEntity.F_UserCode,
713
-                                        Name = taskUserEntity.F_UserName
714
-                                    });
715
-                                }
716
-                            }
717
-                            return list;
718
-                        }
719
-                    }
720
-                    else
721
-                    {
713
+     
722 714
                         T_WF_TaskRelation taskUser = taskUserList.Find(t => t.F_Result != 0 && t.F_Result != 3);
723 715
                         if (taskUser != null)
724 716
                         {
@@ -737,54 +729,55 @@ namespace WorkFlowApi.Business.Scheme
737 729
                                 if (list2.Find(t => t.Id == _userId) == null)
738 730
                                 {
739 731
                                     if (list2.Count == 0)
740
-                                    {// 未找到审核人,默认成系统管理员
741
-                                        if (nodeInfo.noPeopleGz == 3)
742
-                                        {
732
+                                    {
733
+                                    // 找不到审核人无法提交
734
+                                       // if (nodeInfo.noPeopleGz == 3)
735
+                                       // {
743 736
                                             throw (new Exception("下一节点没有审核人,无法提交!"));
744
-                                        }
737
+                                       // }
745 738
                                         // 如果找不到审核人就默认超级管理员才能审核
746
-                                        var adminEntityList = user.GetList("F_RoleId=4", "");
747
-                                        foreach (var item in adminEntityList)
748
-                                        {
749
-                                            list2.Add(new WFUserInfo()
750
-                                            {
751
-                                                Id = item.F_UserId.ToString(),
752
-                                                Account = item.F_UserCode,
753
-                                                Name = item.F_UserName,
754
-                                                noPeople = true
755
-                                            });
756
-                                        }
739
+                                        //var adminEntityList = user.GetList("F_RoleId=4", "");
740
+                                        //foreach (var item in adminEntityList)
741
+                                        //{
742
+                                        //    list2.Add(new WFUserInfo()
743
+                                        //    {
744
+                                        //        Id = item.F_UserId.ToString(),
745
+                                        //        Account = item.F_UserCode,
746
+                                        //        Name = item.F_UserName,
747
+                                        //        noPeople = true
748
+                                        //    });
749
+                                        //}
757 750
                                     }
758 751
                                     return list2;
759 752
                                 }
760 753
                                 return list;
761 754
                             }
762 755
                         }
763
-                    }
756
+                    
764 757
                 }
765 758
             }
766 759
 
767 760
             list.AddRange(list2);
768 761
 
769
-            if (list.Count == 0)
770
-            {// 未找到审核人,默认成系统管理员
771
-                if (nodeInfo.noPeopleGz == 3)
772
-                {
773
-                    throw (new Exception("下一节点没有审核人,无法提交!"));
774
-                }
775
-                // 如果找不到审核人就默认超级管理员才能审核
776
-                var adminEntityList = user.GetList("F_RoleId=4", "");
777
-                foreach (var item in adminEntityList)
778
-                {
779
-                    list.Add(new WFUserInfo()
780
-                    {
781
-                        Id = item.F_UserId.ToString(),
782
-                        Account = item.F_UserCode,
783
-                        Name = item.F_UserName,
784
-                        noPeople = true
785
-                    });
786
-                }
787
-            }
762
+            //if (list.Count == 0)
763
+            //{// 未找到审核人,默认成系统管理员
764
+            //    if (nodeInfo.noPeopleGz == 3)
765
+            //    {
766
+            //        throw (new Exception("下一节点没有审核人,无法提交!"));
767
+            //    }
768
+            //    // 如果找不到审核人就默认超级管理员才能审核
769
+            //    var adminEntityList = user.GetList("F_RoleId=4", "");
770
+            //    foreach (var item in adminEntityList)
771
+            //    {
772
+            //        list.Add(new WFUserInfo()
773
+            //        {
774
+            //            Id = item.F_UserId.ToString(),
775
+            //            Account = item.F_UserCode,
776
+            //            Name = item.F_UserName,
777
+            //            noPeople = true
778
+            //        });
779
+            //    }
780
+            //}
788 781
 
789 782
             return list;
790 783
         }
@@ -806,22 +799,22 @@ namespace WorkFlowApi.Business.Scheme
806 799
                 return list;
807 800
             }
808 801
 
809
-            if (nodeAuditorList.Count == 0)
810
-            {
811
-                // 如果找不到审核人就默认超级管理员才能审核           
812
-                var adminEntityList = user.GetList("F_RoleId=4", "");
813
-                foreach (var item in adminEntityList)
814
-                {
815
-                    list.Add(new WFUserInfo()
816
-                    {
817
-                        Id = item.F_UserId.ToString(),
818
-                        Account = item.F_UserCode,
819
-                        Name = item.F_UserName
820
-                    });
821
-                }
822
-            }
823
-            else
824
-            {
802
+            //if (nodeAuditorList.Count == 0)
803
+            //{
804
+            //    // 如果找不到审核人就默认超级管理员才能审核           
805
+            //    var adminEntityList = user.GetList("F_RoleId=4", "");
806
+            //    foreach (var item in adminEntityList)
807
+            //    {
808
+            //        list.Add(new WFUserInfo()
809
+            //        {
810
+            //            Id = item.F_UserId.ToString(),
811
+            //            Account = item.F_UserCode,
812
+            //            Name = item.F_UserName
813
+            //        });
814
+            //    }
815
+            //}
816
+           // else
817
+            //{
825 818
                 foreach (var item in nodeAuditorList)
826 819
                 {
827 820
                     switch (item.type)//1.部门2.角色3.用户
@@ -890,11 +883,61 @@ namespace WorkFlowApi.Business.Scheme
890 883
                                         Name = userEntity6.F_UserName
891 884
                                     });
892 885
                                 }
886
+                               
887
+                            }
888
+                            break;
889
+                    }
890
+                }
891
+           // }
892
+            return list;
893
+        }
894
+
895
+        private List<WFAuditor> _GetNodeAuditors3(List<WFAuditor> nodeAuditorList, WFNodeInfo nodeInfo, WFEngineParamConfig paramConfig)
896
+        {
897
+            List<WFAuditor> list = new List<WFAuditor>();
898
+            if (nodeAuditorList != null)
899
+            {
900
+                foreach (var item in nodeAuditorList)
901
+                {
902
+                    switch (item.type)//1.部门2.角色3.用户
903
+                    {
904
+                        case 1:// 部门
905
+
906
+                            list.Add(item);
907
+                            break;
908
+                        case 2:// 角色
909
+                               //var userRelationList2 = userRelation.GetList($"where F_ObjectId='{item.auditorId}'", "");
910
+                            list.Add(item);
911
+                            break;
912
+                        case 3:// 用户
913
+                            list.Add(item);
914
+
915
+                            break;
916
+                        case 4:// 某一个节点执行人
917
+                            var task = logBusiness.GetList($"F_NodeId='{item.auditorId}' and F_ProcessId='{paramConfig.ProcessId}' and F_TaskType<>3 and F_TaskType<>6", "").FirstOrDefault();
918
+                            if (task != null && !string.IsNullOrEmpty(task.F_CreateUserId))
919
+                            {
920
+                                var userEntity6 = user.GetEntity(task.F_CreateUserId);
921
+                                if (userEntity6 != null)
922
+                                {
923
+                                    list.Add(new WFAuditor()
924
+                                    {
925
+                                        id = userEntity6.F_UserId.ToString(),
926
+                                        auditorId = userEntity6.F_UserId.ToString(),
927
+                                        auditorAccount = userEntity6.F_UserCode,
928
+                                        auditorName = userEntity6.F_UserName,
929
+                                        type = 2
930
+
931
+                                    });
932
+                                }
933
+
893 934
                             }
894 935
                             break;
895 936
                     }
896 937
                 }
897 938
             }
939
+               
940
+            
898 941
             return list;
899 942
         }
900 943
 

+ 3 - 0
WorkFlowApi/WorkFlowApi.Entity/SchemeView/T_WF_TaskView.cs

@@ -14,6 +14,9 @@ namespace WorkFlowApi.Entity.SchemeView
14 14
 
15 15
         public List<WFUserInfo> nWFUserInfoList { get; set; }
16 16
         public List<WFAuditor> auditors { get; set; }
17
+        public string nodeType { get; set; }
18
+
19
+        public string btnList { get; set; }
17 20
 
18 21
     }
19 22
 }

+ 4 - 3
WorkFlowApi/WorkFlowApi.IBusiness/Scheme/IWFProcessBusiness.cs

@@ -6,14 +6,15 @@ using System.Threading.Tasks;
6 6
 using WorkFlowApi.Entity;
7 7
 using WorkFlowApi.Entity.SchemeEntity;
8 8
 using WorkFlowApi.Entity.SchemeView;
9
+using WorkFlowApi.Utility.WorkFlowEngine.Scheme.Node;
9 10
 using WorkFlowApi.ViewModels.View;
10 11
 
11 12
 namespace WorkFlowApi.IBusiness.Scheme
12 13
 {
13 14
     public interface IWFProcessBusiness : IBaseBusiness<T_WF_Process>
14 15
     {
15
-        void CreateFlow(string schemeCode, string processId, string title, int level, string auditors, T_Sys_UserAccount userInfo, out List<T_WF_TaskView>  t_WF_TaskViews);
16
-        void AgainCreateFlow(string processId, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews);
17
-        void AuditFlow(string operationCode, string operationName, string processId, string taskId, string des, string auditors, string stamp, string signUrl, T_Sys_UserAccount userInfo, out List<T_WF_TaskView>  t_WF_TaskViews);
16
+       void CreateFlow(string schemeCode, string processId, string title, int level,string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews, List<WFAuditor> auditors = null);
17
+        void AgainCreateFlow(string processId, string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView> t_WF_TaskViews);
18
+        void AuditFlow(string operationCode, string operationName, string processId, string taskId, string des, string stamp, string signUrl, string branchnodeCode, T_Sys_UserAccount userInfo, out List<T_WF_TaskView>  t_WF_TaskViews, List<WFAuditor> auditors=null);
18 19
     }
19 20
 }

+ 2 - 0
WorkFlowApi/WorkFlowApi.Models/Input/AuditFlowReq.cs

@@ -13,6 +13,8 @@ namespace WorkFlowApi.ViewModels.Input
13 13
         public string OperationName { get; set; }
14 14
         public string ProcessId { get; set; }
15 15
         public string TaskId { get; set; }
16
+
17
+        public string BranchnodeCode { get; set; }
16 18
         public string Des { get; set; }
17 19
         public List<WFAuditor> auditors { get; set; }
18 20
 

+ 2 - 0
WorkFlowApi/WorkFlowApi.Models/Input/CreateFlowReq.cs

@@ -17,6 +17,8 @@ namespace WorkFlowApi.ViewModels.Input
17 17
         /// </summary>
18 18
         public string ProcessId { get; set; }
19 19
 
20
+        public string BranchnodeCode { get; set; }
21
+
20 22
         public bool IsNew { get; set; }
21 23
 
22 24
 

+ 3 - 1
WorkFlowApi/WorkFlowApi.Models/View/NextTaskinfo.cs

@@ -41,7 +41,9 @@ namespace WorkFlowApi.ViewModels.View
41 41
         /// </summary> 
42 42
         /// <returns></returns> 
43 43
         public int? IsFinished { get; set; }
44
-        public List<WFUserInfo> nWFUserInfoList { get; set; }
45 44
         public List<WFAuditor> auditors { get; set; }
45
+
46
+        public string nodeType { get; set; }
47
+        public string btnList { get; set; }
46 48
     }
47 49
 }

+ 2 - 1
WorkFlowApi/WorkFlowApi.Utility/WorkFlowEngine/Scheme/Config/WFEngineConfig.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using System.Text;
5 5
 using System.Threading.Tasks;
6
+using WorkFlowApi.Utility.WorkFlowEngine.Scheme.Node;
6 7
 
7 8
 namespace WorkFlowApi.Utility.WorkFlowEngine.Scheme.Config
8 9
 {
@@ -72,7 +73,7 @@ namespace WorkFlowApi.Utility.WorkFlowEngine.Scheme.Config
72 73
         /// <summary>
73 74
         /// 审核人信息
74 75
         /// </summary>
75
-        public string Auditers { get; set; }
76
+        public List<WFAuditor> Auditers { get; set; }
76 77
         /// <summary>
77 78
         /// 创建用户
78 79
         /// </summary>

+ 33 - 16
WorkFlowApi/WorkFlowApi.Utility/WorkFlowEngine/WFEngine.cs

@@ -204,6 +204,26 @@ namespace WorkFlowApi.Utility.WorkFlowEngine
204 204
             }
205 205
             return nextNodes;
206 206
         }
207
+
208
+        public string GetButonList(string nodeId, List<WFLineInfo> lineList)
209
+        {
210
+            string codelist = string.Empty;
211
+            // 找到与当前节点相连的线条
212
+            foreach (var line in wfScheme.lines)
213
+            {
214
+                if (line.from == nodeId)
215
+                {
216
+                    if (!line.agreeList.IsNullOrEmpty())
217
+                    {
218
+                        codelist = codelist + ',' + line.agreeList;
219
+                    }
220
+                   
221
+                                     
222
+                }
223
+            }
224
+
225
+            return codelist.TrimStart(',');
226
+        }
207 227
         /// <summary>
208 228
         /// 获取上一节点列表
209 229
         /// </summary>
@@ -278,41 +298,38 @@ namespace WorkFlowApi.Utility.WorkFlowEngine
278 298
         /// <param name="isGetAuditors">是否获取下一节点审核人</param>
279 299
         /// <param name="lineList">经过的线段需要执行操作的</param>
280 300
         /// <returns></returns>
281
-        public List<WFNodeInfo> GetNextTaskNode(WFNodeInfo beginNode, string code, bool isGetAuditors, List<WFLineInfo> lineList)
301
+        public List<WFNodeInfo> GetNextTaskNode(WFNodeInfo beginNode, string code, bool isGetAuditors, List<WFLineInfo> lineList,string branchnodeCode="")
282 302
         {
283 303
             List<WFNodeInfo> list = new List<WFNodeInfo>();
284 304
             List<WFNodeInfo> nextNodeList = GetNextNodes(beginNode.id, code, lineList);
285 305
 
286
-            Dictionary<string, string> auditers = null;
287
-            if (!string.IsNullOrEmpty(config.ParamConfig.Auditers))
288
-            {
289
-                auditers = config.ParamConfig.Auditers.ToObject<Dictionary<string, string>>();
290
-            }
291
-
306
+            //Dictionary<string, string> auditers = null;
307
+            //if (!string.IsNullOrEmpty(config.ParamConfig.Auditers))
308
+            //{
309
+            //    auditers = config.ParamConfig.Auditers.ToObject<Dictionary<string, string>>();
310
+            //}
311
+            var auditers = config.ParamConfig.Auditers;
292 312
 
293 313
             foreach (var node in nextNodeList)
294 314
             {
295
-                if (auditers != null && auditers.ContainsKey(node.id))
315
+                if (auditers != null && auditers.Count>0)
296 316
                 {
297
-                    node.auditors = new List<WFAuditor>();
298
-                    node.auditors.Add(new WFAuditor()
299
-                    {
300
-                        type = 3,
301
-                        auditorId = auditers[node.id]
302
-                    });
317
+
318
+                    node.auditors = auditers;
303 319
                 }
304 320
 
305 321
                 switch (node.type)
306 322
                 {
307 323
                    
308
-                    case "auditornode":// 传阅节点
309
-                        list.Add(node);
324
+                    case "branchnode":// 分支节点
325
+                        list.AddRange(GetNextTaskNode(node, branchnodeCode, isGetAuditors, lineList));
310 326
                         break;                  
311 327
                     case "startround":// 开始节点 需要重新审核
312 328
                         list.Add(node);
313 329
                         config.ParamConfig.State = 1;
314 330
                         break;
315 331
                     case "endround":// 结束节点
332
+                        list.Add(node);
316 333
                         config.ParamConfig.State = 2;
317 334
                         break;
318 335
                     default:         // 默认普通节点

+ 2 - 1
WorkFlowApi/WorkFlowApi.Utility/WorkFlowEngine/WFIEngine.cs

@@ -54,6 +54,7 @@ namespace WorkFlowApi.Utility.WorkFlowEngine
54 54
         /// <param name="lineList"></param>
55 55
         /// <returns>节点信息列表</returns>
56 56
         List<WFNodeInfo> GetNextNodes(string nodeId, string code, List<WFLineInfo> lineList);
57
+        string GetButonList(string nodeId, List<WFLineInfo> lineList);
57 58
         /// <summary>
58 59
         /// 获取上一节点列表
59 60
         /// </summary>
@@ -83,7 +84,7 @@ namespace WorkFlowApi.Utility.WorkFlowEngine
83 84
         /// <param name="isGetAuditors">是否获取下一节点审核人</param>
84 85
         /// <param name="lineList">经过的线段需要执行操作的</param>
85 86
         /// <returns></returns>
86
-        List<WFNodeInfo> GetNextTaskNode(WFNodeInfo beginNode, string code, bool isGetAuditors, List<WFLineInfo> lineList);
87
+        List<WFNodeInfo> GetNextTaskNode(WFNodeInfo beginNode, string code, bool isGetAuditors, List<WFLineInfo> lineList,string branchnodeCode = "");
87 88
         #endregion
88 89
     }
89 90
 }

+ 24 - 0
WorkFlowApi/WorkFlowApi/Controllers/UserAccountController.cs

@@ -29,6 +29,30 @@ namespace WorkFlowApi.Controllers
29 29
         }
30 30
 
31 31
         /// <summary>
32
+        /// 获取所有用户
33
+        /// </summary>
34
+        /// <returns></returns>
35
+        [HttpGet]
36
+        public IHttpActionResult GetList(string deptid)
37
+        {
38
+            
39
+            if (!string.IsNullOrEmpty(deptid))
40
+            {
41
+                var _dt = _userBus.GetList($"F_DeptId='{deptid}'", "");
42
+                return Success("成功", _dt.MapToList<UserAccountListView>());
43
+            }
44
+            else
45
+            {
46
+                var _dt = _userBus.GetAllList();
47
+                return Success("成功", _dt.MapToList<UserAccountListView>());
48
+            }
49
+
50
+           
51
+
52
+           
53
+        }
54
+
55
+        /// <summary>
32 56
         /// 分页获取列表
33 57
         /// </summary>
34 58
         /// <param name="input"></param>

+ 10 - 4
WorkFlowApi/WorkFlowApi/Controllers/WorkFlow/WFProcessController.cs

@@ -14,7 +14,6 @@ namespace WorkFlowApi.Controllers.WorkFlow
14 14
 {
15 15
     /// <summary>
16 16
     /// 工作流
17
-    /// </summary>
18 17
     public class WFProcessController : BaseController
19 18
     {
20 19
         private readonly IWFProcessBusiness _wFProcess;
@@ -40,11 +39,11 @@ namespace WorkFlowApi.Controllers.WorkFlow
40 39
                 List<T_WF_TaskView>   t_WF_TaskViews = new List<T_WF_TaskView>();
41 40
                 if (createFlowReq.IsNew)
42 41
                 {
43
-                    _wFProcess.CreateFlow(createFlowReq.Code, createFlowReq.ProcessId, "", 0, "", CurrentUser, out t_WF_TaskViews);
42
+                    _wFProcess.CreateFlow(createFlowReq.Code, createFlowReq.ProcessId, "", 0,createFlowReq.BranchnodeCode, CurrentUser, out t_WF_TaskViews);
44 43
                 }
45 44
                 else
46 45
                 {
47
-                    _wFProcess.AgainCreateFlow(createFlowReq.ProcessId, CurrentUser, out t_WF_TaskViews);
46
+                    _wFProcess.AgainCreateFlow(createFlowReq.ProcessId, createFlowReq.BranchnodeCode,CurrentUser, out t_WF_TaskViews);
48 47
                 }
49 48
                 
50 49
                 return Success("创建成功", t_WF_TaskViews.MapToList<NextTaskinfo>());
@@ -69,7 +68,14 @@ namespace WorkFlowApi.Controllers.WorkFlow
69 68
             {
70 69
                 LogHelper.Info("AuditFlow-请求开始:" + auditFlowReq.ToJson() + "\n");
71 70
                 List<T_WF_TaskView> t_WF_TaskViews = new List<T_WF_TaskView>();
72
-                _wFProcess.AuditFlow(auditFlowReq.OperationCode, auditFlowReq.OperationName, auditFlowReq.ProcessId, auditFlowReq.TaskId, auditFlowReq.Des, "","","", CurrentUser,out t_WF_TaskViews);
71
+                if (auditFlowReq.OperationCode == "send"  )
72
+                {
73
+                    if (auditFlowReq.auditors == null || auditFlowReq.auditors.Count==0)
74
+                    {
75
+                        return Error("派单未指定审核人");
76
+                    }
77
+                }
78
+                _wFProcess.AuditFlow(auditFlowReq.OperationCode, auditFlowReq.OperationName, auditFlowReq.ProcessId, auditFlowReq.TaskId, auditFlowReq.Des, "","", auditFlowReq.BranchnodeCode, CurrentUser,out t_WF_TaskViews, auditFlowReq.auditors);
73 79
                 return Success("流程审批成功", t_WF_TaskViews.MapToList<NextTaskinfo>());
74 80
             }
75 81
             catch (Exception ex)