Browse Source

fix copy locations name error (#5228)

pull/3/MERGE
Simon 4 years ago committed by GitHub
parent
commit
8d6c2e3a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -1404,8 +1404,16 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
} else {
ProcessData processData = processService.genProcessData(processDefinition);
List<TaskNode> taskNodeList = processData.getTasks();
String locations = processDefinition.getLocations();
ObjectNode locationsJN = JSONUtils.parseObject(locations);
taskNodeList.forEach(taskNode -> {
taskNode.setName(taskNode.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
String suffix = "_copy_" + DateUtils.getCurrentTimeStamp();
String id = taskNode.getId();
String newName = locationsJN.path(id).path("name").asText() + suffix;
((ObjectNode) locationsJN.get(id)).put("name", newName);
taskNode.setName(taskNode.getName() + suffix);
taskNode.setCode("0");
});
processData.setTasks(taskNodeList);
@ -1416,7 +1424,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(),
processDefinitionJson,
processDefinition.getDescription(),
processDefinition.getLocations(),
locationsJN.toString(),
processDefinition.getConnects());
}

Loading…
Cancel
Save