未验证 提交 d09d68e1 编写于 作者: Z zwZjut 提交者: GitHub

to #7065: fix ExecutorService and schedulerService (#7072)

Co-authored-by: Nhonghuo.zw <honghuo.zw@alibaba-inc.com>
上级 99f6ab38
...@@ -68,11 +68,12 @@ public interface ExecutorService { ...@@ -68,11 +68,12 @@ public interface ExecutorService {
/** /**
* check whether the process definition can be executed * check whether the process definition can be executed
* *
* @param projectCode project code
* @param processDefinition process definition * @param processDefinition process definition
* @param processDefineCode process definition code * @param processDefineCode process definition code
* @return check result code * @return check result code
*/ */
Map<String, Object> checkProcessDefinitionValid(ProcessDefinition processDefinition, long processDefineCode); Map<String, Object> checkProcessDefinitionValid(long projectCode, ProcessDefinition processDefinition, long processDefineCode);
/** /**
* do action to process instance:pause, stop, repeat, recover from pause, recover from stop * do action to process instance:pause, stop, repeat, recover from pause, recover from stop
......
...@@ -153,7 +153,7 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ ...@@ -153,7 +153,7 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ
// check process define release state // check process define release state
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
result = checkProcessDefinitionValid(processDefinition, processDefinitionCode); result = checkProcessDefinitionValid(projectCode, processDefinition, processDefinitionCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) { if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; return result;
} }
...@@ -208,14 +208,15 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ ...@@ -208,14 +208,15 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ
/** /**
* check whether the process definition can be executed * check whether the process definition can be executed
* *
* @param projectCode project code
* @param processDefinition process definition * @param processDefinition process definition
* @param processDefineCode process definition code * @param processDefineCode process definition code
* @return check result code * @return check result code
*/ */
@Override @Override
public Map<String, Object> checkProcessDefinitionValid(ProcessDefinition processDefinition, long processDefineCode) { public Map<String, Object> checkProcessDefinitionValid(long projectCode, ProcessDefinition processDefinition, long processDefineCode) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (processDefinition == null) { if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
// check process definition exists // check process definition exists
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode);
} else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { } else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) {
...@@ -259,7 +260,7 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ ...@@ -259,7 +260,7 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ
ProcessDefinition processDefinition = processService.findProcessDefinition(processInstance.getProcessDefinitionCode(), ProcessDefinition processDefinition = processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion()); processInstance.getProcessDefinitionVersion());
if (executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE) { if (executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE) {
result = checkProcessDefinitionValid(processDefinition, processInstance.getProcessDefinitionCode()); result = checkProcessDefinitionValid(projectCode, processDefinition, processInstance.getProcessDefinitionCode());
if (result.get(Constants.STATUS) != Status.SUCCESS) { if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; return result;
} }
......
...@@ -146,7 +146,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe ...@@ -146,7 +146,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
// check work flow define release state // check work flow define release state
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode);
result = executorService.checkProcessDefinitionValid(processDefinition, processDefineCode); result = executorService.checkProcessDefinitionValid(projectCode,processDefinition, processDefineCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) { if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; return result;
} }
...@@ -247,7 +247,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe ...@@ -247,7 +247,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
} }
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode()); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode());
if (processDefinition == null) { if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, schedule.getProcessDefinitionCode()); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, schedule.getProcessDefinitionCode());
return result; return result;
} }
...@@ -296,7 +296,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe ...@@ -296,7 +296,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
return result; return result;
} }
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(scheduleObj.getProcessDefinitionCode()); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(scheduleObj.getProcessDefinitionCode());
if (processDefinition == null) { if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, scheduleObj.getProcessDefinitionCode()); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, scheduleObj.getProcessDefinitionCode());
return result; return result;
} }
...@@ -396,7 +396,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe ...@@ -396,7 +396,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
} }
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode);
if (processDefinition == null) { if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode);
return result; return result;
} }
...@@ -606,7 +606,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe ...@@ -606,7 +606,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
} }
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) { if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode);
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册