This is an automated email from the ASF dual-hosted git repository.

wenhemin pushed a commit to branch json_split
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/json_split by this push:
     new 37b149d  fix circular dependence bug (#5330)
37b149d is described below

commit 37b149da39a3ed493948f9872c002a49351cae49
Author: Simon <[email protected]>
AuthorDate: Tue Apr 20 20:40:21 2021 -0500

    fix circular dependence bug (#5330)
---
 .../api/service/impl/ProcessDefinitionServiceImpl.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

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 5f424e1..75fe58a 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
@@ -1396,7 +1396,7 @@ public class ProcessDefinitionServiceImpl extends 
BaseServiceImpl implements Pro
                                                       Project targetProject) 
throws JsonProcessingException {
 
         Map<String, Object> result = new HashMap<>();
-
+        String currentTimeStamp = DateUtils.getCurrentTimeStamp();
         ProcessDefinition processDefinition = 
processDefinitionMapper.selectById(processId);
         if (processDefinition == null) {
             putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
@@ -1407,21 +1407,27 @@ public class ProcessDefinitionServiceImpl extends 
BaseServiceImpl implements Pro
             String locations = processDefinition.getLocations();
             ObjectNode locationsJN = JSONUtils.parseObject(locations);
 
-            taskNodeList.forEach(taskNode -> {
-                String suffix = "_copy_" + DateUtils.getCurrentTimeStamp();
+            for (TaskNode taskNode : taskNodeList) {
+                String suffix = "_copy_" + currentTimeStamp;
                 String id = taskNode.getId();
                 String newName = locationsJN.path(id).path("name").asText() + 
suffix;
                 ((ObjectNode) locationsJN.get(id)).put("name", newName);
 
+                List<String> depList = taskNode.getDepList();
+                List<String> newDepList = depList.stream()
+                        .map(s -> s + suffix)
+                        .collect(Collectors.toList());
+
+                taskNode.setDepList(newDepList);
                 taskNode.setName(taskNode.getName() + suffix);
                 taskNode.setCode(0L);
-            });
+            }
             processData.setTasks(taskNodeList);
             String processDefinitionJson = JSONUtils.toJsonString(processData);
             return createProcessDefinition(
                     loginUser,
                     targetProject.getName(),
-                    processDefinition.getName() + "_copy_" + 
DateUtils.getCurrentTimeStamp(),
+                    processDefinition.getName() + "_copy_" + currentTimeStamp,
                     processDefinitionJson,
                     processDefinition.getDescription(),
                     locationsJN.toString(),

Reply via email to