fix: 修复停用状态下的流程删除报错问题
This commit is contained in:
parent
8826f92d9d
commit
045a224c22
|
@ -304,7 +304,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||
}
|
||||
|
||||
// 2. 更新状态
|
||||
processDefinitionService.updateProcessDefinitionState(definition.getId(), state);
|
||||
processDefinitionService.updateProcessDefinitionState(definition.getId(), state,definition.isSuspended());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -403,7 +403,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||
return;
|
||||
}
|
||||
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(),
|
||||
SuspensionState.SUSPENDED.getStateCode());
|
||||
SuspensionState.SUSPENDED.getStateCode(),oldDefinition.isSuspended());
|
||||
}
|
||||
|
||||
private Model getModelByKey(String key) {
|
||||
|
|
|
@ -60,8 +60,9 @@ public interface BpmProcessDefinitionService {
|
|||
*
|
||||
* @param id 流程定义的编号
|
||||
* @param state 状态
|
||||
* @param isSuspended 是否处于激活或挂起状态
|
||||
*/
|
||||
void updateProcessDefinitionState(String id, Integer state);
|
||||
void updateProcessDefinitionState(String id, Integer state, boolean isSuspended);
|
||||
|
||||
/**
|
||||
* 更新模型编号
|
||||
|
|
|
@ -155,17 +155,21 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateProcessDefinitionState(String id, Integer state) {
|
||||
public void updateProcessDefinitionState(String id, Integer state,boolean isSuspended) {
|
||||
// 激活
|
||||
if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) {
|
||||
if (isSuspended) {
|
||||
repositoryService.activateProcessDefinitionById(id, false, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 挂起
|
||||
if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) {
|
||||
// suspendProcessInstances = false,进行中的任务,不进行挂起。
|
||||
// 原因:只要新的流程不允许发起即可,老流程继续可以执行。
|
||||
if (!isSuspended) {
|
||||
repositoryService.suspendProcessDefinitionById(id, false, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state);
|
||||
|
|
Loading…
Reference in New Issue