mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-04 13:17:50 +08:00
[Fix-7203] Remedy the issue about importing a process json file. (#7811)
* fix a few issues * fix a little issue * Update ProcessDefinitionServiceImpl.java * Update ProcessDefinitionServiceImpl.java Co-authored-by: Kerwin <37063904+zhuangchong@users.noreply.github.com>
This commit is contained in:
parent
ab89e4335e
commit
f0ad65cb14
@ -107,7 +107,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.common.collect.Lists;
|
||||
@ -940,6 +940,21 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
||||
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
|
||||
taskRelationLogList.add(processTaskRelationLog);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) {
|
||||
ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations());
|
||||
ArrayNode newArrayNode = JSONUtils.createArrayNode();
|
||||
for (int i = 0; i < arrayNode.size(); i++) {
|
||||
ObjectNode newObjectNode = newArrayNode.addObject();
|
||||
JsonNode jsonNode = arrayNode.get(i);
|
||||
Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong());
|
||||
if (Objects.nonNull(taskCode)) {
|
||||
newObjectNode.put("taskCode", taskCode);
|
||||
newObjectNode.set("x", jsonNode.get("x"));
|
||||
newObjectNode.set("y", jsonNode.get("y"));
|
||||
}
|
||||
}
|
||||
processDefinition.setLocations(newArrayNode.toString());
|
||||
}
|
||||
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList());
|
||||
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
|
||||
putMsg(createDagResult, Status.SUCCESS);
|
||||
|
Loading…
Reference in New Issue
Block a user