TaskController.java
78.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
package com.hotent.runtime.controller;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.hotent.base.exception.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.context.BaseContext;
import com.hotent.base.controller.BaseController;
import com.hotent.base.exception.BaseException;
import com.hotent.base.model.CommonResult;
import com.hotent.base.query.Direction;
import com.hotent.base.query.FieldRelation;
import com.hotent.base.query.FieldSort;
import com.hotent.base.query.PageBean;
import com.hotent.base.query.PageList;
import com.hotent.base.query.QueryField;
import com.hotent.base.query.QueryFilter;
import com.hotent.base.query.QueryOP;
import com.hotent.base.util.AppUtil;
import com.hotent.base.util.BeanUtils;
import com.hotent.base.util.StringUtil;
import com.hotent.base.util.ThreadMsgUtil;
import com.hotent.bpm.api.constant.ProcessInstanceStatus;
import com.hotent.bpm.api.helper.identity.BpmIdentityExtractService;
import com.hotent.bpm.api.model.form.FormType;
import com.hotent.bpm.api.model.identity.BpmIdentity;
import com.hotent.bpm.api.model.process.def.BpmDefLayout;
import com.hotent.bpm.api.model.process.def.BpmNodeLayout;
import com.hotent.bpm.api.model.process.def.BpmVariableDef;
import com.hotent.bpm.api.model.process.nodedef.BpmNodeDef;
import com.hotent.bpm.api.model.process.task.BpmTask;
import com.hotent.bpm.api.service.BpmAgentService;
import com.hotent.bpm.api.service.BpmIdentityService;
import com.hotent.bpm.api.service.BpmInstService;
import com.hotent.bpm.api.service.BpmTaskService;
import com.hotent.bpm.natapi.task.NatTaskService;
import com.hotent.bpm.persistence.manager.BpmCheckOpinionManager;
import com.hotent.bpm.persistence.manager.BpmCommuReceiverManager;
import com.hotent.bpm.persistence.manager.BpmDefAuthorizeManager;
import com.hotent.bpm.persistence.manager.BpmDefinitionManager;
import com.hotent.bpm.persistence.manager.BpmProcessInstanceManager;
import com.hotent.bpm.persistence.manager.BpmSaveOpinionManager;
import com.hotent.bpm.persistence.manager.BpmTaskCommuManager;
import com.hotent.bpm.persistence.manager.BpmTaskManager;
import com.hotent.bpm.persistence.manager.BpmTaskNoticeDoneManager;
import com.hotent.bpm.persistence.manager.BpmTaskNoticeManager;
import com.hotent.bpm.persistence.model.BpmCommuReceiver;
import com.hotent.bpm.persistence.model.BpmDefAuthorizeType;
import com.hotent.bpm.persistence.model.BpmLeaderTask;
import com.hotent.bpm.persistence.model.BpmSaveOpinion;
import com.hotent.bpm.persistence.model.BpmTaskCommu;
import com.hotent.bpm.persistence.model.BpmTaskNotice;
import com.hotent.bpm.persistence.model.BpmTaskNoticeDone;
import com.hotent.bpm.persistence.model.DefaultBpmCheckOpinion;
import com.hotent.bpm.persistence.model.DefaultBpmDefinition;
import com.hotent.bpm.persistence.model.DefaultBpmProcessInstance;
import com.hotent.bpm.persistence.model.DefaultBpmTask;
import com.hotent.bpm.persistence.model.DefaultBpmTaskTurn;
import com.hotent.bpm.persistence.util.ServiceUtil;
import com.hotent.bpm.util.BpmUtil;
import com.hotent.bpm.util.MessageUtil;
import com.hotent.i18n.util.I18nUtil;
import com.hotent.runtime.annotation.PermissionCheck;
import com.hotent.runtime.manager.BpmTaskTransManager;
import com.hotent.runtime.manager.BpmTaskTransRecordManager;
import com.hotent.runtime.manager.IFlowManager;
import com.hotent.runtime.manager.IProcessManager;
import com.hotent.runtime.manager.TaskTransService;
import com.hotent.runtime.model.BpmTaskTransRecord;
import com.hotent.runtime.params.AssignParamObject;
import com.hotent.runtime.params.BpmNodeDefVo;
import com.hotent.runtime.params.BpmTaskResult;
import com.hotent.runtime.params.CommunicateParamObject;
import com.hotent.runtime.params.DoNextParamObject;
import com.hotent.runtime.params.IsAllowAddSignObject;
import com.hotent.runtime.params.ModifyExecutorsParamObject;
import com.hotent.runtime.params.TaskApproveLineParam;
import com.hotent.runtime.params.TaskCommuVo;
import com.hotent.runtime.params.TaskDetailVo;
import com.hotent.runtime.params.TaskDoNextVo;
import com.hotent.runtime.params.TaskGetVo;
import com.hotent.runtime.params.TaskToAgreeVo;
import com.hotent.runtime.params.TaskToRejectVo;
import com.hotent.runtime.params.TaskTransParamObject;
import com.hotent.runtime.params.TaskjImageVo;
import com.hotent.runtime.params.WithDrawParam;
import com.hotent.runtime.service.TaskService;
import com.hotent.uc.api.impl.util.ContextUtil;
import com.hotent.uc.api.model.IUser;
import com.hotent.uc.api.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* 流程任务相关接口
*
* @company 广州宏天软件股份有限公司
* @author zhangxianwen
* @email zhangxw@jee-soft.cn
* @date 2018年6月28日
*/
@RestController
@RequestMapping("/runtime/task/v1/")
@Api(tags="流程任务")
@ApiGroup(group= {ApiGroupConsts.GROUP_BPM})
public class TaskController extends BaseController<BpmTaskManager,DefaultBpmTask> {
@Resource
IFlowManager iFlowService;
@Resource
NatTaskService natTaskService;
@Resource
BpmTaskManager bpmTaskManager;
@Resource
IUserService userService;
@Resource
IProcessManager iProcessService;
@Resource
BpmTaskTransRecordManager taskTransRecordManager;
@Resource
BpmTaskCommuManager bpmTaskCommuManager;
@Resource
BpmInstService bpmInstService;
@Resource
BpmDefAuthorizeManager bpmDefAuthorizeManager;
@Resource
BpmCommuReceiverManager bpmCommuReceiverManager;
@Resource
BpmAgentService bpmAgentService;
@Resource
TaskTransService taskTransService;
@Resource
BpmProcessInstanceManager bpmProcessInstanceManager;
@Resource
BpmTaskTransManager bpmTaskTransManager;
@Resource
BpmCheckOpinionManager bpmCheckOpinionManager;
@Resource
BpmDefinitionManager bpmDefinitionManager;
@Resource
BaseContext baseContext;
@Resource
BpmSaveOpinionManager bpmSaveOpinionManager;
@Resource
BpmIdentityService bpmIdentityService;
@Resource
BpmIdentityExtractService bpmIdentityExtractService;
@Autowired
TaskService taskService;
@Resource
BpmTaskService bpmTaskService;
@RequestMapping(value = "getBpmTaskNoticeById", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "根据主键ID获取待办知会任务信息", httpMethod = "GET", notes = "根据主键ID获取待办知会任务信息")
public BpmTaskNotice getBpmTaskNoticeById(@ApiParam(required = true, name = "id", value = "待办知会任务主键Id") String id) throws NotFoundException {
BpmTaskNoticeManager noticeManager = AppUtil.getBean(BpmTaskNoticeManager.class);
BpmTaskNotice notice = noticeManager.get(id);
if (BeanUtils.isEmpty(notice)) {
throw new NotFoundException(String.format("根据传阅任务id【%s】未找到任务。", id));
}
if (StringUtil.isNotEmpty(notice.getOpinionId())) {
DefaultBpmCheckOpinion checkOpinion = bpmCheckOpinionManager.get(notice.getOpinionId());
notice.setFormData(checkOpinion.getFormData());
}
return notice;
}
@RequestMapping(value = "getBpmTaskNoticeDoneById", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "根据主键ID获取已办知会任务信息", httpMethod = "GET", notes = "根据主键ID获取已办知会任务信息")
public BpmTaskNoticeDone getBpmTaskNoticeDoneById(@ApiParam(required = true, name = "id", value = "已办知会任务主键Id") String id){
BpmTaskNoticeDoneManager noticeDoneManager = AppUtil.getBean(BpmTaskNoticeDoneManager.class);
BpmTaskNoticeDone noticeDone = noticeDoneManager.get(id);
return noticeDone;
}
@RequestMapping(value = "getTaskKeyByTaskId", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "根据任务Id获取审批历史数据(只有一条)", httpMethod = "GET", notes = "根据任务Id获取审批历史数据(只有一条)")
public DefaultBpmCheckOpinion getTaskKeyByTaskId(@ApiParam(required = true, name = "taskId", value = "任务Id") String taskId){
DefaultBpmCheckOpinion defaultBpmCheckOpinion = bpmCheckOpinionManager.getTaskKeyByTaskId(taskId);
return defaultBpmCheckOpinion;
}
@RequestMapping(value = "getTaskKeyByNodeId", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "根据任务节点ID和流程实例ID获取审批历史数据(只有一条)", httpMethod = "GET", notes = "根据任务节点ID和流程实例ID获取审批历史数据(只有一条)")
public DefaultBpmCheckOpinion getTaskKeyByNodeId(@ApiParam(required = true, name = "nodeId", value = "任务节点Id") String nodeId,
@ApiParam(required = true, name = "instId", value = "流程实例Id") String instId){
DefaultBpmCheckOpinion defaultBpmCheckOpinion = bpmCheckOpinionManager.getTaskKeyByNodeId(nodeId,instId);
return defaultBpmCheckOpinion;
}
@RequestMapping(value = "retrieveBpmTask", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "取回委托/转办流程", httpMethod = "GET", notes = "取回委托/转办流程流程")
public CommonResult<String> retrieveBpmTask(@ApiParam(required = true, name = "taskId", value = "任务taskId") String taskId){
IUser user= ContextUtil.getCurrentUser();
return bpmTaskManager.retrieveBpmTask(user,taskId);
}
@RequestMapping(value="divertBpmTask",method=RequestMethod.POST, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value = "转移任务给用户", httpMethod = "POST", notes = "转移任务用户")
public CommonResult<String> divertBpmTask(@ApiParam(name="map",value="参数", required = true) @RequestBody Map<String,Object> map) throws Exception{
return bpmTaskManager.divertBpmTask(map);
}
@PostMapping(value = "getTodoCountByTeam", produces = {"application/json; charset=utf-8"})
@ApiOperation(value="获取待办数目(根据用户、组织、岗位、角色)", httpMethod = "POST", notes = "获取待办数目(根据用户、组织、岗位、角色)")
public List<Map<String,Object>> getTodoCountByTeam(@ApiParam(name="team",value="用户、组织、岗位、角色(参数如:{key:'user',val:'1'})", required = true) @RequestParam String team) throws Exception{
return bpmTaskManager.getTodoCountByTeam(team);
}
@RequestMapping(value = "getTodoListByTeam", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取待办事宜(根据用户、组织、岗位、角色)", httpMethod = "POST", notes = "获取待办事宜(根据用户、组织、岗位、角色")
public PageList<DefaultBpmTask> getTodoListByTeam(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter<DefaultBpmTask> queryFilter,
@ApiParam(name="team",value="用户、组织、岗位、角色(参数如:{key:'user',val:'1'})", required = true) @RequestParam String team) throws Exception{
if(BeanUtils.isNotEmpty(queryFilter.getQuerys()) && queryFilter.getQuerys().size()>0){
List<QueryField> fields = new ArrayList<>();
for (Iterator<QueryField> iterator = queryFilter.getQuerys().iterator(); iterator.hasNext();) {
QueryField field = (QueryField) iterator.next();
if ("urgentStateValue".equals(field.getProperty())) {
field.setGroup("groupUrgent");
field.setRelation(FieldRelation.AND);
QueryFilter<DefaultBpmDefinition> defFilter = QueryFilter.<DefaultBpmDefinition>build();
defFilter.addFilter("IS_MAIN_", "Y", QueryOP.EQUAL);
defFilter.addFilter("SHOW_URGENT_STATE_", "1", QueryOP.EQUAL);
PageList<DefaultBpmDefinition> query = bpmDefinitionManager.query(defFilter);
List<String> defKeys = new ArrayList<>();
defKeys.add("-1");
if (BeanUtils.isNotEmpty(query.getRows())) {
for (DefaultBpmDefinition def : query.getRows()) {
defKeys.add(def.getDefKey());
}
}
fields.add(new QueryField("bt.PROC_DEF_KEY_", defKeys, QueryOP.IN, FieldRelation.AND, "groupUrgent"));
}else {
fields.add(field);
}
}
queryFilter.setQuerys(fields);
}
queryFilter.setGroupRelation(FieldRelation.AND);
PageList<DefaultBpmTask> pageList = iFlowService.getTodoListByTeam(team, queryFilter);
return pageList;
}
@RequestMapping(value = "getLeaderTodoList", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户领导的待办事宜", httpMethod = "POST", notes = "获取用户领导的待办事宜")
public PageList<DefaultBpmTask> getLeaderTodoList(
@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
PageList<DefaultBpmTask> res=taskService.getLeaderTodoList(queryFilter);
return res;
}
@RequestMapping(value = "getLeaderTodoCard", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户领导的待办事宜", httpMethod = "POST", notes = "获取用户领导的待办事宜")
public CommonResult<Map<String, BpmLeaderTask>> getLeaderTodoCard(
@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter,
@ApiParam(required = true, name = "size", defaultValue = "6") @RequestParam Integer size) throws Exception{
return new CommonResult<>(true, "获取成功", taskService.getLeaderTodoCard(queryFilter, size));
}
@RequestMapping(value = "getTodoList", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户的待办事宜", httpMethod = "POST", notes = "获取用户的待办事宜")
public PageList<DefaultBpmTask> getTodoList(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter<DefaultBpmTask> queryFilter) throws Exception{
PageList<DefaultBpmTask> res=taskService.getTodoList(queryFilter);
return res;
}
@RequestMapping(value = "getTodoCard", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户待办,通过defKey分类,并获取前n个", httpMethod = "POST", notes = "获取用户待办,通过defKey分类,并获取前n个")
public CommonResult<Map<String, List<DefaultBpmTask>>> getTodoCard(@ApiParam(required = true, name = "queryFilter") @RequestBody QueryFilter<DefaultBpmTask> queryFilter,
@ApiParam(required = true, name = "size", defaultValue = "6") @RequestParam Integer size) throws Exception{
Map<String, List<DefaultBpmTask>> result = baseService.getTodoCard(queryFilter, size);
return new CommonResult<>(true, "获取成功", result);
}
@RequestMapping(value = "getTodoCardCount", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取待办数量,通过defKey分类", httpMethod = "POST", notes = "获取待办数量,通过defKey分类")
public CommonResult<Map<String, String>> getTodoCardCount() {
Map<String, String> map = baseService.getTodoCardCount();
return new CommonResult<>(true, "获取成功", map);
}
@PostMapping(value = "getTodoCount", produces = {"application/json; charset=utf-8"})
@ApiOperation(value="获取待办数目", httpMethod = "POST", notes = "获取待办数目")
public List<Map<String,Object>> getTodoCount(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
return bpmTaskManager.getCountByUserId(baseContext.getCurrentUserId());
}
@RequestMapping(value = "getMobileTodoList", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户手机的待办事宜", httpMethod = "POST", notes = "获取用户手机的待办事宜")
public PageList<DefaultBpmTask> getMobileTodoList(
@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
queryFilter.addFilter("bt.SUPPORT_MOBILE_", 1, QueryOP.EQUAL,FieldRelation.AND, "m");
CompletableFuture<PageList<DefaultBpmTask>> result = iFlowService.getTodoList(baseContext.getCurrentUserAccout(), queryFilter);
return result.get();
}
@RequestMapping(value = "getDelegate", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户转办代理事宜", httpMethod = "POST", notes = "获取用户转办代理事宜")
public PageList<DefaultBpmTaskTurn> getMyDelegate(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception {
return iFlowService.getDelegate(baseContext.getCurrentUserAccout(), queryFilter);
}
@PostMapping(value = "getDelegateCount", produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取用户转办代理事宜数量", httpMethod = "POST", notes = "获取用户转办代理事宜")
public List<Map<String,Object>> getMyDelegateCount(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception {
return iFlowService.getDelegateCount(baseContext.getCurrentUserAccout(),queryFilter);
}
@RequestMapping(value = "getMobileDelegate", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取手机用户转办代理事宜", httpMethod = "POST", notes = "获取手机用户转办代理事宜")
public PageList<DefaultBpmTaskTurn> getMobileDelegate(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception {
// queryFilter.addFilter("hi.SUPPORT_MOBILE_", 1, QueryOP.EQUAL,FieldRelation.AND, "m");
return iFlowService.getDelegate(baseContext.getCurrentUserAccout(), queryFilter);
}
@RequestMapping(value = "getMyTrans", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "我的流转任务", httpMethod = "POST", notes = "我的流转任务")
public PageList<BpmTaskTransRecord> getMyTrans(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter,
HttpServletResponse response) throws Exception {
return iFlowService.getMyTrans(baseContext.getCurrentUserAccout(), queryFilter);
}
@RequestMapping(value = "delegate", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "任务转办", httpMethod = "POST", notes = "任务转办")
public CommonResult<String> delegate(@ApiParam(required = true, name = "assignParamObject", value = "任务转办参数") @RequestBody AssignParamObject assignParamObject,HttpServletResponse response,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam(required = false) Optional<String> leaderId,
@ApiParam(name="assignee",value="任务处理人账号", required = false) @RequestParam(required = false) Optional<String> assignee) throws Exception{
return taskService.delegate(assignParamObject,response,leaderId, assignee);
}
@RequestMapping(value = "doCancelTurn", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "取消代理或转办", httpMethod = "POST", notes = "取消代理或转办")
public CommonResult<String> doCancelTurn(@ApiParam(required = true, name = "assignParamObject", value = "取消代理或转办") @RequestBody AssignParamObject assignParamObject,HttpServletResponse response) throws Exception{
try
{
bpmAgentService.retrieveTask(assignParamObject.getTaskId(), assignParamObject.getMessageType(), assignParamObject.getOpinion());
} catch (Exception e)
{
return new CommonResult<String>(false,"取消任务失败!"+e.getMessage());
}
return new CommonResult<String>(true,"取消流转成功!");
}
@RequestMapping(value = "doRevokeTrans", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "处理撤销流转任务", httpMethod = "POST", notes = "处理撤销流转任务")
public CommonResult<String> doRevokeTrans(@ApiParam(required = true, name = "withDrawParam", value = "撤销流转任务参数") @RequestBody WithDrawParam withDrawParam,HttpServletResponse response) throws Exception{
try
{
return iFlowService.withDraw(withDrawParam);
} catch (Exception e)
{
return new CommonResult<String>(false,"流转任务取回失败!"+e.getMessage());
}
}
@RequestMapping(value = "communicate", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "任务沟通", httpMethod = "POST", notes = "任务沟通")
public CommonResult<String> communicate(@ApiParam(required = true, name = "communicateParamObject", value = "任务沟通参数") @RequestBody CommunicateParamObject communicateParamObject) throws Exception{
return iFlowService.communicate(communicateParamObject);
}
@RequestMapping(value = "taskSignUsers", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "加签", httpMethod = "POST", notes = "加签")
public CommonResult<String> taskSignUsers(@ApiParam(required = true, name = "signParamObject", value = "任务加签参数") @RequestBody AssignParamObject signParamObject,HttpServletResponse response) throws Exception{
return iFlowService.taskSignUsers(signParamObject);
}
@RequestMapping(value = "taskCustomSignUsers", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "添加签署人员", httpMethod = "POST", notes = "添加签署人员")
public CommonResult<String> taskCustomSignUsers(@ApiParam(required = true, name = "signParamObject", value = "任务加签参数") @RequestBody AssignParamObject signParamObject,HttpServletResponse response) throws Exception{
return iFlowService.taskCustomSignUsers(signParamObject);
}
@GetMapping(value="getTaskVar",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据任务taskId, 获取流程变量(全局和节点)", httpMethod = "GET", notes = "根据任务id, 获取流程变量(全局和节点)")
public Map<String,Object> getTaskVar(@ApiParam(name="taskId",required=true) @RequestParam String taskId){
return natTaskService.getVariables(taskId);
}
@GetMapping(value="getTaskVarLocal",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据任务taskId,获取流程任务节点的变量", httpMethod = "GET", notes = "根据任务id,获取流程任务节点的变量")
public Map<String,Object> getTaskVarLocal(@ApiParam(name="taskId",required=true) @RequestParam String taskId){
return natTaskService.getVariablesLocal(taskId);
}
@GetMapping(value="getWorkflowVar",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据流程定义ID或流程定义KEY获取流程变量", httpMethod = "GET", notes = "根据流程定义ID或流程定义KEY获取流程变量")
public List<BpmVariableDef> getWorkflowVar(@ApiParam(name="json",required=true) @RequestParam String json) throws Exception{
return iFlowService.getWorkflowVar(json);
}
@PostMapping(value="setTaskVar",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据任务taskId,设置流程变量", httpMethod = "POST", notes = "根据任务taskId,设置流程变量")
public CommonResult<String> setTaskVar(
@ApiParam(name="taskId",required=true) @RequestParam String taskId,
@ApiParam(name="variables",required=true) @RequestBody Map<String,Object> variables) throws Exception{
return iProcessService.setTaskVar(taskId, variables);
}
@PostMapping(value="setTaskVarLocal",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据任务taskId,设置任务节点本地变量", httpMethod = "POST", notes = "根据任务taskId,设置流程变量")
public CommonResult<String> setTaskVarLocal(
@ApiParam(name="taskId",required=true) @RequestParam String taskId,
@ApiParam(name="variables",required=true) @RequestBody Map<String,Object> variables) throws Exception{
return iProcessService.setTaskVarLocal(taskId, variables);
}
@PostMapping(value="isAllowAddSign",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "判断用户是否有添加会签权限", httpMethod = "POST", notes = "判断用户是否有添加会签权限")
public Boolean isAllowAddSign(@RequestBody@ApiParam(name="isAllowAddSignObject",required=true)IsAllowAddSignObject isAllowAddSignObject) throws Exception {
return iFlowService.isAllowAddSign(isAllowAddSignObject);
}
@RequestMapping(value = "setTaskExecutors", method = RequestMethod.POST, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value = "修改任务执行人", httpMethod = "POST", notes = "修改任务执行人")
public CommonResult<String> setTaskExecutors(@ApiParam(required = true, name = "modifyExecutorsParamObject", value = "修改执行人对象") @RequestBody ModifyExecutorsParamObject modifyExecutorsParamObject)throws Exception {
return iFlowService.setTaskExecutors(modifyExecutorsParamObject);
}
@RequestMapping(value="taskToTrans",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="保存流转信息(增加流转)",httpMethod="POST",notes="保存流转信息(增加流转)")
public CommonResult<String> taskToTrans(@ApiParam(name="taskTransParamObject",value="流转参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam(required = false) Optional<String> leaderId) throws Exception {
BpmUtil.checkDefForbidStatus("", "", taskTransParamObject.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.taskToTrans(taskTransParamObject);
}
@RequestMapping(value="userTaskToSign",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="普通任务加签(流转做的)",httpMethod="POST",notes="普通任务加签")
public CommonResult<String> userTaskToSign(@ApiParam(name="taskTransParamObject",value="加签参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam(required = false) Optional<String> leaderId) throws Exception {
BpmUtil.checkDefForbidStatus("", "", taskTransParamObject.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.userTaskToSign(taskTransParamObject);
}
@RequestMapping(value="taskToSignSequence",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="保存顺序签署信息",httpMethod="POST",notes="保存顺序签署信息")
public CommonResult<String> taskToSignSequence(@ApiParam(name="taskTransParamObject",value="流转参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam Optional<String> leaderId) throws Exception {
BpmUtil.checkDefForbidStatus("", "", taskTransParamObject.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.taskToSignSequence(taskTransParamObject);
}
@RequestMapping(value="taskToSignLine",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="保存并行签署信息",httpMethod="POST",notes="保存并行签署信息")
public CommonResult<String> taskToSignLine(@ApiParam(name="taskTransParamObject",value="流转参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam Optional<String> leaderId) throws Exception {
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.taskToSignLine(taskTransParamObject);
}
@RequestMapping(value="taskToApproveLine",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="保存并行审批信息",httpMethod="POST",notes="保存并行审批信息")
public CommonResult<String> taskToApproveLine(@ApiParam(name="taskTransParamObject",value="并行审批参数对象",required=true) @RequestBody TaskApproveLineParam taskApproveLineParam,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam Optional<String> leaderId) throws Exception {
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.taskToApproveLine(taskApproveLineParam);
}
@RequestMapping(value="getTaskByTaskId",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="通过任务id获取任务对象",httpMethod="GET",notes="通过任务id获取任务对象")
public BpmTaskResult getTaskByTaskId(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception{
return iProcessService.getTaskByTaskId(taskId);
}
@RequestMapping(value="getTaskNameByTaskId",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="通过任务id获取任务名称",httpMethod="GET",notes="通过任务id获取任务名称")
public String getTaskNameByTaskId(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception{
return iProcessService.getTaskNameByTaskId(taskId);
}
@RequestMapping(value="getTasksByInstId",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="通过实例id获取任务列表",httpMethod="GET",notes="通过实例id获取任务列表")
public PageList<DefaultBpmTask> getTasksByInstId(@ApiParam(name="instId",value="实例id",required=true) @RequestParam String instId) throws Exception{
return iProcessService.getTasksByInstId(instId);
}
@RequestMapping(value="instanceDetail",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="通过实例ID集合获取流程当前状态信息",httpMethod="POST",notes="通过实例ID集合获取流程当前状态信息")
public CommonResult<Map<String, List<DefaultBpmTask>>> getTasksByInstIds(@ApiParam(name="ids",value="实例id集合",required=true) @RequestBody List<String> ids) throws Exception{
Map<String, List<DefaultBpmTask>> result = iProcessService.instanceDetails(ids);
return new CommonResult<>(true, "获取成功",result);
}
@RequestMapping(value="getMyRequestTask",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取我的请求对应实例的当前任务",httpMethod="POST",notes="获取我的请求对应实例的当前任务")
public CommonResult<DefaultBpmTask> getMyRequestTask(@ApiParam(name="id",value="实例id",required=true) @RequestBody String id) throws Exception{
DefaultBpmTask result = iProcessService.getMyRequestTask(id);
return new CommonResult<>(true, "获取成功",result);
}
@RequestMapping(value = "getNextTaskUsers", method = RequestMethod.GET, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="根据任务id获取下一环节处理人",notes="根据任务id获取下一环节处理人",httpMethod="GET")
public Map<String, List<BpmIdentity>> getNextTaskUsers(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iFlowService.getNextTaskUsers(taskId);
}
@RequestMapping(value="getApprovalItems",method= RequestMethod.GET,produces={"application/json; charset=utf-8"})
@ApiOperation(value="根据任务id获取预先设置的审批用语列表",notes="根据任务id获取预先设置的审批用语列表",httpMethod="GET")
public List<String> getApprovalItems(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iProcessService.getApprovalItems(taskId);
}
@RequestMapping(value="getTaskOutNodes",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="通过任务id获取任务的后续节点",httpMethod="GET",notes="通过任务id获取任务的后续节点")
public List<BpmNodeDefVo> getTaskOutNodes(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception{
return iProcessService.getTaskOutNodes(taskId);
}
@GetMapping(value="getUrlFormByTaskId",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "获取任务的在线表单地址", httpMethod = "GET", notes = "获取任务的在线表单地址")
public String getUrlFormByTaskId(
@ApiParam(name="taskId",required=true) @RequestParam String taskId,
@ApiParam(name="formType",required=true,defaultValue="pc") @RequestParam String formType) throws Exception{
return iFlowService.getUrlFormByTaskId( taskId,formType );
}
@GetMapping(value="getInstUrlForm",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "获取实例在线表单", httpMethod = "GET", notes = "获取实例在线表单")
public String getInstUrlForm(
@ApiParam(name="proInstId",required=true) @RequestParam String proInstId,
@ApiParam(name="nodeId",required=false) @RequestParam(required=false) String nodeId,
@ApiParam(name="formType",required=true,defaultValue="pc") @RequestParam String formType ) throws Exception{
return iFlowService.getInstUrlForm(proInstId,nodeId,formType);
}
@RequestMapping(value="taskDoNext",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="管理员处理任务页面",httpMethod="GET",notes="管理员处理任务页面")
public TaskDoNextVo taskDoNext(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iFlowService.taskDoNext(taskId).get();
}
@RequestMapping(value="taskApprove",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取用户审批界面参数",httpMethod="GET",notes="获取用户审批界面参数")
public TaskDoNextVo taskApprove(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iFlowService.taskApprove(taskId);
}
@RequestMapping(value="taskImage",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取查看任务流程图参数",httpMethod="GET",notes="获取查看任务流程图界面参数")
public TaskjImageVo taskImage(
@ApiParam(name="taskId",value="任务id",required = true) @RequestParam(required = true) Optional<String> taskId,
@ApiParam(name="defId",value="流程定义id",required = false) @RequestParam(required = false) Optional<String> defId) throws Exception {
return iFlowService.taskImage(taskId.orElse(""),defId.orElse(""));
}
@RequestMapping(value="nodeOpinion",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取流程实例中指定节点的审批意见",httpMethod="GET",notes="获取流程实例中指定节点的审批意见")
public Object nodeOpinion(
@ApiParam(name="defId",value="流程定义id",required=true) @RequestParam Optional<String> defId,
@ApiParam(name="instId",value="流程实例id",required=true) @RequestParam Optional<String> instId,
@ApiParam(name="nodeId",value="任务节点id,多个以逗号拼接",required=true) @RequestParam String nodeId) throws Exception {
return taskService.nodeOpinion(defId,instId,nodeId, true);
}
@RequestMapping(value="nodeOpinionFromPreview",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取流程实例中指定节点的审批意见 会签节点记录会进行分组",httpMethod="GET",notes="获取流程实例中指定节点的审批意见 会签节点记录会进行分组")
public Object nodeOpinionFromPreview(
@ApiParam(name="defId",value="流程定义id",required=true) @RequestParam Optional<String> defId,
@ApiParam(name="instId",value="流程实例id",required=true) @RequestParam Optional<String> instId,
@ApiParam(name="nodeId",value="任务节点id,多个以逗号拼接",required=true) @RequestParam String nodeId,
@ApiParam(name="isDerive",value="是否推演未到达节点审批人",required=true) @RequestParam Optional<String> isDerive) throws Exception {
boolean derive = true;
if (isDerive.orElse("true").equals("false")) {
derive = false;
}
return taskService.nodeOpinionFromPreview(defId,instId,nodeId, derive);
}
@RequestMapping(value="taskBackOpinion",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取当前实例最近一次的驳回记录",httpMethod="GET",notes="获取当前实例最近一次的驳回记录")
public Object taskBackOpinion(
@ApiParam(name="instId",value="流程定义id",required=true) @RequestParam String instId
) throws Exception {
return taskService.taskBackOpinion(instId);
}
/**
* @param taskId
* @param leaderId
* @return
* @throws Exception
*/
@RequestMapping(value="getButtonsBytaskId",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="根据任务ID获取审批按钮",httpMethod="GET",notes="根据任务ID获取审批按钮")
public TaskDetailVo getButtonsBytaskId(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId,
@ApiParam(name="leaderId",value="代为处理的领导id",required=true) @RequestParam Optional<String> leaderId) throws Exception {
/*if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}*/
return taskService.getButtonsBytaskId(taskId,leaderId);
}
@RequestMapping(value="taskDetail",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取任务的详情",httpMethod="GET",notes="获取任务的详情")
public TaskDetailVo taskDetail(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId,
@ApiParam(name="reqParams",value="请求参数",required=false) @RequestParam(required = false) String reqParams,
@ApiParam(name="leaderId",value="代为处理的领导id",required=false) @RequestParam(required = false) Optional<String> leaderId) throws Exception {
return iFlowService.taskDetail(taskId,reqParams,FormType.PC,leaderId.orElse("")).get();
}
@RequestMapping(value="taskDetailBo",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取任务的详情",httpMethod="GET",notes="获取任务的详情")
@PermissionCheck(taskId = "#taskId",isDefAuthorize = "#isDefAuthorize")
public CommonResult<TaskDetailVo> taskDetailBo(
@ApiParam(name = "taskId", value = "任务id", required = true) @RequestParam String taskId,
@ApiParam(name="reqParams",value="请求参数",required=true) @RequestParam String reqParams,
@ApiParam(name="leaderId",value="代为处理的领导id",required=false) @RequestParam(required = false) Optional<String> leaderId,
@ApiParam(name = "isDefAuthorize", value = "是否是分管授权获取的打开权限") @RequestParam(required = false) String isDefAuthorize) throws Exception {
TaskDetailVo taskDetailVo = iFlowService
.taskDetail(taskId, reqParams, FormType.PC, leaderId.orElse("").equals("0") ? "" : leaderId.orElse(""))
.get();
return CommonResult.<TaskDetailVo>ok().value(taskDetailVo);
}
@RequestMapping(value="taskMobileDetail",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取手机任务的详情",httpMethod="GET",notes="获取手机任务的详情")
@PermissionCheck(taskId = "#taskId",isDefAuthorize = "#isDefAuthorize")
public TaskDetailVo taskMobileDetail(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId,
@ApiParam(name="reqParams",value="请求参数",required=false) @RequestParam(required = false) String reqParams,
@ApiParam(name = "isDefAuthorize", value = "是否是分管授权获取的打开权限") @RequestParam(required = false) String isDefAuthorize) throws Exception {
return iFlowService.taskDetailMobile(taskId,reqParams,FormType.MOBILE).get();
}
@RequestMapping(value="getMyTasks",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取我的待办,并且进行条件过滤",httpMethod="GET",notes="获取我的待办,并且进行条件过滤")
public PageList<DefaultBpmTask> getMyTasks(
@ApiParam(name="account",value="用户账号",required=true) @RequestParam String account,
@ApiParam(name="queryFilter",value="通用查询对象")@RequestBody QueryFilter queryFilter) throws Exception {
IUser user = ServiceUtil.getUserByAccount(account);
return (PageList<DefaultBpmTask>) bpmTaskManager.getByUserId(user.getUserId(), queryFilter);
}
@RequestMapping(value="getTaskEnt",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="根据任务id获取待办",httpMethod="GET",notes="根据任务id获取待办")
public BpmTask getTaskEnt(
@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return bpmTaskManager.get(taskId);
}
@RequestMapping(value="getTaskVars",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取任务上下文流程变量",httpMethod="GET",notes="获取任务上下文流程变量")
public Map<String, Object> getTaskVars(
@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iFlowService.getTaskVars(taskId,null);
}
@RequestMapping(value="complete",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="处理任务",httpMethod="POST",notes="处理任务")
public CommonResult<String> complete(@ApiParam(name="doNextParamObject",value="流转参数对象",required=true) @RequestBody DoNextParamObject doNextParamObject) throws Exception {
if(!iFlowService.isAuth(doNextParamObject.getTaskId(), doNextParamObject.getAgentLeaderId())) {
return new CommonResult<>(false, "您没有处理该任务的权限!");
}
try {
return iFlowService.complete(doNextParamObject).get();
} catch (SQLException e) {
if (StringUtil.hasEmoji(doNextParamObject.getOpinion())) {
return new CommonResult<>(false, "审批意见不能输入表情!");
}
throw e;
}
}
@RequestMapping(value="saveDraft",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="保存草稿",httpMethod="POST",notes="保存草稿")
public CommonResult<String> saveDraft(@ApiParam(name="doNextParamObject",value="流转参数对象",required=true) @RequestBody DoNextParamObject doNextParamObject) throws Exception {
return iFlowService.saveDraft(doNextParamObject);
}
@RequestMapping(value="list", method=RequestMethod.POST, produces={"application/json; charset=utf-8" })
@ApiOperation(value = "任务列表(分页条件查询)数据", httpMethod = "POST", notes = "获取任务列表")
public PageList<DefaultBpmTask> listJson(@ApiParam(name="queryFilter",value="通用查询对象")@RequestBody QueryFilter queryFilter) throws Exception {
PageList<DefaultBpmTask> res=taskService.listJson(queryFilter);
return res;
}
@RequestMapping(value="get",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取任务明细", httpMethod = "GET", notes = "获取任务明细")
public TaskGetVo get(@ApiParam(name="id",value="任务id", required = true) @RequestParam String id) throws Exception{
return iFlowService.getTaskById(id,true).get();
}
@RequestMapping(value="getNotice",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取任务明细", httpMethod = "GET", notes = "获取任务明细")
public TaskGetVo getNotice(@ApiParam(name="id",value="任务id", required = true) @RequestParam String id) throws Exception{
return iFlowService.getTaskById(id,false).get();
}
@RequestMapping(value="taskToAgree",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="任务办理(同意、反对、弃权)",httpMethod="GET",notes="任务办理(同意、反对、弃权)")
public TaskToAgreeVo taskToAgree(
@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId,
@ApiParam(name="actionName",value="审批动作",required=true) @RequestParam String actionName) throws Exception {
return iFlowService.toAgree(taskId,actionName);
}
@RequestMapping(value="taskToReject",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "驳回任务页面参数", httpMethod = "GET", notes = "驳回任务页面参数")
public TaskToRejectVo taskToReject(
@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId,
@ApiParam(name="backModel",value="驳回模式:reject、backToStart") @RequestParam String backModel) throws Exception{
return iFlowService.toReject(taskId,backModel);
}
@RequestMapping(value="handlerTypes",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取支持的消息处理类型", httpMethod = "GET", notes = "获取支持的消息处理类型")
public Map<String, String> getHandlerTypes() throws Exception{
return MessageUtil.getHandlerTypes();
}
@RequestMapping(value="getTaskTransById",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据流转任务id明细", httpMethod = "GET", notes = "根据流转任务id明细")
public BpmTaskTransRecord getTaskTransById(@ApiParam(name="id",value="流转任务id", required = true) @RequestParam String id) throws Exception{
return taskTransRecordManager.get(id);
}
@RequestMapping(value="getTransRecordList",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取任务的流转记录明细", httpMethod = "GET", notes = "获取任务的流转记录明细")
public List<BpmTaskTransRecord> getTransRecordList(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId) throws Exception{
QueryFilter queryFilter = QueryFilter.<BpmTaskTransRecord>build()
.withPage(new PageBean(1, PageBean.WITHOUT_PAGE))
.withParam("taskId", taskId);
return taskTransRecordManager.getTransRecordList(queryFilter);
}
@RequestMapping(value="withDraw",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="撤销我流转出去的任务",httpMethod="POST",notes="撤销我流转出去的任务")
public CommonResult<String> withDraw(@ApiParam(name="taskId",value="任务id",required=true) @RequestBody WithDrawParam withDrawParam) throws Exception {
return iFlowService.withDraw(withDrawParam);
}
@RequestMapping(value="remove",method=RequestMethod.DELETE, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "删除任务记录", httpMethod = "DELETE", notes = "删除任务记录")
public CommonResult<String> remove(@ApiParam(name="ids",value="任务记录ID,多个用“,”号分隔", required = true) @RequestParam String ids) throws Exception{
String[] aryIds = null;
if(!StringUtil.isEmpty(ids)){
aryIds = ids.split(",");
}
bpmTaskManager.removeByIds(aryIds);
return new CommonResult<String>(true,"删除任务成功","");
}
@RequestMapping(value="getTaskCommu",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取沟通反馈任务", httpMethod = "GET", notes = "通过沟通任务id获取沟通反馈任务")
public TaskCommuVo getTaskCommu(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId) throws Exception{
BpmTask bpmTask = bpmTaskManager.get(taskId);
BpmTaskCommu taskCommu = bpmTaskCommuManager.getByTaskId(bpmTask.getParentId());
List<BpmCommuReceiver> commuReceivers = null; // 回复消息的
if (taskCommu != null) {
commuReceivers = bpmCommuReceiverManager.getByCommuStatus(taskCommu.getId(), null);
}
return new TaskCommuVo(taskCommu, commuReceivers);
}
@RequestMapping(value="canLock",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取任务是否能锁定", httpMethod = "GET", notes = "获取任务是否能锁定,返回当前任务的可操作状态:0:任务已经处理,1:可以锁定,2:不需要解锁 ,3:可以解锁,4,被其他人锁定,5:这种情况一般是管理员操作,所以不用出锁定按钮")
public int canLock(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId,
@ApiParam(name="leaderId",value="领导id", required = true) @RequestParam Optional<String> leaderId) throws Exception{
DefaultBpmTask task = bpmTaskManager.get(taskId);
if(task==null){
return 0;
}
boolean isForbindden = bpmInstService.isSuspendByInstId(task.getProcInstId());
if(isForbindden){//流程已经被禁止
return 6;
}
int rtn = bpmTaskManager.canLockTask(taskId,leaderId.orElse(""));
// 判断权限
return rtn;
}
@RequestMapping(value="isForbindden",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取流程任务是否已被禁用", httpMethod = "GET", notes = "获取流程任务是否已被禁用:1、流程已经被禁止,2、任务不存在,3、没有处理此任务的权限。")
public int isForbindden(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId) throws Exception{
DefaultBpmTask task = bpmTaskManager.get(taskId);
if(task == null) return 2; //任务不存在,可能已经被处理!
boolean isForbindden = bpmInstService.isSuspendByInstId(task.getProcInstId());
IUser user=ContextUtil.getCurrentUser();
if(!user.isAdmin()){
ObjectNode jsonObj = bpmDefAuthorizeManager.getRight(task.getProcDefKey(), BpmDefAuthorizeType.BPMDEFAUTHORIZE_RIGHT_TYPE.TASK);
if(jsonObj == null && !ContextUtil.getCurrentUserId().equals(task.getAssigneeId()) ) return 3;//没有处理此任务的权限!
}
if(isForbindden){//流程已经被禁止
return 1;
}else{
return 0;
}
}
@RequestMapping(value="lockUnlock",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取任务锁定状态", httpMethod = "GET", notes = "获取任务锁定状态:0:任务已经处理,1:可以锁定,2:不需要解锁 ,3:可以解锁,4,被其他人锁定。")
public int lockUnlock(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId,
@ApiParam(name="leaderId",value="领导id", required = false) @RequestParam Optional<String> leaderId) throws Exception{
//0:任务已经处理,1:可以锁定,2:不需要解锁 ,3:可以解锁,4,被其他人锁定
String curUserId=ContextUtil.getCurrentUserId();
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
curUserId = leaderId.get();
}
int rtn = bpmTaskManager.canLockTask(taskId);
if(rtn==0 || rtn==4 || rtn==2 || rtn==5 ){
return rtn;
}
//锁定
if(rtn==1){
bpmTaskManager.lockTask(taskId, curUserId);
}
//解锁
else{
bpmTaskManager.unLockTask(taskId,curUserId);
}
return rtn;
}
@RequestMapping(value="getCandidatesListByInstId",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据流程实例获取其下的候选人列表", httpMethod = "GET", notes = "根据流程实例获取其下的候选人列表")
public List<BpmIdentity> getCandidatesListByInstId(@ApiParam(name="instId",value="流程实例id", required = true) @RequestParam String instId) throws Exception{
QueryFilter queryFilter = QueryFilter.<DefaultBpmTask>build();
queryFilter.addFilter("PROC_INST_ID_", instId, QueryOP.EQUAL);
queryFilter.addFilter("task.STATUS_","TRANSFORMING" ,QueryOP.NOT_EQUAL);
PageList<DefaultBpmTask> query = bpmTaskManager.query(queryFilter);
if (query.getRows().size() !=1 ) {
return null;
}
DefaultBpmTask defaultBpmTask = query.getRows().get(0);
BpmTaskService bpmTaskService = AppUtil.getBean(BpmTaskService.class);
List<BpmIdentity> bpmIdentities = bpmTaskService.getTaskCandidates(defaultBpmTask.getTaskId());
return bpmIdentities;
}
@RequestMapping(value="taskNode",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取可跟踪的任务节点",httpMethod="GET",notes="获取可跟踪的任务节点")
public TaskjImageVo taskNode(
@ApiParam(name="taskId",value="任务id") @RequestParam Optional<String> taskId,
@ApiParam(name="defId",value="流程定义id") @RequestParam Optional<String> defId) throws Exception {
TaskjImageVo taskNode = iFlowService.taskImage(taskId.orElse(""),defId.orElse(""));
Locale locale = LocaleContextHolder.getLocale();
if (! Locale.SIMPLIFIED_CHINESE.equals(locale)) {
DefaultBpmDefinition defaultBpmDefinition = bpmDefinitionManager.get(defId.orElse(""));
String procDefKey = defaultBpmDefinition.getDefKey();
BpmDefLayout bpmDefLayout = taskNode.getBpmDefLayout();
List<BpmNodeLayout> listLayout = bpmDefLayout.getListLayout();
for (BpmNodeLayout bpmNodeLayout : listLayout) {
String key="flow."+procDefKey+"."+bpmNodeLayout.getNodeId();
String mes = I18nUtil.getMessage(key, locale);
if (!key.equals(mes)) {
bpmNodeLayout.setName(mes);
}
}
}
return taskNode;
}
@RequestMapping(value="addSign",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="加签",httpMethod="POST",notes="加签")
public CommonResult<String> addSign(@ApiParam(name="taskTransParamObject",value="流转参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject) throws Exception {
return taskTransService.addSign(taskTransParamObject);
}
@RequestMapping(value="isEnd",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "流程是否结束", httpMethod = "POST", notes = "流程是否结束")
public CommonResult<String> isEnd(@ApiParam(name="procInstId",value="流程实例id", required = true) @RequestParam String procInstId) throws Exception{
DefaultBpmProcessInstance defaultBpmProcessInstance = bpmProcessInstanceManager.get(procInstId);
List<String> endStatus = Arrays.asList(ProcessInstanceStatus.STATUS_END.getKey(),ProcessInstanceStatus.STATUS_MANUAL_END.getKey());
String errorMsg = BeanUtils.isEmpty(defaultBpmProcessInstance)? "流程实例不存在":"流程实例已结束!";
if(BeanUtils.isEmpty(defaultBpmProcessInstance) || endStatus.contains(defaultBpmProcessInstance.getStatus())){
return new CommonResult<>(false,errorMsg);
}
return new CommonResult<>(true,"");
}
@RequestMapping(value="taskToInqu",method=RequestMethod.POST,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="征询设置",httpMethod="POST",notes="征询设置")
public CommonResult<String> taskToInqu(@ApiParam(name="taskTransParamObject",value="征询参数对象",required=true) @RequestBody TaskTransParamObject taskTransParamObject,
@ApiParam(name="leaderId",value="代为处理的领导id",required=true) @RequestParam Optional<String> leaderId) throws Exception {
BpmUtil.checkDefForbidStatus("", "", taskTransParamObject.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
return iFlowService.taskToInqu(taskTransParamObject);
}
@RequestMapping(value="taskToInquReply",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "征询回复", httpMethod = "POST", notes = "征询回复")
public CommonResult<String> taskToInquReply(@ApiParam(name="dbo",value="回复信息", required = true) @RequestBody DefaultBpmCheckOpinion dbo,
@ApiParam(name="leaderId",value="代为处理的领导id",required=true) @RequestParam Optional<String> leaderId) throws Exception{
if(!iFlowService.isAuth(dbo.getTaskId(),leaderId.orElse(null))) {
throw new RuntimeException("您没有处理该任务的权限!");
}
try {
BpmUtil.checkDefForbidStatus("", "", dbo.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
bpmTaskTransManager.taskToInquReply(dbo);
return new CommonResult<>(true,"征询回复成功");
} catch (Exception e) {
return new CommonResult<>(false,"征询回复失败:"+e.getMessage());
}
}
@RequestMapping(value="userAddSignFeedback",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "普通用户节点用户加签反馈", httpMethod = "POST", notes = "普通用户节点用户加签反馈")
public CommonResult<String> userAddSignFeedback(@ApiParam(name="dbo",value="回复信息", required = true) @RequestBody DefaultBpmCheckOpinion dbo,
@ApiParam(name="leaderId",value="代为处理的领导id",required=true) @RequestParam Optional<String> leaderId) throws Exception{
try {
BpmUtil.checkDefForbidStatus("", "", dbo.getTaskId());
if (StringUtil.isNotZeroEmpty(leaderId.orElse(""))) {
ThreadMsgUtil.addMapMsg("leaderId", leaderId.get());
}
bpmTaskTransManager.userAddSignFeedback(dbo);
return new CommonResult<>(true,"加签反馈成功");
} catch (Exception e) {
return new CommonResult<>(false,"加签反馈失败:"+e.getMessage());
}
}
@RequestMapping(value="addReadRecord",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据所传任务id新增该任务的阅读记录", httpMethod = "POST", notes = "根据所传任务id新增该任务的阅读记录")
public void addReadRecord(@ApiParam(name="taskId",value="任务id", required = true) @RequestParam String taskId) throws Exception{
DefaultBpmTask bpmTask = bpmTaskManager.get(taskId);
if (BeanUtils.isEmpty(bpmTask)) {
bpmTask = new DefaultBpmTask();
BpmTaskNoticeManager noticeManager = AppUtil.getBean(BpmTaskNoticeManager.class);
BpmTaskNotice bpmTaskNotice = noticeManager.get(taskId);
if (BeanUtils.isEmpty(bpmTaskNotice)) {
throw new BaseException("根据所传任务id:"+taskId+"未找到任务!");
}
bpmTask = bpmTaskNotice.convertToBpmTask();
}
iFlowService.addReadRecord(bpmTask);//添加阅读记录
//当前用户为候选人或者执行人时,才修改任务为已读状态
List<IUser> userList = bpmTaskService.getUsersByTaskId(bpmTask.getId());
if(!CollectionUtils.isEmpty(userList)){
String currUserId = ContextUtil.getCurrentUserId();
if(userList.stream().anyMatch(u->Objects.equals(u.getUserId(), currUserId))){
bpmCheckOpinionManager.checkOpinionIsRead(bpmTask.getId());//根据任务ID修改任务为已阅
}
}
}
@RequestMapping(value="noticeTurnDode",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "知会任务待办转已办", httpMethod = "POST", notes = "知会任务待办转已办")
public void noticeTurnDode(@ApiParam(name="taskId",value="知会任务主键id集合", required = true) @RequestParam String taskId) throws Exception{
String[] val = taskId.split(",");
for(String id:val){
iFlowService.noticeTurnDode(id);
}
}
@RequestMapping(value="getCurNodeProperties",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取当前节点属性,启动的时候取发起节点", httpMethod = "GET", notes = "获取当前节点属性,启动的时候取发起节点")
public BpmNodeDef getCurNodeProperties(@ApiParam(name="taskId",value="任务id", required = false) @RequestParam Optional<String> taskId,
@ApiParam(name="defId",value="定义id", required = false) @RequestParam Optional<String> defId,
@ApiParam(name="instId",value="流程实例id", required = false) @RequestParam Optional<String> instId) throws Exception{
return iFlowService.getCurNodeProperties(taskId.orElse(""),defId.orElse(""),instId.orElse(""));
}
@RequestMapping(value="getNodePropertiesByNodeId",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取指定节点属性", httpMethod = "GET", notes = "获取指定节点属性")
public CommonResult<BpmNodeDef> getNodePropertiesByNodeId(@ApiParam(name="defId",value="定义id", required = false) @RequestParam Optional<String> defId,
@ApiParam(name="instId",value="流程实例id", required = false) @RequestParam Optional<String> instId,
@ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId) throws Exception{
try{
return CommonResult.success(iFlowService.getNodePropertiesByNodeId(defId.orElse(""),instId.orElse(""),nodeId));
}catch (Exception e){
return CommonResult.error(e.getMessage());
}
}
@RequestMapping(value="getAfterJumpNodes",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据节点配置获取后续可跳转节点", httpMethod = "POST", notes = "根据节点配置获取后续可跳转节点")
public ObjectNode getAfterJumpNodes(@ApiParam(name="taskId",value="任务id", required = true) @RequestBody ObjectNode obj ) throws Exception{
return iFlowService.getAfterJumpNode( obj );
}
@RequestMapping(value="getNoticeTodoReadById",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取待阅任务(知会任务)", httpMethod = "GET", notes = "获取待阅任务(知会任务)")
public BpmTaskNotice getNoticeTodoReadById(@ApiParam(required = true, name = "noticeId", value = "查询参数对象") @RequestParam("noticeId") String noticeId){
return iFlowService.getNoticeTodoReadById(noticeId);
}
@RequestMapping(value="getNoticeTodoReadList",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取待阅任务(知会任务)", httpMethod = "POST", notes = "获取待阅任务(知会任务)")
public PageList<BpmTaskNotice> getNoticeTodoReadList(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
PageList<BpmTaskNotice> pageList = iFlowService.getNoticeTodoReadList(baseContext.getCurrentUserAccout(), queryFilter);
return pageList;
}
@PostMapping(value="getNoticeTodoReadCount", produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取待阅任务(知会任务)数量", httpMethod = "POST", notes = "获取待阅任务(知会任务)数量")
public List<Map<String,Object>> getNoticeTodoReadCount(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
return iFlowService.getNoticeTodoReadCount(baseContext.getCurrentUserAccout(), queryFilter);
}
@RequestMapping(value="getNoticeDoneReadList",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取已阅任务(知会任务)", httpMethod = "POST", notes = "获取已阅任务(知会任务)")
public PageList<BpmTaskNoticeDone> getNoticeDoneReadList(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
//JAVA 8
List<QueryField> boys = queryFilter.getQuerys();
Optional<QueryField> queryFieldOptional= boys.stream().filter(s->s.getProperty().equals("inst.PROC_DEF_KEY_")).findFirst();
if (queryFieldOptional.isPresent()) {// 判断是否存在 inst.PROC_DEF_KEY_ 这个查询条件
QueryField queryField = queryFieldOptional.get();
//通过流程定义KEY获取流程定义信息
DefaultBpmDefinition po = bpmDefinitionManager.getMainByDefKey(queryFieldOptional.get().getValue().toString());
//通过流程定义ID查询已阅任务
queryFilter.addFilter("bpm_task_notice_done.PROC_DEF_ID_", po.getDefId(), QueryOP.EQUAL);
//删除通过流程定义key获取已阅任务的参数
queryFilter.getQuerys().remove(queryFieldOptional.get());
}
PageList<BpmTaskNoticeDone> pageList = iFlowService.getNoticeDoneReadList(baseContext.getCurrentUserAccout(), queryFilter);
return pageList;
}
@PostMapping(value="getNoticeDoneReadCount", produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取待阅任务(知会任务)数量", httpMethod = "POST", notes = "获取待阅任务(知会任务)数量")
public List<Map<String,Object>> getNoticeDoneReadCount(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
return iFlowService.getNoticeDoneReadCount(baseContext.getCurrentUserAccout(), queryFilter);
}
@RequestMapping(value="getMyNoticeReadList",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取我传阅的任务(知会任务)", httpMethod = "POST", notes = "获取我传阅的任务(知会任务)")
public PageList<BpmTaskNotice> getMyNoticeReadList(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
PageList<BpmTaskNotice> pageList = iFlowService.getMyNoticeReadList(baseContext.getCurrentUserAccout(), queryFilter);
return pageList;
}
@PostMapping(value="getMyNoticeReadCount", produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "获取待阅任务(知会任务)数量", httpMethod = "POST", notes = "获取待阅任务(知会任务)数量")
public List<Map<String,Object>> getMyNoticeReadCount(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception{
return iFlowService.getMyNoticeReadCount(baseContext.getCurrentUserAccout(), queryFilter);
}
@RequestMapping(value="delBpmTaskNoticeById",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据ID主键ID删除传阅任务", httpMethod = "POST", notes = "根据ID主键ID删除传阅任务")
public CommonResult<String> delBpmTaskNoticeById(@ApiParam(name="id",value="主键ID", required = true) @RequestParam String id) throws Exception{
try {
iFlowService.delBpmTaskNoticeById(id);
return new CommonResult<>(true,I18nUtil.getMessage("myRead.withdrawSuccess",LocaleContextHolder.getLocale()));
} catch (Exception e) {
return new CommonResult<>(false,I18nUtil.getMessage("myRead.withdrawFail",LocaleContextHolder.getLocale())+":"+e.getMessage());
}
}
@RequestMapping(value="nextExecutor",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="获取顺序签署下一步执行人",httpMethod="GET",notes="获取顺序签署下一步执行人")
public CommonResult<BpmIdentity> nextExecutor(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId) throws Exception {
return iFlowService.nextExecutor(taskId);
}
@RequestMapping(value="testRevoke",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="顺签撤回",httpMethod="GET",notes="顺签撤回")
public CommonResult<BpmIdentity> testRevoke(@ApiParam(name="taskId",value="任务id",required=true) @RequestParam String taskId
,@ApiParam(name="customSignTaskId",value="任务id",required=true) @RequestParam String customSignTaskId
,@ApiParam(name="instId",value="instId",required=true) @RequestParam String instId) throws Exception {
/**
* 顺签An-1撤回An 的验证
bpmTaskManager.sequentialTaskRevoke(taskId, customSignTaskId);
*/
/*
*
* 并行审批 An 撤回验证
bpmTaskManager.approvalTaskRevoke(taskId, customSignTaskId);
*/
/**
* 并审 A 撤回A1 ... An
*
*/
return new CommonResult<>(true,"成功");
}
//获取代办任务列表
@RequestMapping(value="getBpmTaskByInstId",method=RequestMethod.GET,produces = {
"application/json; charset=utf-8" })
@ApiOperation(value="根据流程实例Id获取代办任务",httpMethod="GET",notes="根据流程实例Id获取代办任务")
public List<DefaultBpmTask> getBpmTaskByInstId(@ApiParam(name="instId",value="流程实例Id",required=true) @RequestParam String instId) throws Exception {
IUser iUser=userService.getUserByAccount(baseContext.getCurrentUserAccout());
QueryFilter queryFilter=QueryFilter.build().withPage(new PageBean(1, PageBean.WITHOUT_PAGE));
queryFilter.addFilter("bt.proc_inst_id_", instId, QueryOP.EQUAL);
return bpmTaskManager.getByUserId(iUser.getUserId(),queryFilter).getRows();
}
@RequestMapping(value="getCandidatesListByTaskId",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据任务id获取其下的候选人列表并抽取执行人", httpMethod = "GET", notes = "根据任务id获取其下的候选人列表并抽取执行人")
public ArrayNode getCandidatesListByTaskId(@ApiParam(name="taskId",value="流程实例id", required = true) @RequestParam String taskId) throws Exception{
ArrayNode res=taskService.getCandidatesListByTaskId(taskId);
return res;
}
@RequestMapping(value="getTaskListByTenantId",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" })
@ApiOperation(value = "根据租户id获取任务列表", httpMethod = "GET", notes = "根据租户id获取任务列表")
public List<ObjectNode> getTaskListByTenantId(@ApiParam(name="tenantId",value="租户id", required = true) @RequestParam String tenantId) throws Exception{
return bpmTaskManager.getTaskListByTenantId(tenantId);
}
@RequestMapping(value = "getLeaderTodoCount", produces = {"application/json; charset=utf-8"})
@ApiOperation(value="获取领导待办数目", httpMethod = "GET", notes = "获取领导待办数目")
public List<Map<String,Object>> getLeaderTodoCount() throws Exception{
return bpmTaskManager.getLeaderCountByUserId(baseContext.getCurrentUserId());
}
@RequestMapping(value = "createBpmSaveOpinion",method=RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value="新增或修改暂存的审批意见", httpMethod = "POST", notes = "新增或修改暂存的审批意见")
public CommonResult<String> createBpmSaveOpinion(@ApiParam(name="bpmSaveOpinion", value="审批意见暂存信息") @RequestBody BpmSaveOpinion bpmSaveOpinion) {
boolean result = bpmSaveOpinionManager.createBpmSaveOpinion(bpmSaveOpinion);
if(!result) {
return new CommonResult<>(false, "暂存失败");
}
return new CommonResult<>(true, "暂存成功");
}
@RequestMapping(value = "getBpmSaveOpinionByTeam", method=RequestMethod.GET,produces = {"application/json; charset=utf-8"})
@ApiOperation(value="通过流程实例ID和任务ID获取审批意见", httpMethod = "GET", notes = "通过流程实例ID和任务ID获取审批意见")
public CommonResult<String> getBpmSaveOpinionByTeam(@ApiParam(name="instId",value="流程实例ID", required = true) @RequestParam String instId,
@ApiParam(name="taskId",value="流程任务ID", required = true) @RequestParam String taskId) throws Exception{
Map<String, Object> params = new HashMap<>();
params.put("instId", instId);
params.put("taskId", taskId);
BpmSaveOpinion bpmSaveOpinion = bpmSaveOpinionManager.getBpmSaveOpinionByTeam(params);
if (BeanUtils.isNotEmpty(bpmSaveOpinion)) {
return new CommonResult<String>(true,"获取成功",bpmSaveOpinion.getOpinion());
}else{
return new CommonResult<String>(true,"获取失败","");
}
}
@RequestMapping(value = "checkTaskAuth", method=RequestMethod.GET,produces = {"application/json; charset=utf-8"})
@ApiOperation(value="验证当前用户是否有该任务处理权限", httpMethod = "GET", notes = "验证当前用户是否有该任务处理权限")
public CommonResult<Boolean> checkTaskAuth(@ApiParam(name="taskId",value="流程任务ID", required = true) @RequestParam String taskId) throws Exception{
return new CommonResult<>(true,"获取成功", iFlowService.checkTaskByAssignee(taskId));
}
@RequestMapping(value = "batchHandle", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"})
@ApiOperation(value="批量处理任务", httpMethod = "POST", notes = "批量处理任务")
public CommonResult<HashMap<String,Object>> batchHandle(@ApiParam(name = "requestMap",value = "请求体") @RequestBody Map<String,Object> requestMap) throws Exception{
CommonResult<HashMap<String,Object>> res=taskService.batchHandle(requestMap);
return res;
}
@RequestMapping(value = "nextTask", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "获取下一个代办任务",httpMethod = "GET",notes = "获取下一个代办任务")
public CommonResult<DefaultBpmTask> nextTask(@ApiParam(name = "defId",value = "流程定义ID")@RequestParam String defId, @RequestParam String defKey) throws Exception{
CommonResult<DefaultBpmTask> res=taskService.nextTask(defId,defKey);
return res;
}
@RequestMapping(value = "/filterUnBatchable",method = RequestMethod.GET,produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "过滤非批量处理类型任务",httpMethod = "GET",notes = "过滤非批量处理类型任务")
public CommonResult<List<String>> filterUnBatchable(@ApiParam(name = "taskIds",value = "多个ID用逗号隔开") @RequestParam String taskIds){
return taskService.filterUnBatchable(taskIds);
}
@RequestMapping(value = "/getCheckOpinionByTaskId", method = RequestMethod.GET, produces = {"application/json; charset=utf-8"})
@ApiOperation(value = "通过任务ID获取审批意见", httpMethod = "GET", notes = "通过任务ID获取审批意见")
public CommonResult<DefaultBpmCheckOpinion> getChcekOpinionByTaskId(@ApiParam(name = "taskId", value = "任务ID") @RequestParam("taskId") String taskId) {
return new CommonResult<>(true, "获取成功", bpmCheckOpinionManager.getByTaskId(taskId));
}
@RequestMapping(value = "taskIsFirstNode", method = RequestMethod.GET, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value = "获取任务是否在第一个节点", httpMethod = "GET", notes = "获取任务是否在第一个节点")
public CommonResult<Boolean> taskIsFirstNode(
@ApiParam(name = "taskId", value = "任务id", required = true) @RequestParam String taskId)
throws Exception {
Boolean taskFirstNode = iFlowService.isTaskFirstNode(taskId);
return CommonResult.<Boolean>ok().value(taskFirstNode);
}
@RequestMapping(value = "taskDelayById", method = RequestMethod.GET, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value = "任务延后处理", httpMethod = "GET", notes = "任务延后处理")
public CommonResult<Object> deferredTreatment(
@ApiParam(name = "taskId", value = "任务id", required = true) @RequestParam String taskId) throws Exception {
if (!bpmTaskManager.taskDelayById(taskId)){
return new CommonResult<Object>(false, "延迟处理失败",new ArrayList<>());
}
QueryFilter<DefaultBpmTask> queryFilter = QueryFilter.build();
queryFilter.getSorter().add(new FieldSort("PRIORITY_", Direction.ASC));
queryFilter.getSorter().add(new FieldSort("inst.create_time_", Direction.DESC));
queryFilter.setPageBean(new PageBean(0, 20));
List<DefaultBpmTask> rows = taskService.getTodoList(queryFilter).getRows();
return new CommonResult<Object>(true, "延迟处理成功", rows);
}
/**
* 管理端任务管理任务是否能跳转
* @param procInstId
* @param nodeId
* @return
* @throws Exception
*/
@RequestMapping(value = "taskCanJump", method = RequestMethod.GET, produces = {
"application/json; charset=utf-8" })
@ApiOperation(value = "管理端任务管理任务是否能跳转", httpMethod = "GET", notes = "管理端任务管理任务是否能跳转")
public CommonResult<Boolean> taskCanJump(
@ApiParam(name = "procInstId", value = "流程实例ID", required = true) @RequestParam String procInstId,
@ApiParam(name = "nodeId", value = "节点ID", required = true) @RequestParam String nodeId) throws Exception {
return baseService.taskCanJump(procInstId,nodeId);
}
}