Commit 70538320c84df0a20b4da63b03a3f821180d80b3
1 parent
a16f1120
【功能评审】Bpm:清理流程
Showing
3 changed files
with
6 additions
and
3 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java
| @@ -164,7 +164,7 @@ public class BpmModelController { | @@ -164,7 +164,7 @@ public class BpmModelController { | ||
| 164 | @DeleteMapping("/clean") | 164 | @DeleteMapping("/clean") |
| 165 | @Operation(summary = "清理模型") | 165 | @Operation(summary = "清理模型") |
| 166 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 166 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 167 | - @PreAuthorize("@ss.hasPermission('bpm:model:delete')") | 167 | + @PreAuthorize("@ss.hasPermission('bpm:model:clean')") |
| 168 | public CommonResult<Boolean> cleanModel(@RequestParam("id") String id) { | 168 | public CommonResult<Boolean> cleanModel(@RequestParam("id") String id) { |
| 169 | modelService.cleanModel(getLoginUserId(), id); | 169 | modelService.cleanModel(getLoginUserId(), id); |
| 170 | return success(true); | 170 | return success(true); |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelService.java
| @@ -89,7 +89,7 @@ public interface BpmModelService { | @@ -89,7 +89,7 @@ public interface BpmModelService { | ||
| 89 | void deleteModel(Long userId, String id); | 89 | void deleteModel(Long userId, String id); |
| 90 | 90 | ||
| 91 | /** | 91 | /** |
| 92 | - * 清理模型 | 92 | + * 清理模型,包括流程实例 |
| 93 | * | 93 | * |
| 94 | * @param userId 用户编号 | 94 | * @param userId 用户编号 |
| 95 | * @param id 编号 | 95 | * @param id 编号 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
| @@ -262,7 +262,8 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -262,7 +262,8 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 262 | Model model = validateModelManager(id, userId); | 262 | Model model = validateModelManager(id, userId); |
| 263 | 263 | ||
| 264 | // 2. 清理所有流程数据 | 264 | // 2. 清理所有流程数据 |
| 265 | - // TODO @芋艿:这里没有找到批量操作的方法,会不会有性能问题~ | 265 | + // TODO @芋艿:这里没有找到批量操作的方法,会不会有性能问题~; |
| 266 | + // TODO @lesan:建议按照顺序?1)List<ProcessInstance> processInstances 循环处理;然后删除删除一个示实例,接着删除它的 history; | ||
| 266 | // 2.1 先取消所有正在运行的流程 | 267 | // 2.1 先取消所有正在运行的流程 |
| 267 | List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery() | 268 | List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery() |
| 268 | .processDefinitionKey(model.getKey()).list(); | 269 | .processDefinitionKey(model.getKey()).list(); |
| @@ -276,6 +277,8 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -276,6 +277,8 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 276 | historicProcessInstances.forEach(historicProcessInstance -> { | 277 | historicProcessInstances.forEach(historicProcessInstance -> { |
| 277 | historyService.deleteHistoricProcessInstance(historicProcessInstance.getId()); | 278 | historyService.deleteHistoricProcessInstance(historicProcessInstance.getId()); |
| 278 | }); | 279 | }); |
| 280 | + // TODO @lesan:流程任务,是不是也要清理哈? | ||
| 281 | + // TODO @lesan:抄送是不是也要清理; | ||
| 279 | } | 282 | } |
| 280 | 283 | ||
| 281 | @Override | 284 | @Override |