Commit f80c036e by huangfusuper

同步调度与DDMP平台版本生成策略

parent f33df5fe
...@@ -23,6 +23,7 @@ import com.byit.service.ApiNodeCheckService; ...@@ -23,6 +23,7 @@ import com.byit.service.ApiNodeCheckService;
import com.byit.util.ApiFlowDagCheck; import com.byit.util.ApiFlowDagCheck;
import com.byit.util.IDGenerationStrategy; import com.byit.util.IDGenerationStrategy;
import com.byit.util.lock.RedissLockUtil; import com.byit.util.lock.RedissLockUtil;
import com.byit.utils.JobVersionGenUtil;
import com.byit.utils.ValidationUtil; import com.byit.utils.ValidationUtil;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -175,15 +176,28 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -175,15 +176,28 @@ public class ApiFlowServiceImpl implements ApiFlowService {
Flow oldFlow = flowMapper.getByWorkSpaceAndName(workspaceId, pluginFlow.getName()); Flow oldFlow = flowMapper.getByWorkSpaceAndName(workspaceId, pluginFlow.getName());
//判断是否是重发 //判断是否是重发
if ((pluginFlow.isRePublish() && !isInnner) || (isInnner && null != oldFlow)){ if ((pluginFlow.isRePublish() && !isInnner) || (isInnner && null != oldFlow)){
String versionName = pluginFlow.getVersionName();
flow.setFlowId(oldFlow.getFlowId());
//当版本号不存在
if(StringUtils.isBlank(versionName)){
String version = oldFlow.getVersionName(); String version = oldFlow.getVersionName();
Integer versionTag = Integer.valueOf(version.split("\\.")[1]); Integer versionTag = Integer.valueOf(version.split("\\.")[1]);
flow.setFlowId(oldFlow.getFlowId()); flow.setVersionName(JobVersionGenUtil.generateVersionName(versionTag));
flow.setVersionName("V." + (versionTag + 1));
}else{
flow.setVersionName(versionName);
}
flowMapper.updateByIdSelective(flow); flowMapper.updateByIdSelective(flow);
updateNodeByFlow(pluginFlow.getNodeList(), flow); updateNodeByFlow(pluginFlow.getNodeList(), flow);
}else { }else {
flow.setVersionName("V.1"); String versionName = pluginFlow.getVersionName();
if(StringUtils.isBlank(versionName)){
flow.setVersionName(JobVersionGenUtil.generateVersionName(1));
}else{
flow.setVersionName(versionName);
}
Integer flowId = flowMapper.insertSelective(flow); Integer flowId = flowMapper.insertSelective(flow);
saveNode(pluginFlow.getNodeList(), flow); saveNode(pluginFlow.getNodeList(), flow);
} }
......
...@@ -36,5 +36,10 @@ public class PluginFlow extends PluginBaseNode implements Serializable { ...@@ -36,5 +36,10 @@ public class PluginFlow extends PluginBaseNode implements Serializable {
*/ */
private PluginFlowConfig config; private PluginFlowConfig config;
/**
* 版本索引
*/
private String versionName;
private static final long serialVersionUID = 3L; private static final long serialVersionUID = 3L;
} }
package com.byit.utils;
/**
* 版本号生成策略
*
* @author huangfu
*/
public class JobVersionGenUtil {
public static final String VERSION_NAME_PRE = "V.%s";
/**
* 调度版本生成策略
* @param versionIndex 版本索号
* @return 对应的版本名称
*/
public static String generateVersionName(Integer versionIndex){
return String.format(VERSION_NAME_PRE, versionIndex);
}
}
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