|
@@ -2,7 +2,6 @@ package com.fjhx.flow.service.flow.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.fjhx.flow.core.FlowBean;
|
|
@@ -66,11 +65,11 @@ public class FlowProcessServiceImpl implements FlowProcessService {
|
|
|
@Override
|
|
|
public FlowResult initiate(InitiateDto dto) {
|
|
|
|
|
|
- // 找到代码定义的流程bean
|
|
|
- Class<? extends FlowDelegate> flowDelegateCls = FlowBean.getBean(dto.getFlowKey());
|
|
|
-
|
|
|
// 获取流程委托对象
|
|
|
- FlowDelegate flowDelegate = getFlowDelegate(flowDelegateCls);
|
|
|
+ FlowDelegate flowDelegate = FlowBean.getBean(dto.getFlowKey());
|
|
|
+
|
|
|
+ // 找到代码定义的流程bean
|
|
|
+ Class<? extends FlowDelegate> flowDelegateCls = flowDelegate.getClass();
|
|
|
|
|
|
// 查找可用流程
|
|
|
FlowDefinition flowDefinition = flowDefinitionService.getOne(q -> q
|
|
@@ -213,11 +212,11 @@ public class FlowProcessServiceImpl implements FlowProcessService {
|
|
|
throw new ServiceException("流程已被处理");
|
|
|
}
|
|
|
|
|
|
- // 找到代码定义的流程bean
|
|
|
- Class<? extends FlowDelegate> flowDelegateCls = FlowBean.getBean(flowExample.getFlowKey());
|
|
|
-
|
|
|
// 获取流程委托对象
|
|
|
- FlowDelegate flowDelegate = getFlowDelegate(flowDelegateCls);
|
|
|
+ FlowDelegate flowDelegate = FlowBean.getBean(flowExample.getFlowKey());
|
|
|
+
|
|
|
+ // 找到代码定义的流程bean
|
|
|
+ Class<? extends FlowDelegate> flowDelegateCls = flowDelegate.getClass();
|
|
|
|
|
|
// 流程节点列表
|
|
|
List<FlowDefinitionNode> flowDefinitionNodeList = flowDefinitionNodeService.list(q -> q
|
|
@@ -400,20 +399,6 @@ public class FlowProcessServiceImpl implements FlowProcessService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取流程委托对象
|
|
|
- *
|
|
|
- * @param flowDelegateCls 流程代理class
|
|
|
- * @return 流程委托对象
|
|
|
- */
|
|
|
- private FlowDelegate getFlowDelegate(Class<? extends FlowDelegate> flowDelegateCls) {
|
|
|
- FlowDelegate flowDelegate = SpringUtil.getBean(flowDelegateCls);
|
|
|
- if (flowDelegate == null) {
|
|
|
- throw new ServiceException("没有把流程bean加入到spring中");
|
|
|
- }
|
|
|
- return flowDelegate;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 查找下一个用户执行节点
|
|
|
*
|
|
|
* @param currentNode 当前节点
|