未验证 提交 9060f8b4 编写于 作者: J Jiajie Zhong 提交者: GitHub

Fix process definitions exists check error (#6668)

* Fix process definitions exists check error

* Add error log while verify status neither success or exists
上级 0b93fd57
......@@ -52,6 +52,8 @@ import java.util.Objects;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
......@@ -69,6 +71,8 @@ import py4j.GatewayServer;
})
})
public class PythonGatewayServer extends SpringBootServletInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonGatewayServer.class);
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
......@@ -177,7 +181,8 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
long projectCode = project.getCode();
Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, name);
if (verifyProcessDefinitionExists.get(Constants.STATUS) != Status.SUCCESS) {
Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS);
if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) {
// update process definition
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
long processDefinitionCode = processDefinition.getCode();
......@@ -186,12 +191,16 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson);
return processDefinitionCode;
} else {
} else if (verifyStatus == Status.SUCCESS) {
// create process definition
Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson);
ProcessDefinition processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
return processDefinition.getCode();
} else {
String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST.";
LOGGER.error(msg);
throw new RuntimeException(msg);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册