!1137 bpm设计器适配Simple设计器
Merge pull request !1137 from Lesan/feature/bpm
This commit is contained in:
commit
62c33c32c9
|
@ -124,12 +124,18 @@ public interface BpmTaskConvert {
|
|||
}
|
||||
|
||||
default BpmTaskRespVO buildTodoTask(Task todoTask, List<Task> childrenTasks,
|
||||
Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting) {
|
||||
return BeanUtils.toBean(todoTask, BpmTaskRespVO.class)
|
||||
Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting,
|
||||
BpmFormDO taskForm) {
|
||||
BpmTaskRespVO bpmTaskRespVO = BeanUtils.toBean(todoTask, BpmTaskRespVO.class)
|
||||
.setStatus(FlowableUtils.getTaskStatus(todoTask)).setReason(FlowableUtils.getTaskReason(todoTask))
|
||||
.setButtonsSetting(buttonsSetting)
|
||||
.setChildren(convertList(childrenTasks, childTask -> BeanUtils.toBean(childTask, BpmTaskRespVO.class)
|
||||
.setStatus(FlowableUtils.getTaskStatus(childTask))));
|
||||
if (taskForm != null) {
|
||||
bpmTaskRespVO.setFormId(taskForm.getId()).setFormName(taskForm.getName())
|
||||
.setFormConf(taskForm.getConf()).setFormFields(taskForm.getFields());
|
||||
}
|
||||
return bpmTaskRespVO;
|
||||
}
|
||||
|
||||
default BpmMessageSendWhenTaskCreatedReqDTO convert(ProcessInstance processInstance, AdminUserRespDTO startUser,
|
||||
|
|
|
@ -278,8 +278,8 @@ public class BpmnModelUtils {
|
|||
}
|
||||
Map<String, String> fieldsPermission = MapUtil.newHashMap();
|
||||
extensionElements.forEach(element -> {
|
||||
String field = element.getAttributeValue(FLOWABLE_EXTENSIONS_NAMESPACE, FORM_FIELD_PERMISSION_ELEMENT_FIELD_ATTRIBUTE);
|
||||
String permission = element.getAttributeValue(FLOWABLE_EXTENSIONS_NAMESPACE, FORM_FIELD_PERMISSION_ELEMENT_PERMISSION_ATTRIBUTE);
|
||||
String field = element.getAttributeValue(null, FORM_FIELD_PERMISSION_ELEMENT_FIELD_ATTRIBUTE);
|
||||
String permission = element.getAttributeValue(null, FORM_FIELD_PERMISSION_ELEMENT_PERMISSION_ATTRIBUTE);
|
||||
if (StrUtil.isNotEmpty(field) && StrUtil.isNotEmpty(permission)) {
|
||||
fieldsPermission.put(field, permission);
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ public class BpmnModelUtils {
|
|||
&& evalConditionExpress(variables, flow.getConditionExpression()));
|
||||
if (matchSequenceFlow == null) {
|
||||
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()));
|
||||
flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
|
||||
// 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的
|
||||
if (matchSequenceFlow == null && gateway.getOutgoingFlows().size() == 1) {
|
||||
matchSequenceFlow = gateway.getOutgoingFlows().get(0);
|
||||
|
@ -742,7 +742,7 @@ public class BpmnModelUtils {
|
|||
&& evalConditionExpress(variables, flow.getConditionExpression()));
|
||||
if (CollUtil.isEmpty(matchSequenceFlows)) {
|
||||
matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()));
|
||||
flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
|
||||
// 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的
|
||||
if (CollUtil.isEmpty(matchSequenceFlows) && gateway.getOutgoingFlows().size() == 1) {
|
||||
matchSequenceFlows = gateway.getOutgoingFlows();
|
||||
|
|
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
|||
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*;
|
||||
import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.definition.*;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum;
|
||||
|
@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
|||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
|
||||
import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService;
|
||||
|
@ -91,6 +93,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
private BpmModelService modelService;
|
||||
@Resource
|
||||
private BpmMessageService messageService;
|
||||
@Resource
|
||||
private BpmFormService formService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
@ -153,7 +157,14 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId());
|
||||
Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting = BpmnModelUtils.parseButtonsSetting(
|
||||
bpmnModel, todoTask.getTaskDefinitionKey());
|
||||
return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting);
|
||||
|
||||
// 4. 任务表单
|
||||
BpmFormDO taskForm = null;
|
||||
if (StrUtil.isNotBlank(todoTask.getFormKey())){
|
||||
taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey()));
|
||||
}
|
||||
|
||||
return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue