Commit fd4b6ef9e468c15a313e858c507f9d5844fb0162
1 parent
1fb8c923
feat: Simple设计器-userTask-添加是否需要签名字段
Showing
6 changed files
with
40 additions
and
1 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| ... | ... | @@ -60,6 +60,9 @@ public class BpmSimpleModelNodeVO { |
| 60 | 60 | @Schema(description = "操作按钮设置", example = "[]") |
| 61 | 61 | private List<OperationButtonSetting> buttonsSetting; // 用于审批节点 |
| 62 | 62 | |
| 63 | + @Schema(description = "是否需要签名", example = "false") | |
| 64 | + private Boolean signEnable; | |
| 65 | + | |
| 63 | 66 | /** |
| 64 | 67 | * 审批节点拒绝处理 |
| 65 | 68 | */ | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java
| ... | ... | @@ -78,6 +78,9 @@ public class BpmTaskRespVO { |
| 78 | 78 | @Schema(description = "操作按钮设置值") |
| 79 | 79 | private Map<Integer, OperationButtonSetting> buttonsSetting; |
| 80 | 80 | |
| 81 | + @Schema(description = "是否需要签名") | |
| 82 | + private Boolean signEnable; | |
| 83 | + | |
| 81 | 84 | @Data |
| 82 | 85 | @Schema(description = "流程实例") |
| 83 | 86 | public static class ProcessInstance { | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.framework.flowable.core.util; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.convert.Convert; | |
| 4 | 5 | import cn.hutool.core.map.MapUtil; |
| 5 | 6 | import cn.hutool.core.util.ArrayUtil; |
| 6 | 7 | import cn.hutool.core.util.ObjUtil; |
| ... | ... | @@ -367,6 +368,26 @@ public class BpmnModelUtils { |
| 367 | 368 | return Optional.ofNullable(extensionElement).map(ExtensionElement::getElementText).orElse(null); |
| 368 | 369 | } |
| 369 | 370 | |
| 371 | + public static void addSignEnable(Boolean signEnable, FlowElement userTask) { | |
| 372 | + if (ObjUtil.isNotNull(signEnable)) { | |
| 373 | + addExtensionElement(userTask, SIGN_ENABLE, signEnable.toString()); | |
| 374 | + } else { | |
| 375 | + addExtensionElement(userTask, SIGN_ENABLE, "false"); | |
| 376 | + } | |
| 377 | + } | |
| 378 | + | |
| 379 | + public static Boolean parseSignEnable(BpmnModel bpmnModel, String flowElementId) { | |
| 380 | + FlowElement flowElement = getFlowElementById(bpmnModel, flowElementId); | |
| 381 | + if (flowElement == null) { | |
| 382 | + return false; | |
| 383 | + } | |
| 384 | + List<ExtensionElement> extensionElements = flowElement.getExtensionElements().get(SIGN_ENABLE); | |
| 385 | + if (CollUtil.isEmpty(extensionElements)) { | |
| 386 | + return false; | |
| 387 | + } | |
| 388 | + return Convert.toBool(extensionElements.get(0).getElementText(), false); | |
| 389 | + } | |
| 390 | + | |
| 370 | 391 | // ========== BPM 简单查找相关的方法 ========== |
| 371 | 392 | |
| 372 | 393 | /** | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| ... | ... | @@ -64,6 +64,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU |
| 64 | 64 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 65 | 65 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 66 | 66 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; |
| 67 | +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable; | |
| 67 | 68 | |
| 68 | 69 | /** |
| 69 | 70 | * 流程任务实例 Service 实现类 |
| ... | ... | @@ -161,13 +162,17 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 161 | 162 | BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId()); |
| 162 | 163 | Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting( |
| 163 | 164 | bpmnModel, todoTask.getTaskDefinitionKey()); |
| 165 | + Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey()); | |
| 164 | 166 | |
| 165 | 167 | // 4. 任务表单 |
| 166 | 168 | BpmFormDO taskForm = null; |
| 167 | 169 | if (StrUtil.isNotBlank(todoTask.getFormKey())){ |
| 168 | 170 | taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey())); |
| 169 | 171 | } |
| 170 | - return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm); | |
| 172 | + | |
| 173 | + BpmTaskRespVO bpmTaskRespVO = BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm); | |
| 174 | + bpmTaskRespVO.setSignEnable(signEnable); | |
| 175 | + return bpmTaskRespVO; | |
| 171 | 176 | } |
| 172 | 177 | |
| 173 | 178 | @Override | ... | ... |