|
@@ -28,8 +28,7 @@ import java.util.*;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.addIfNotNull;
|
|
|
-import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_KEY_NOT_MATCH;
|
|
|
-import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_NAME_NOT_MATCH;
|
|
|
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
|
|
import static java.util.Collections.emptyList;
|
|
|
|
|
|
/**
|
|
@@ -155,10 +154,15 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateProcessDefinitionState(String id, Integer state,boolean isSuspended) {
|
|
|
+ public void updateProcessDefinitionState(String id, Integer state) {
|
|
|
+ ProcessDefinition processDefinition = repositoryService.getProcessDefinition(id);
|
|
|
+ if (processDefinition == null) {
|
|
|
+ throw exception(PROCESS_DEFINITION_NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
// 激活
|
|
|
if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) {
|
|
|
- if (isSuspended) {
|
|
|
+ if (processDefinition.isSuspended()) {
|
|
|
repositoryService.activateProcessDefinitionById(id, false, null);
|
|
|
}
|
|
|
return;
|
|
@@ -167,7 +171,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
|
|
if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) {
|
|
|
// suspendProcessInstances = false,进行中的任务,不进行挂起。
|
|
|
// 原因:只要新的流程不允许发起即可,老流程继续可以执行。
|
|
|
- if (!isSuspended) {
|
|
|
+ if (!processDefinition.isSuspended()) {
|
|
|
repositoryService.suspendProcessDefinitionById(id, false, null);
|
|
|
}
|
|
|
return;
|