Commit 045a224c2255a4add4c991b8ba2bf95533399bec
1 parent
8826f92d
fix: 修复停用状态下的流程删除报错问题
Showing
3 changed files
with
11 additions
and
6 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
| ... | ... | @@ -304,7 +304,7 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | // 2. 更新状态 |
| 307 | - processDefinitionService.updateProcessDefinitionState(definition.getId(), state); | |
| 307 | + processDefinitionService.updateProcessDefinitionState(definition.getId(), state,definition.isSuspended()); | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | @Override |
| ... | ... | @@ -403,7 +403,7 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 403 | 403 | return; |
| 404 | 404 | } |
| 405 | 405 | processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), |
| 406 | - SuspensionState.SUSPENDED.getStateCode()); | |
| 406 | + SuspensionState.SUSPENDED.getStateCode(),oldDefinition.isSuspended()); | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | private Model getModelByKey(String key) { | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java
| ... | ... | @@ -60,8 +60,9 @@ public interface BpmProcessDefinitionService { |
| 60 | 60 | * |
| 61 | 61 | * @param id 流程定义的编号 |
| 62 | 62 | * @param state 状态 |
| 63 | + * @param isSuspended 是否处于激活或挂起状态 | |
| 63 | 64 | */ |
| 64 | - void updateProcessDefinitionState(String id, Integer state); | |
| 65 | + void updateProcessDefinitionState(String id, Integer state, boolean isSuspended); | |
| 65 | 66 | |
| 66 | 67 | /** |
| 67 | 68 | * 更新模型编号 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java
| ... | ... | @@ -155,17 +155,21 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | @Override |
| 158 | - public void updateProcessDefinitionState(String id, Integer state) { | |
| 158 | + public void updateProcessDefinitionState(String id, Integer state,boolean isSuspended) { | |
| 159 | 159 | // 激活 |
| 160 | 160 | if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) { |
| 161 | - repositoryService.activateProcessDefinitionById(id, false, null); | |
| 161 | + if (isSuspended) { | |
| 162 | + repositoryService.activateProcessDefinitionById(id, false, null); | |
| 163 | + } | |
| 162 | 164 | return; |
| 163 | 165 | } |
| 164 | 166 | // 挂起 |
| 165 | 167 | if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) { |
| 166 | 168 | // suspendProcessInstances = false,进行中的任务,不进行挂起。 |
| 167 | 169 | // 原因:只要新的流程不允许发起即可,老流程继续可以执行。 |
| 168 | - repositoryService.suspendProcessDefinitionById(id, false, null); | |
| 170 | + if (!isSuspended) { | |
| 171 | + repositoryService.suspendProcessDefinitionById(id, false, null); | |
| 172 | + } | |
| 169 | 173 | return; |
| 170 | 174 | } |
| 171 | 175 | log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state); | ... | ... |