mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-13 07:33:42 +08:00
add 新增 warmflow 源码级定制化开发
This commit is contained in:
parent
472d2d1a3a
commit
e3bc391887
@ -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);
|
||||
|
||||
// 中间节点的集合, 跳转类型和目标节点不能重复
|
||||
|
||||
@ -61,7 +61,6 @@ create table FLOW_NODE
|
||||
LISTENER_PATH VARCHAR2(500),
|
||||
FORM_CUSTOM VARCHAR2(1) default 'N',
|
||||
FORM_PATH VARCHAR2(100),
|
||||
VERSION VARCHAR2(20),
|
||||
CREATE_TIME DATE,
|
||||
CREATE_BY VARCHAR2(64) default '',
|
||||
UPDATE_TIME DATE,
|
||||
@ -86,7 +85,6 @@ comment on column FLOW_NODE.LISTENER_TYPE is '监听器类型';
|
||||
comment on column FLOW_NODE.LISTENER_PATH is '监听器路径';
|
||||
comment on column FLOW_NODE.FORM_CUSTOM is '审批表单是否自定义 (Y是 N否)';
|
||||
comment on column FLOW_NODE.FORM_PATH is '审批表单路径';
|
||||
comment on column FLOW_NODE.VERSION is '版本';
|
||||
comment on column FLOW_NODE.CREATE_TIME is '创建时间';
|
||||
comment on column FLOW_NODE.CREATE_BY is '创建人';
|
||||
comment on column FLOW_NODE.UPDATE_TIME is '更新时间';
|
||||
|
||||
@ -56,7 +56,6 @@ CREATE TABLE flow_node
|
||||
listener_path varchar(400) NULL,
|
||||
form_custom bpchar(1) NULL DEFAULT 'N':: character varying,
|
||||
form_path varchar(100) NULL,
|
||||
"version" varchar(20) NOT NULL,
|
||||
create_time timestamp NULL,
|
||||
create_by varchar(64) NULL DEFAULT '':: character varying,
|
||||
update_time timestamp NULL,
|
||||
@ -80,7 +79,6 @@ COMMENT ON COLUMN flow_node.listener_type IS '监听器类型';
|
||||
COMMENT ON COLUMN flow_node.listener_path IS '监听器路径';
|
||||
COMMENT ON COLUMN flow_node.form_custom IS '审批表单是否自定义(Y是 N否)';
|
||||
COMMENT ON COLUMN flow_node.form_path IS '审批表单路径';
|
||||
COMMENT ON COLUMN flow_node."version" IS '版本';
|
||||
COMMENT ON COLUMN flow_node.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN flow_node.create_by IS '创建人';
|
||||
COMMENT ON COLUMN flow_node.update_time IS '更新时间';
|
||||
|
||||
@ -39,7 +39,6 @@ CREATE TABLE `flow_node`
|
||||
`listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
|
||||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||||
`version` varchar(20) NOT NULL COMMENT '版本',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
@ -173,7 +173,6 @@ CREATE TABLE flow_node (
|
||||
listener_path nvarchar(400) NULL,
|
||||
form_custom nchar(1) DEFAULT('N') NULL,
|
||||
form_path nvarchar(100) NULL,
|
||||
version nvarchar(20) NOT NULL,
|
||||
create_time datetime2(7) NULL,
|
||||
create_by nvarchar(64) NULL,
|
||||
update_time datetime2(7) NULL,
|
||||
@ -278,13 +277,6 @@ EXEC sp_addextendedproperty
|
||||
'COLUMN', N'form_path'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'版本',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'flow_node',
|
||||
'COLUMN', N'version'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'创建时间',
|
||||
'SCHEMA', N'dbo',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user