【代码优化】BPM:修复停用状态下的流程删除报错问题
This commit is contained in:
parent
64ea9906ef
commit
56ea9d2381
|
@ -304,7 +304,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||
}
|
||||
|
||||
// 2. 更新状态
|
||||
processDefinitionService.updateProcessDefinitionState(definition.getId(), state,definition.isSuspended());
|
||||
processDefinitionService.updateProcessDefinitionState(definition.getId(), state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -403,7 +403,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||
return;
|
||||
}
|
||||
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(),
|
||||
SuspensionState.SUSPENDED.getStateCode(),oldDefinition.isSuspended());
|
||||
SuspensionState.SUSPENDED.getStateCode());
|
||||
}
|
||||
|
||||
private Model getModelByKey(String key) {
|
||||
|
|
|
@ -60,9 +60,8 @@ public interface BpmProcessDefinitionService {
|
|||
*
|
||||
* @param id 流程定义的编号
|
||||
* @param state 状态
|
||||
* @param isSuspended 是否处于激活或挂起状态
|
||||
*/
|
||||
void updateProcessDefinitionState(String id, Integer state, boolean isSuspended);
|
||||
void updateProcessDefinitionState(String id, Integer state);
|
||||
|
||||
/**
|
||||
* 更新模型编号
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue