Commit 64ea9906ef660599e4dc4f7689c94028648e95d6
Committed by
Gitee
!1235 fix: 修复停用状态下的流程删除报错问题
Merge pull request !1235 from SamllNorth_Lee/fix/bpm
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,7 +304,7 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | // 2. 更新状态 | 306 | // 2. 更新状态 |
| 307 | - processDefinitionService.updateProcessDefinitionState(definition.getId(), state); | 307 | + processDefinitionService.updateProcessDefinitionState(definition.getId(), state,definition.isSuspended()); |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | @Override | 310 | @Override |
| @@ -403,7 +403,7 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -403,7 +403,7 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 403 | return; | 403 | return; |
| 404 | } | 404 | } |
| 405 | processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), | 405 | processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), |
| 406 | - SuspensionState.SUSPENDED.getStateCode()); | 406 | + SuspensionState.SUSPENDED.getStateCode(),oldDefinition.isSuspended()); |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | private Model getModelByKey(String key) { | 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,8 +60,9 @@ public interface BpmProcessDefinitionService { | ||
| 60 | * | 60 | * |
| 61 | * @param id 流程定义的编号 | 61 | * @param id 流程定义的编号 |
| 62 | * @param state 状态 | 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,17 +155,21 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ | ||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | @Override | 157 | @Override |
| 158 | - public void updateProcessDefinitionState(String id, Integer state) { | 158 | + public void updateProcessDefinitionState(String id, Integer state,boolean isSuspended) { |
| 159 | // 激活 | 159 | // 激活 |
| 160 | if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) { | 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 | return; | 164 | return; |
| 163 | } | 165 | } |
| 164 | // 挂起 | 166 | // 挂起 |
| 165 | if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) { | 167 | if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) { |
| 166 | // suspendProcessInstances = false,进行中的任务,不进行挂起。 | 168 | // suspendProcessInstances = false,进行中的任务,不进行挂起。 |
| 167 | // 原因:只要新的流程不允许发起即可,老流程继续可以执行。 | 169 | // 原因:只要新的流程不允许发起即可,老流程继续可以执行。 |
| 168 | - repositoryService.suspendProcessDefinitionById(id, false, null); | 170 | + if (!isSuspended) { |
| 171 | + repositoryService.suspendProcessDefinitionById(id, false, null); | ||
| 172 | + } | ||
| 169 | return; | 173 | return; |
| 170 | } | 174 | } |
| 171 | log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state); | 175 | log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state); |