add 新增 warmflow 源码级定制化开发

This commit is contained in:
疯狂的狮子Li
2026-09-11 17:46:11 +08:00
parent 472d2d1a3a
commit e3bc391887
12 changed files with 10 additions and 45 deletions
@@ -49,10 +49,6 @@ public class NodeJson {
* 流程节点名称
*/
private String nodeName;
/**
* 流程节点版本
*/
private String version;
/**
* 权限标识(权限类型:权限标识,可以多个,用@@隔开)
*/
@@ -98,13 +98,6 @@ public class FlowNode implements RootEntity {
* 流程节点坐标
*/
private String coordinate;
/**
* 版本
*
* @deprecated 下个版本废弃
*/
@Deprecated
private String version;
/**
* 任意结点跳转
*/
@@ -146,7 +139,6 @@ public class FlowNode implements RootEntity {
.setNodeRatio(this.getNodeRatio())
.setPermissionFlag(this.getPermissionFlag())
.setCoordinate(this.getCoordinate())
.setVersion(this.getVersion())
.setAnyNodeSkip(this.getAnyNodeSkip())
.setListenerType(this.getListenerType())
.setListenerPath(this.getListenerPath())
@@ -6,8 +6,6 @@ import org.springframework.expression.EvaluationContext;
import org.springframework.expression.MethodExecutor;
import org.springframework.expression.MethodResolver;
import org.springframework.expression.spel.support.DataBindingMethodResolver;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import java.util.List;
import java.util.Set;
@@ -35,10 +33,9 @@ public class SafeMethodResolver implements MethodResolver {
"getDeclaredMethod"
);
@Nullable
@Override
public MethodExecutor resolve(@NonNull EvaluationContext context, @NonNull Object targetObject
, @NonNull String name, @NonNull List<TypeDescriptor> argumentTypes) throws AccessException {
public MethodExecutor resolve(EvaluationContext context, Object targetObject
, String name, List<TypeDescriptor> argumentTypes) throws AccessException {
if (DANGEROUS_METHODS.contains(name)) {
throw new AccessException("不允许调用方法:" + name);
}
@@ -21,7 +21,6 @@ import org.dromara.warm.flow.exception.FlowException;
import org.springframework.expression.TypeLocator;
import org.springframework.expression.spel.support.StandardTypeLocator;
import org.springframework.lang.NonNull;
import java.util.HashSet;
import java.util.Set;
@@ -83,7 +82,7 @@ public class SafeTypeLocator implements TypeLocator {
}
@Override
public Class<?> findType(@NonNull String typeName) {
public Class<?> findType(String typeName) {
if (StrUtil.isEmpty(typeName)) {
throw new FlowException("Type name cannot be null or empty");
}
@@ -28,7 +28,6 @@ import org.springframework.expression.ParserContext;
import org.springframework.expression.common.TemplateParserContext;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.lang.NonNull;
import java.util.Map;
@@ -93,7 +92,7 @@ public class SpelHelper implements ApplicationContextAware {
}
@Override
public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpelHelper.applicationContext == null) {
SpelHelper.applicationContext = applicationContext;
}
@@ -90,9 +90,6 @@ public class DefService extends WarmServiceImpl<FlowDefinition> {
public FlowDefinition insertFlow(FlowDefinition definition, List<FlowNode> nodeList, List<FlowSkip> skipList) {
definition.setVersion(getNewVersion(definition));
for (FlowNode node : nodeList) {
node.setVersion(definition.getVersion());
}
FlowEngine.defService().save(definition);
FlowEngine.nodeService().saveBatch(nodeList);
FlowEngine.skipService().saveBatch(skipList);
@@ -257,7 +254,7 @@ public class DefService extends WarmServiceImpl<FlowDefinition> {
List<FlowSkip> skipList = StreamUtils.toList(FlowEngine.skipService().getByDefId(id), FlowSkip::copy);
FlowEngine.dataFillHandler().idFill(definition);
nodeList.forEach(node -> node.setDefinitionId(definition.getId()).setVersion(definition.getVersion()));
nodeList.forEach(node -> node.setDefinitionId(definition.getId()));
FlowEngine.nodeService().saveBatch(nodeList);
skipList.forEach(skip -> skip.setDefinitionId(definition.getId()));
@@ -342,7 +339,7 @@ public class DefService extends WarmServiceImpl<FlowDefinition> {
// 便利一个流程中的各个节点
int startNum = 0;
for (FlowNode node : allNodes) {
FlowConfigUtil.initNodeAndCondition(node, definition.getId(), definition.getVersion());
FlowConfigUtil.initNodeAndCondition(node, definition.getId());
startNum = FlowConfigUtil.checkStartAndSame(node, startNum, flowName, nodeCodeSet);
}
AssertUtil.isTrue(startNum == 0, "[" + flowName + "]" + ExceptionCons.LOST_START_NODE);
@@ -46,7 +46,7 @@ public abstract class WarmServiceImpl<T extends RootEntity> implements IWarmServ
@Override
public List<T> getByIds(Collection<? extends Serializable> ids) {
return getMapper().selectBatchIds(ids);
return getMapper().selectByIds(ids);
}
@Override
@@ -89,7 +89,7 @@ public abstract class WarmServiceImpl<T extends RootEntity> implements IWarmServ
@Override
public boolean removeByIds(Collection<? extends Serializable> ids) {
return SqlHelper.retBool(getMapper().deleteBatchIds(ids));
return SqlHelper.retBool(getMapper().deleteByIds(ids));
}
@Override
@@ -66,7 +66,7 @@ public class FlowConfigUtil {
Set<String> nodeCodeSet = new HashSet<>();
// 遍历一个流程中的各个节点
for (FlowNode node : nodeList) {
initNodeAndCondition(node, definition.getId(), definition.getVersion());
initNodeAndCondition(node, definition.getId());
startNum = checkStartAndSame(node, startNum, flowName, nodeCodeSet);
allNodes.add(node);
allSkips.addAll(node.getSkipList());
@@ -136,9 +136,8 @@ public class FlowConfigUtil {
*
* @param node node
* @param definitionId definitionId
* @param version version
*/
public static void initNodeAndCondition(FlowNode node, Long definitionId, String version) {
public static void initNodeAndCondition(FlowNode node, Long definitionId) {
String nodeName = node.getNodeName();
String nodeCode = node.getNodeCode();
List<FlowSkip> skipList = node.getSkipList();
@@ -147,7 +146,6 @@ public class FlowConfigUtil {
}
AssertUtil.isEmpty(nodeCode, "[" + nodeName + "]" + ExceptionCons.LOST_NODE_CODE);
node.setVersion(version);
node.setDefinitionId(definitionId);
// 中间节点的集合, 跳转类型和目标节点不能重复