ny
23 小时以前 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
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
package jnpf.flowable.controller;
 
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.ImmutableList;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jnpf.base.ActionResult;
import jnpf.base.controller.SuperController;
import jnpf.base.entity.DictionaryDataEntity;
import jnpf.base.entity.VisualdevEntity;
import jnpf.base.vo.DownloadVO;
import jnpf.base.vo.ListVO;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.constant.MsgCode;
import jnpf.emnus.ModuleTypeEnum;
import jnpf.exception.WorkFlowException;
import jnpf.flowable.entity.TemplateEntity;
import jnpf.flowable.entity.TemplateJsonEntity;
import jnpf.flowable.enums.TemplateStatueEnum;
import jnpf.flowable.model.candidates.CandidateUserVo;
import jnpf.flowable.model.template.*;
import jnpf.flowable.model.templatejson.FlowListModel;
import jnpf.flowable.model.templatejson.TemplateJsonInfoVO;
import jnpf.flowable.model.templatejson.TemplateJsonSelectVO;
import jnpf.flowable.model.templatenode.TemplateNodeCrFrom;
import jnpf.flowable.model.templatenode.TemplateNodeUpFrom;
import jnpf.flowable.model.util.FlowNature;
import jnpf.flowable.service.*;
import jnpf.flowable.util.OperatorUtil;
import jnpf.flowable.util.ServiceUtil;
import jnpf.model.FlowWorkListVO;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.model.authorize.AuthorizeVO;
import jnpf.permission.model.user.WorkHandoverModel;
import jnpf.util.FileUtil;
import jnpf.util.JsonUtil;
import jnpf.util.RandomUtil;
import jnpf.util.UserProvider;
import jnpf.util.context.RequestContext;
import jnpf.flowable.TemplateApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
 
@Slf4j
@Tag(name = "流程模板", description = "flowTemplate")
@RestController
@RequestMapping("/template")
public class TemplateController extends SuperController<TemplateService, TemplateEntity> implements TemplateApi {
 
    @Autowired
    private TemplateService templateService;
    @Autowired
    private TemplateJsonService templateJsonService;
    @Autowired
    private ServiceUtil serviceUtil;
    @Autowired
    private OperatorUtil operatorUtil;
    @Autowired
    private CommonService commonService;
    @Autowired
    private OperatorService operatorService;
    @Autowired
    private TemplateUseNumService templateUseNumService;
 
