feat: Simple设计器-userTask-添加是否需要签名字段
This commit is contained in:
parent
1fb8c9238a
commit
fd4b6ef9e4
|
@ -60,6 +60,9 @@ public class BpmSimpleModelNodeVO {
|
||||||
@Schema(description = "操作按钮设置", example = "[]")
|
@Schema(description = "操作按钮设置", example = "[]")
|
||||||
private List<OperationButtonSetting> buttonsSetting; // 用于审批节点
|
private List<OperationButtonSetting> buttonsSetting; // 用于审批节点
|
||||||
|
|
||||||
|
@Schema(description = "是否需要签名", example = "false")
|
||||||
|
private Boolean signEnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批节点拒绝处理
|
* 审批节点拒绝处理
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -78,6 +78,9 @@ public class BpmTaskRespVO {
|
||||||
@Schema(description = "操作按钮设置值")
|
@Schema(description = "操作按钮设置值")
|
||||||
private Map<Integer, OperationButtonSetting> buttonsSetting;
|
private Map<Integer, OperationButtonSetting> buttonsSetting;
|
||||||
|
|
||||||
|
@Schema(description = "是否需要签名")
|
||||||
|
private Boolean signEnable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "流程实例")
|
@Schema(description = "流程实例")
|
||||||
public static class ProcessInstance {
|
public static class ProcessInstance {
|
||||||
|
|
|
@ -110,4 +110,9 @@ public interface BpmnModelConstants {
|
||||||
*/
|
*/
|
||||||
String START_USER_NODE_ID = "StartUserNode";
|
String START_USER_NODE_ID = "StartUserNode";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要签名
|
||||||
|
*/
|
||||||
|
String SIGN_ENABLE = "signEnable";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
|
package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
@ -367,6 +368,26 @@ public class BpmnModelUtils {
|
||||||
return Optional.ofNullable(extensionElement).map(ExtensionElement::getElementText).orElse(null);
|
return Optional.ofNullable(extensionElement).map(ExtensionElement::getElementText).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addSignEnable(Boolean signEnable, FlowElement userTask) {
|
||||||
|
if (ObjUtil.isNotNull(signEnable)) {
|
||||||
|
addExtensionElement(userTask, SIGN_ENABLE, signEnable.toString());
|
||||||
|
} else {
|
||||||
|
addExtensionElement(userTask, SIGN_ENABLE, "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean parseSignEnable(BpmnModel bpmnModel, String flowElementId) {
|
||||||
|
FlowElement flowElement = getFlowElementById(bpmnModel, flowElementId);
|
||||||
|
if (flowElement == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<ExtensionElement> extensionElements = flowElement.getExtensionElements().get(SIGN_ENABLE);
|
||||||
|
if (CollUtil.isEmpty(extensionElements)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Convert.toBool(extensionElements.get(0).getElementText(), false);
|
||||||
|
}
|
||||||
|
|
||||||
// ========== BPM 简单查找相关的方法 ==========
|
// ========== BPM 简单查找相关的方法 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -440,6 +440,8 @@ public class SimpleModelUtils {
|
||||||
}
|
}
|
||||||
// 设置监听器
|
// 设置监听器
|
||||||
addUserTaskListener(node, userTask);
|
addUserTaskListener(node, userTask);
|
||||||
|
// 添加是否需要签名
|
||||||
|
addSignEnable(node.getSignEnable(), userTask);
|
||||||
return userTask;
|
return userTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
||||||
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG;
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG;
|
||||||
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程任务实例 Service 实现类
|
* 流程任务实例 Service 实现类
|
||||||
|
@ -161,13 +162,17 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||||
BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId());
|
BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId());
|
||||||
Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting(
|
Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting(
|
||||||
bpmnModel, todoTask.getTaskDefinitionKey());
|
bpmnModel, todoTask.getTaskDefinitionKey());
|
||||||
|
Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey());
|
||||||
|
|
||||||
// 4. 任务表单
|
// 4. 任务表单
|
||||||
BpmFormDO taskForm = null;
|
BpmFormDO taskForm = null;
|
||||||
if (StrUtil.isNotBlank(todoTask.getFormKey())){
|
if (StrUtil.isNotBlank(todoTask.getFormKey())){
|
||||||
taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey()));
|
taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey()));
|
||||||
}
|
}
|
||||||
return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm);
|
|
||||||
|
BpmTaskRespVO bpmTaskRespVO = BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm);
|
||||||
|
bpmTaskRespVO.setSignEnable(signEnable);
|
||||||
|
return bpmTaskRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue