mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 18:49:06 +08:00 
			
		
		
		
	!1137 bpm设计器适配Simple设计器
Merge pull request !1137 from Lesan/feature/bpm
This commit is contained in:
		| @ -124,12 +124,18 @@ public interface BpmTaskConvert { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     default BpmTaskRespVO buildTodoTask(Task todoTask, List<Task> childrenTasks, |     default BpmTaskRespVO buildTodoTask(Task todoTask, List<Task> childrenTasks, | ||||||
|                                               Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting) { |                                               Map<Integer, BpmTaskRespVO.OperationButtonSetting> buttonsSetting, | ||||||
|         return BeanUtils.toBean(todoTask, BpmTaskRespVO.class) |                                         BpmFormDO taskForm) { | ||||||
|  |         BpmTaskRespVO bpmTaskRespVO = BeanUtils.toBean(todoTask, BpmTaskRespVO.class) | ||||||
|                 .setStatus(FlowableUtils.getTaskStatus(todoTask)).setReason(FlowableUtils.getTaskReason(todoTask)) |                 .setStatus(FlowableUtils.getTaskStatus(todoTask)).setReason(FlowableUtils.getTaskReason(todoTask)) | ||||||
|                 .setButtonsSetting(buttonsSetting) |                 .setButtonsSetting(buttonsSetting) | ||||||
|                 .setChildren(convertList(childrenTasks, childTask -> BeanUtils.toBean(childTask, BpmTaskRespVO.class) |                 .setChildren(convertList(childrenTasks, childTask -> BeanUtils.toBean(childTask, BpmTaskRespVO.class) | ||||||
|                         .setStatus(FlowableUtils.getTaskStatus(childTask)))); |                         .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, |     default BpmMessageSendWhenTaskCreatedReqDTO convert(ProcessInstance processInstance, AdminUserRespDTO startUser, | ||||||
|  | |||||||
| @ -278,8 +278,8 @@ public class BpmnModelUtils { | |||||||
|         } |         } | ||||||
|         Map<String, String> fieldsPermission = MapUtil.newHashMap(); |         Map<String, String> fieldsPermission = MapUtil.newHashMap(); | ||||||
|         extensionElements.forEach(element -> { |         extensionElements.forEach(element -> { | ||||||
|             String field = element.getAttributeValue(FLOWABLE_EXTENSIONS_NAMESPACE, FORM_FIELD_PERMISSION_ELEMENT_FIELD_ATTRIBUTE); |             String field = element.getAttributeValue(null, FORM_FIELD_PERMISSION_ELEMENT_FIELD_ATTRIBUTE); | ||||||
|             String permission = element.getAttributeValue(FLOWABLE_EXTENSIONS_NAMESPACE, FORM_FIELD_PERMISSION_ELEMENT_PERMISSION_ATTRIBUTE); |             String permission = element.getAttributeValue(null, FORM_FIELD_PERMISSION_ELEMENT_PERMISSION_ATTRIBUTE); | ||||||
|             if (StrUtil.isNotEmpty(field) && StrUtil.isNotEmpty(permission)) { |             if (StrUtil.isNotEmpty(field) && StrUtil.isNotEmpty(permission)) { | ||||||
|                 fieldsPermission.put(field, permission); |                 fieldsPermission.put(field, permission); | ||||||
|             } |             } | ||||||
| @ -720,7 +720,7 @@ public class BpmnModelUtils { | |||||||
|                             && evalConditionExpress(variables, flow.getConditionExpression())); |                             && evalConditionExpress(variables, flow.getConditionExpression())); | ||||||
|             if (matchSequenceFlow == null) { |             if (matchSequenceFlow == null) { | ||||||
|                 matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), |                 matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), | ||||||
|                         flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())); |                         flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); | ||||||
|                 // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的 |                 // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的 | ||||||
|                 if (matchSequenceFlow == null && gateway.getOutgoingFlows().size() == 1) { |                 if (matchSequenceFlow == null && gateway.getOutgoingFlows().size() == 1) { | ||||||
|                     matchSequenceFlow = gateway.getOutgoingFlows().get(0); |                     matchSequenceFlow = gateway.getOutgoingFlows().get(0); | ||||||
| @ -742,7 +742,7 @@ public class BpmnModelUtils { | |||||||
|                             && evalConditionExpress(variables, flow.getConditionExpression())); |                             && evalConditionExpress(variables, flow.getConditionExpression())); | ||||||
|             if (CollUtil.isEmpty(matchSequenceFlows)) { |             if (CollUtil.isEmpty(matchSequenceFlows)) { | ||||||
|                 matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), |                 matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), | ||||||
|                         flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())); |                         flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); | ||||||
|                 // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的 |                 // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的 | ||||||
|                 if (CollUtil.isEmpty(matchSequenceFlows) && gateway.getOutgoingFlows().size() == 1) { |                 if (CollUtil.isEmpty(matchSequenceFlows) && gateway.getOutgoingFlows().size() == 1) { | ||||||
|                     matchSequenceFlows = gateway.getOutgoingFlows(); |                     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.framework.web.core.util.WebFrameworkUtils; | ||||||
| import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | 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.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.definition.*; | ||||||
| import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | ||||||
| import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; | 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.enums.BpmnVariableConstants; | ||||||
| import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; | 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.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.BpmModelService; | ||||||
| import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; | import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; | ||||||
| import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; | import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; | ||||||
| @ -91,6 +93,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | |||||||
|     private BpmModelService modelService; |     private BpmModelService modelService; | ||||||
|     @Resource |     @Resource | ||||||
|     private BpmMessageService messageService; |     private BpmMessageService messageService; | ||||||
|  |     @Resource | ||||||
|  |     private BpmFormService formService; | ||||||
|  |  | ||||||
|     @Resource |     @Resource | ||||||
|     private AdminUserApi adminUserApi; |     private AdminUserApi adminUserApi; | ||||||
| @ -153,7 +157,14 @@ 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()); | ||||||
|         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 |     @Override | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 芋道源码
					芋道源码