!1235 fix: 修复停用状态下的流程删除报错问题

Merge pull request !1235 from SamllNorth_Lee/fix/bpm
This commit is contained in:
芋道源码 2025-02-15 01:18:50 +00:00 committed by Gitee
commit 64ea9906ef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 11 additions and 6 deletions

View File

@ -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) {

View File

@ -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);
/**
* 更新模型编号

View File

@ -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)) {
repositoryService.activateProcessDefinitionById(id, false, null);
if (isSuspended) {
repositoryService.activateProcessDefinitionById(id, false, null);
}
return;
}
// 挂起
if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) {
// suspendProcessInstances = false进行中的任务不进行挂起
// 原因只要新的流程不允许发起即可老流程继续可以执行
repositoryService.suspendProcessDefinitionById(id, false, null);
if (!isSuspended) {
repositoryService.suspendProcessDefinitionById(id, false, null);
}
return;
}
log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state);