Commit fd4b6ef9e468c15a313e858c507f9d5844fb0162

Authored by Lesan
1 parent 1fb8c923

feat: Simple设计器-userTask-添加是否需要签名字段

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,6 +60,9 @@ public class BpmSimpleModelNodeVO {
60 @Schema(description = "操作按钮设置", example = "[]") 60 @Schema(description = "操作按钮设置", example = "[]")
61 private List<OperationButtonSetting> buttonsSetting; // 用于审批节点 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,6 +78,9 @@ public class BpmTaskRespVO {
78 @Schema(description = "操作按钮设置值") 78 @Schema(description = "操作按钮设置值")
79 private Map<Integer, OperationButtonSetting> buttonsSetting; 79 private Map<Integer, OperationButtonSetting> buttonsSetting;
80 80
  81 + @Schema(description = "是否需要签名")
  82 + private Boolean signEnable;
  83 +
81 @Data 84 @Data
82 @Schema(description = "流程实例") 85 @Schema(description = "流程实例")
83 public static class ProcessInstance { 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
@@ -110,4 +110,9 @@ public interface BpmnModelConstants { @@ -110,4 +110,9 @@ public interface BpmnModelConstants {
110 */ 110 */
111 String START_USER_NODE_ID = "StartUserNode"; 111 String START_USER_NODE_ID = "StartUserNode";
112 112
  113 + /**
  114 + * 是否需要签名
  115 + */
  116 + String SIGN_ENABLE = "signEnable";
  117 +
113 } 118 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.util; 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.convert.Convert;
4 import cn.hutool.core.map.MapUtil; 5 import cn.hutool.core.map.MapUtil;
5 import cn.hutool.core.util.ArrayUtil; 6 import cn.hutool.core.util.ArrayUtil;
6 import cn.hutool.core.util.ObjUtil; 7 import cn.hutool.core.util.ObjUtil;
@@ -367,6 +368,26 @@ public class BpmnModelUtils { @@ -367,6 +368,26 @@ public class BpmnModelUtils {
367 return Optional.ofNullable(extensionElement).map(ExtensionElement::getElementText).orElse(null); 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 // ========== BPM 简单查找相关的方法 ========== 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
@@ -440,6 +440,8 @@ public class SimpleModelUtils { @@ -440,6 +440,8 @@ public class SimpleModelUtils {
440 } 440 }
441 // 设置监听器 441 // 设置监听器
442 addUserTaskListener(node, userTask); 442 addUserTaskListener(node, userTask);
  443 + // 添加是否需要签名
  444 + addSignEnable(node.getSignEnable(), userTask);
443 return userTask; 445 return userTask;
444 } 446 }
445 447
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,6 +64,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
64 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; 64 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
65 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; 65 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
66 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; 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 * 流程任务实例 Service 实现类 70 * 流程任务实例 Service 实现类
@@ -161,13 +162,17 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -161,13 +162,17 @@ public class BpmTaskServiceImpl implements BpmTaskService {
161 BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId()); 162 BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId());
162 Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting( 163 Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting(
163 bpmnModel, todoTask.getTaskDefinitionKey()); 164 bpmnModel, todoTask.getTaskDefinitionKey());
  165 + Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey());
164 166
165 // 4. 任务表单 167 // 4. 任务表单
166 BpmFormDO taskForm = null; 168 BpmFormDO taskForm = null;
167 if (StrUtil.isNotBlank(todoTask.getFormKey())){ 169 if (StrUtil.isNotBlank(todoTask.getFormKey())){
168 taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey())); 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 @Override 178 @Override