    /**
     * 流程列表
     *
     * @param pagination 分页模型
     * @return
     */
    @Operation(summary = "流程列表")
    @GetMapping
    public ActionResult<PageListVO<TemplatePageLisVO>> list(TemplatePagination pagination) {
        pagination.setSystemId(serviceUtil.getSystemCodeById(RequestContext.getAppCode()));
        List<TemplateEntity> list = templateService.getList(pagination);
        List<DictionaryDataEntity> dictionList = serviceUtil.getDictionName(list.stream().map(TemplateEntity::getCategory).collect(Collectors.toList()));
        List<UserEntity> userList = serviceUtil.getUserName(list.stream().map(TemplateEntity::getCreatorUserId).collect(Collectors.toList()));
        List<TemplatePageLisVO> listVO = new ArrayList<>();
        for (TemplateEntity entity : list) {
            TemplatePageLisVO vo = JsonUtil.getJsonToBean(entity, TemplatePageLisVO.class);
            DictionaryDataEntity dataEntity = dictionList.stream().filter(t -> t.getId().equals(entity.getCategory())).findFirst().orElse(null);
            vo.setCategory(dataEntity != null ? dataEntity.getFullName() : "");
            UserEntity userEntity = userList.stream().filter(t -> t.getId().equals(entity.getCreatorUserId())).findFirst().orElse(null);
            vo.setCreatorUser(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
            listVO.add(vo);
        }
        PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
        return ActionResult.page(listVO, paginationVO);
    }
 
    /**
     * 流程列表
     *
     * @param pagination 分页模型
     * @return
     */
    @Operation(summary = "流程列表")
    @GetMapping("/Selector")
    public ActionResult<PageListVO<TemplatePageVo>> selector(TemplatePagination pagination) {
        List<TemplatePageVo> list = templateService.getSelector(pagination);
        PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
        return ActionResult.page(list, paginationVO);
    }
 
    @Operation(summary = "常用流程前六")
    @GetMapping("/useNumSelect")
    public ActionResult<List<TemplateUseNumVo>> useNumSelector() {
        AuthorizeVO authorize = serviceUtil.getAuthorizeByUser();
        List<TemplateUseNumVo> menuUseNum = templateUseNumService.getMenuUseNum(0, authorize.getFlowIdList());
        return ActionResult.success(menuUseNum);
    }
 
    @Operation(summary = "用户访问流程次数记录")
    @PostMapping("/useTemplateNum/{templateId}")
    public ActionResult useTemplateNum(@PathVariable String templateId) {
        templateUseNumService.insertOrUpdateUseNum(templateId);
        return ActionResult.success();
    }
 
    @Operation(summary = "用户访问流程次数清空")
    @DeleteMapping("/useTemplateNum/{templateId}")
    public ActionResult deleteUseTemplateNum(@PathVariable String templateId) {
        String userId = UserProvider.getUser().getUserId();
        templateUseNumService.deleteUseNum(templateId, userId);
        return ActionResult.success();
    }
 
    /**
     * 常用流程树
     */
    @Operation(summary = "常用流程树")
    @GetMapping("/CommonFlowTree")
    public ActionResult getTreeCommon() {
        ListVO<TemplateTreeListVo> vo = new ListVO<>();
        vo.setList(templateService.getTreeCommon());
        return ActionResult.success(vo);
    }
 
    /**
     * 树形列表
     */
    @Operation(summary = "树形列表")
    @GetMapping("/TreeList")
    public ActionResult<ListVO<TemplateTreeListVo>> treeList(@RequestParam(value = "formType", required = false) Integer formType) {
        ListVO<TemplateTreeListVo> vo = new ListVO<>();
        vo.setList(templateService.treeList(formType));
        return ActionResult.success(vo);
    }
 
    /**
     * 流程基础信息
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "流程基础信息")
    @GetMapping("/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    public ActionResult<TemplateInfoVO> info(@PathVariable("id") String id) throws WorkFlowException {
        TemplateEntity entity = templateService.getInfo(id);
        TemplateInfoVO vo = JsonUtil.getJsonToBean(entity, TemplateInfoVO.class);
        return ActionResult.success(vo);
    }
 
    /**
     * 流程版本列表
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "流程版本列表")
    @GetMapping("/Version/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    public ActionResult<List<TemplateJsonSelectVO>> version(@PathVariable("id") String id) throws WorkFlowException {
        List<TemplateJsonEntity> list = templateJsonService.getList(id);
        List<TemplateJsonSelectVO> listVO = new ArrayList<>();
        for (TemplateJsonEntity jsonEntity : list) {
            TemplateJsonSelectVO vo = JsonUtil.getJsonToBean(jsonEntity, TemplateJsonSelectVO.class);
            vo.setFlowVersion(jsonEntity.getVersion());
            vo.setFullName("流程版本V" + jsonEntity.getVersion());
            listVO.add(vo);
        }
        return ActionResult.success(listVO);
    }
 
    /**
     * 流程模板信息
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "流程模板信息")
    @GetMapping("/Info/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    public ActionResult<TemplateJsonInfoVO> templateJsonInfo(@PathVariable("id") String id) throws WorkFlowException {
        return ActionResult.success(templateJsonService.getInfoVo(id));
    }
 
    /**
     * 新建流程
     *
     * @param form 流程模型
     * @return
     */
    @Operation(summary = "新建流程")
    @PostMapping
    @Parameters({
            @Parameter(name = "form", description = "流程模型", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult create(@RequestBody @Valid TemplateNodeCrFrom form) throws WorkFlowException {
        TemplateEntity entity = JsonUtil.getJsonToBean(form, TemplateEntity.class);
        String flowConfig = form.getFlowConfig();
        FlowConfigModel config = JsonUtil.getJsonToBean(flowConfig, FlowConfigModel.class);
        config = config == null ? new FlowConfigModel() : config;
        entity.setVisibleType(config.getVisibleType());
        templateService.create(entity, form.getFlowXml(), form.getFlowNodes());
        return ActionResult.success(MsgCode.SU001.get(), entity.getId());
    }
 
    /**
     * 更新流程
     *
     * @param id   主键
     * @param form 流程模型
     * @return
     */
    @Operation(summary = "更新流程")
    @PutMapping("/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
            @Parameter(name = "form", description = "流程模型", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid TemplateNodeUpFrom form) throws WorkFlowException {
        TemplateEntity entity = JsonUtil.getJsonToBean(form, TemplateEntity.class);
        String flowConfig = form.getFlowConfig();
        FlowConfigModel config = JsonUtil.getJsonToBean(flowConfig, FlowConfigModel.class);
        config = config == null ? new FlowConfigModel() : config;
        entity.setVisibleType(config.getVisibleType());
        TemplateEntity info = templateService.getInfo(id);
        entity.setSystemId(info.getSystemId());
        templateService.update(id, entity);
        return ActionResult.success(MsgCode.SU004.get());
    }
 
    /**
     * 更新流程类型
     *
     * @param id 主键
     */
    @Operation(summary = "更新流程类型")
    @PutMapping("/{id}/UpdateType")
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult updateType(@PathVariable("id") String id) throws WorkFlowException {
        TemplateEntity entity = templateService.getInfo(id);
        entity.setType(FlowNature.Standard);
        templateService.updateById(entity);
        return ActionResult.success(MsgCode.SU004.get());
    }
 
    /**
     * 删除流程引擎
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "删除流程引擎")
    @DeleteMapping("/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult delete(@PathVariable("id") String id) throws WorkFlowException {
        TemplateEntity entity = templateService.getInfo(id);
        templateService.delete(entity);
        return ActionResult.success(MsgCode.SU003.get());
    }
 
    /**
     * 删除流程版本
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "删除流程版本")
    @DeleteMapping("/Info/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult deleteInfo(@PathVariable("id") String id) throws WorkFlowException {
        TemplateJsonEntity entity = templateJsonService.getInfo(id);
        List<TemplateJsonEntity> list = templateJsonService.getList(entity.getTemplateId());
        if (list.size() == 1) {
            return ActionResult.fail(MsgCode.WF071.get());
        }
        if (Objects.equals(entity.getState(), 1)) {
            return ActionResult.fail(MsgCode.WF072.get());
        }
        if (Objects.equals(entity.getState(), 2)) {
            return ActionResult.fail(MsgCode.WF073.get());
        }
        templateJsonService.delete(ImmutableList.of(id));
        return ActionResult.success(MsgCode.SU003.get());
    }
 
    /**
     * 上架下架
     *
     * @param id 主键
     * @param fo 参数
     */
    @Operation(summary = "上架下架")
    @PutMapping("/{id}/UpDownShelf")
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult updateStatus(@PathVariable("id") String id, @RequestBody UpDownModel fo) throws WorkFlowException {
        TemplateEntity entity = templateService.getInfo(id);
        if (ObjectUtil.equals(fo.getIsUp(), 0)) {
            entity.setStatus(TemplateStatueEnum.up.getCode());
        } else {
            entity.setStatus(ObjectUtil.equals(fo.getIsHidden(), 0) ? TemplateStatueEnum.downContinue.getCode() : TemplateStatueEnum.downHidden.getCode());
        }
        templateService.updateById(entity);
        return ActionResult.success(MsgCode.SU005.get());
    }
 
    /**
     * 复制流程引擎
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "复制流程引擎")
    @PostMapping("/{id}/Actions/Copy")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult copy(@PathVariable("id") String id) throws WorkFlowException {
        TemplateEntity entity = templateService.getInfo(id);
        templateService.copy(entity);
        return ActionResult.success(MsgCode.SU007.get());
    }
 
    /**
     * 复制流程版本
     *
     * @param id 主键
     * @return
     */
    @Operation(summary = "复制流程版本")
    @PostMapping("/Info/{id}")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult copyVersion(@PathVariable("id") String id) throws WorkFlowException {
        String templateJsonId = RandomUtil.uuId();
        TemplateJsonEntity entity = templateJsonService.getInfo(id);
        templateJsonService.copy(entity, templateJsonId);
        return ActionResult.success(MsgCode.SU007.get(), templateJsonId);
    }
 
    /**
     * 流程保存或发布
     *
     * @return
     */
    @Operation(summary = "流程保存或发布")
    @PostMapping("/Save")
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult save(@RequestBody @Valid TemplateNodeUpFrom form) throws WorkFlowException {
        templateJsonService.save(form);
        return ActionResult.success(MsgCode.SU004.get());
    }
 
    /**
     * 导出
     *
     * @param id 主键
     */
    @Operation(summary = "导出")
    @GetMapping("/{id}/Actions/Export")
    @Parameters({
            @Parameter(name = "id", description = "主键", required = true),
    })
    public ActionResult<DownloadVO> export(@PathVariable("id") String id) throws WorkFlowException {
        TemplateExportModel model = templateService.export(id);
        DownloadVO downloadVO = serviceUtil.exportData(model);
        return ActionResult.success(downloadVO);
    }
 
    /**
     * 导入
     *
     * @param file 文件
     * @param type 类型
     */
    @Operation(summary = "导入")
    @PostMapping(value = "/Actions/Import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @SaCheckPermission(value = {"onlineDev.flowEngine"})
    public ActionResult<String> importData(@RequestPart("file") MultipartFile file, @RequestParam("type") String type) throws WorkFlowException {
        //判断是否为.json结尾
        if (FileUtil.existsSuffix(file, ModuleTypeEnum.FLOW_FLOWENGINE.getTableName())) {
            return ActionResult.fail(MsgCode.IMP002.get());
        }
        //获取文件内容
        String fileContent = FileUtil.getFileContent(file);
        TemplateExportModel model = JsonUtil.getJsonToBean(fileContent, TemplateExportModel.class);
        if (ObjectUtil.isEmpty(model.getTemplate())) {
            return ActionResult.fail(MsgCode.IMP004.get());
        }
        templateService.importData(model, type);
        return ActionResult.success(MsgCode.IMP001.get());
    }
 
    /**
     * 委托流程选择展示
     *
     * @param ids 版本主键集合
     */
    @Operation(summary = "委托流程选择展示")
    @PostMapping("/GetFlowList")
    public ActionResult getFlowList(@RequestBody List<String> ids) {
        List<TemplateEntity> list = templateService.getList(ids);
        List<FlowListModel> voList = new ArrayList<>();
        for (TemplateEntity templateEntity : list) {
            FlowListModel model = new FlowListModel();
            model.setId(templateEntity.getId());
            model.setFullName(templateEntity.getFullName());
            model.setEnCode(templateEntity.getEnCode());
            voList.add(model);
        }
        return ActionResult.success(voList);
    }
 
    /**
     * 子流程表单信息
     *
     * @param id 版本主键
     */
    @Operation(summary = "子流程表单信息")
    @GetMapping("/{id}/FormInfo")
    public ActionResult formInfo(@PathVariable("id") String id) throws WorkFlowException {
        VisualdevEntity formInfo = templateJsonService.getFormInfo(id);
        return ActionResult.success(formInfo);
    }
 
    /**
     * 根据表单主键获取流程
     *
     * @param formId 表单主键
     */
    @Operation(summary = "根据表单主键获取流程")
    @GetMapping("/{formId}/FlowList")
    public ActionResult getByFormId(@PathVariable("formId") String formId, Boolean start) {
        FlowByFormModel model = templateService.getFlowByFormId(formId, start);
        return ActionResult.success(model);
    }
 
    /**
     * 子流程可发起人员
     *
     * @param id         版本主键
     * @param pagination 分页参数
     */
    @Operation(summary = "子流程可发起人员")
    @GetMapping("/{id}/SubFlowUserList")
    public ActionResult getSubFlowUserList(@PathVariable("id") String id, TemplatePagination pagination) throws WorkFlowException {
        List<UserEntity> list = templateService.getSubFlowUserList(id, pagination);
        List<String> userIdList = list.stream().map(UserEntity::getId).collect(Collectors.toList());
        List<CandidateUserVo> voList = operatorUtil.getUserModel(userIdList, pagination);
        PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
        return ActionResult.page(voList, paginationVO);
    }
 
    /**
     * 常用流程
     *
     * @param id 版本主键
     */
    @Operation(summary = "常用流程")
    @PostMapping("/SetCommonFlow/{id}")
    public ActionResult SetCommonFlow(@PathVariable("id") String id) {
        int flag = commonService.setCommonFLow(id);
        if (flag == 2) {
            return ActionResult.success(MsgCode.SU021.get());
        }
        return ActionResult.success(MsgCode.SU016.get());
    }
 
 
    /**
     * 常用流程列表
     *
     */
    @Operation(summary = "常用流程")
    @GetMapping("/getCommonFlowList")
    public ActionResult getCommonFlowList(TemplatePagination pagination) {
        pagination.setSystemId(serviceUtil.getSystemCodeById(RequestContext.getAppCode()));
        List<TemplatePageVo> commonList = templateService.getCommonList(pagination);
        return ActionResult.success(new ListVO<>(commonList));
    }
 
 
    /**
     * 根据模板主键获取表单
     *
     * @param templateId 流程模板主键
     */
    @Operation(summary = "根据模板主键获取表单")
    @GetMapping("/StartForm/{templateId}")
    public ActionResult getFormByTemplateId(@PathVariable("templateId") String templateId) throws WorkFlowException {
        return ActionResult.success(templateService.getFormByTemplateId(templateId));
    }
 
    /**
     * 根据模板主键获取表单主键和流程版本主键
     *
     * @param templateId 流程模板主键
     */
    @Operation(summary = "根据模板主键获取表单主键和流程版本主键")
    @GetMapping("/StartFormId/{templateId}")
    public ActionResult getFormIdAndFlowIdByTemplateId(@PathVariable("templateId") String templateId) throws WorkFlowException {
        List<String> userIdAll = ImmutableList.of(UserProvider.getLoginUserId());
        return ActionResult.success(templateService.getFormIdAndFlowId(userIdAll, templateId));
    }
 
    @Override
    @PostMapping("/getFlowByFormId")
    public FlowByFormModel getFlowByFormId(@RequestParam("formId") String formId, @RequestParam("start") Boolean start) {
        return templateService.getFlowByFormId(formId, start);
    }
 
    @Override
    @GetMapping("/getFormByFlowId")
    public String getFormByFlowId(@RequestParam("templateId") String templateId) {
        String formId = "";
        try {
            VisualdevEntity entity = templateService.getFormByTemplateId(templateId);
            if (null == entity) {
                throw new WorkFlowException(MsgCode.VS412.get());
            }
            formId = entity.getId();
        } catch (Exception e) {
            log.error("流程获取表单失败: {}", e.getMessage());
        }
        return formId;
    }
 
    @Override
    @PostMapping("/getListByFlowIds")
    public List<TemplateEntity> getListByFlowIds(@RequestBody List<String> flowId) {
        return templateService.getListByIds(flowId);
    }
 
    @Override
    @GetMapping("/treeListWithPower")
    public List<TemplateTreeListVo> treeListWithPower() {
        return templateService.treeListWithPower();
    }
 
    @Override
    @GetMapping("/flowWork")
    public FlowWorkListVO flowWork(@RequestParam("fromId") String fromId) {
        return operatorService.flowWork(fromId);
    }
 
    @Override
    @PostMapping("/flowWork")
    public boolean flowWork(@RequestBody WorkHandoverModel workHandoverModel) {
        return operatorService.flowWork(workHandoverModel);
    }
 
    @Override
    @PostMapping("/getCommonList")
    public List<TemplatePageVo> getCommonList(@RequestBody TemplatePagination pagination) {
        return templateService.getCommonList(pagination);
    }
 
 
    @Override
    @PostMapping("/getMenuUseNum")
    public List<TemplateUseNumVo> getMenuUseNum(@RequestParam("i") Integer i, @RequestBody List<String> authFlowList) {
        return templateUseNumService.getMenuUseNum(i, authFlowList);
    }
 
    @Override
    @GetMapping("/getListByCreUser")
    public List<TemplateEntity> getListByCreUser(@RequestParam("creUser") String creUser) {
        return templateService.getListByCreUser(creUser);
    }
}