Commit 667eb042 by huangfusuper

优化节点保存校验逻辑

parent 7461ec3f
......@@ -10,4 +10,9 @@ public interface ApiNodeCheckService {
* @param mainFlowId 主工作流的id
*/
void checkFlowNode(Integer mainFlowId);
/**
* 工作流节点校验 删除不在调度上的节点
*/
void checkFlowNode();
}
......@@ -133,7 +133,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
log.debug("生成版本");
FlowVersion flowVersion = saveFlowVersion(flow);
apiNodeCheckService.checkFlowNode(flow.getFlowId());
apiNodeCheckService.checkFlowNode();
log.debug("插件端通过API保存成功!");
}
......
......@@ -28,7 +28,12 @@ public class ApiNodeCheckServiceImpl implements ApiNodeCheckService {
this.flowService = flowService;
}
/**
* 废弃原因:查询次数多,性能低
* @param mainFlowId 主工作流的id
*/
@Override
@Deprecated
public void checkFlowNode(Integer mainFlowId) {
//查询工作流
FlowVo mainFlow = flowService.getFlowId(mainFlowId);
......@@ -48,6 +53,14 @@ public class ApiNodeCheckServiceImpl implements ApiNodeCheckService {
nodeService.deleteNode(collect);
}
/**
* 删除不在调度上的节点
*/
@Override
public void checkFlowNode() {
nodeService.deleteNoForkNode();
}
private void getAllInnerNode(List<Node> mainNodes,List<Node> candidateNodes){
for (Node node : mainNodes) {
if("1".equals(node.getIsVirtual())) {
......
......@@ -97,4 +97,10 @@ public interface NodeMapper {
List<Node> findbyFlowIds(@Param("flowIdList")List<Integer> flowIdList);
int deleteNodeByIds(@Param("ids") List<Integer> ids);
/**
* 删除不在调度上的
* @return
*/
int deleteNoForkNode();
}
\ No newline at end of file
......@@ -28,4 +28,10 @@ public interface NodeService {
int deleteNode(List<Integer> ids);
/**
* 删除不在调度上的节点
* @return 删除数目
*/
int deleteNoForkNode();
}
......@@ -36,4 +36,9 @@ public class NodeServiceImpl implements NodeService {
return nodeMapper.deleteNodeByIds(ids);
}
@Override
public int deleteNoForkNode() {
return nodeMapper.deleteNoForkNode();
}
}
......@@ -496,4 +496,8 @@
where node_id = #{nodeId,jdbcType=INTEGER}
</update>
<delete id="deleteNoForkNode">
delete from node where on_fork = '1'
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment