From 0926ffa4d1018c304219a4924e0e3f1bb54e8bf0 Mon Sep 17 00:00:00 2001 From: xiaoqisu777 <60653240+xiaoqisu777@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:02:08 +0800 Subject: [PATCH] Fix bug duplicate predecessor tasks #16202 --- .../api/service/impl/TaskDefinitionServiceImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java index 2887606a1d28..597f64a0db7e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java @@ -377,7 +377,7 @@ public Map createTaskBindsWorkFlow(User loginUser, processTaskRelationLogList.add(processTaskRelationLog); } int insertResult = processService.saveTaskRelation(loginUser, projectCode, processDefinition.getCode(), - processDefinition.getVersion(), + processDefinition.getVersion()+1, processTaskRelationLogList, Lists.newArrayList(), Boolean.TRUE); if (insertResult != Constants.EXIT_CODE_SUCCESS) { log.error( @@ -400,6 +400,14 @@ public Map createTaskBindsWorkFlow(User loginUser, } else log.info("Save task definition complete, projectCode:{}, taskDefinitionCode:{}.", projectCode, taskDefinition.getCode()); + + int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); + if (insertVersion == 0) { + throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); + } else + log.info("Save process definition complete, processCode:{}, processVersion:{}.", + processDefinition.getCode(), insertVersion); + putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, taskDefinition); return result;