diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index dec3d19547..96a7372781 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -281,6 +281,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro int operator = processDefinitionLog.getOperator(); User user = userMapper.selectById(operator); pd.setModifyBy(user.getUserName()); + pd.setProjectId(project.getId()); } processDefinitionIPage.setRecords(records); @@ -1397,7 +1398,10 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } else { ProcessData processData = processService.genProcessData(processDefinition); List taskNodeList = processData.getTasks(); - taskNodeList.forEach(taskNode -> taskNode.setCode(0L)); + taskNodeList.forEach(taskNode -> { + taskNode.setName(taskNode.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); + taskNode.setCode(0L); + }); processData.setTasks(taskNodeList); String processDefinitionJson = JSONUtils.toJsonString(processData); return createProcessDefinition( @@ -1579,6 +1583,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); + logger.error("move processDefinition error: {}", e.getMessage(), e); + } } } @@ -1602,6 +1608,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); + logger.error("copy processDefinition error: {}", e.getMessage(), e); + } } } @@ -1689,6 +1697,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro putMsg(result, Status.SUCCESS); } } + /** * check has associated process definition * diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/PreviousTaskNode.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/PreviousTaskNode.java index c0ac665d19..020357578e 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/PreviousTaskNode.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/PreviousTaskNode.java @@ -34,6 +34,10 @@ public class PreviousTaskNode { */ private int version; + public PreviousTaskNode() { + + } + public PreviousTaskNode(long code, String name, int version) { this.code = code; this.name = name; diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index 4dbb60ae0a..9c9a4e7fbc 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -2298,6 +2298,7 @@ public class ProcessService { String desc, String locations, String connects) { ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(); Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinitionCode); + processDefinitionLog.setUserId(operator.getId()); processDefinitionLog.setCode(processDefinitionCode); processDefinitionLog.setVersion(version == null || version == 0 ? 1 : version); processDefinitionLog.setName(processDefinitionName);