refactor(xispeak): 将删除单个流程接口下沉至 tasktask 通用模块

deleteSingleProcess 由 BgXiSpeakController 迁移至 TaskTaskController,
作为通用接口供各业务模块复用。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wsm
2026-05-26 09:58:14 +08:00
co-authored by Claude Opus 4.7
parent 4ac462425c
commit 119c148c25
6 changed files with 43 additions and 44 deletions
@@ -281,24 +281,6 @@ public class BgXiSpeakController extends JeecgController<BgXiSpeak, IBgXiSpeakSe
return Result.error("id为" + id + "的xispeak表单删除相关流程失败");
}
/**
* 删除单个流程实例
* @param processInstId 流程实例ID
* @return
*/
@AutoLog(value = "删除单个流程实例")
@Operation(summary="删除单个流程实例")
@PostMapping(value = "/deleteSingleProcess")
public Result<String> deleteSingleProcess(@RequestParam("processInstId") String processInstId) {
if (oConvertUtils.isEmpty(processInstId)) {
return Result.error("流程实例ID不能为空");
}
if (bgXiSpeakService.deleteSingleProcess(processInstId)) {
return Result.OK("删除流程成功");
}
return Result.error("删除流程失败");
}
/**
* 通过id删除
*
@@ -82,8 +82,6 @@ public interface IBgXiSpeakService extends IService<BgXiSpeak> {
boolean withDrawXiSpeak(String id);
boolean deleteSingleProcess(String processInstId);
List<BgXiSpeak> getRootListWithDept(String pid);
void checkAndMarkCompletedByProcessInstId(String processInstanceId);
@@ -280,30 +280,6 @@ public class BgXiSpeakServiceImpl extends ServiceImpl<BgXiSpeakMapper, BgXiSpeak
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteSingleProcess(String processInstId) {
LambdaQueryWrapper<TaskTask> queryWrapper = new LambdaQueryWrapper<TaskTask>()
.eq(TaskTask::getProcessInstId, processInstId)
.last("for update");
TaskTask taskTask = taskTaskServiceImpl.getOne(queryWrapper, false);
if (taskTask == null) {
log.warn("删除单个流程时未找到关联的tasktask记录, processInstId: {}", processInstId);
return false;
}
long count = runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstId)
.count();
if (count > 0) {
runtimeService.deleteProcessInstance(processInstId, "删除单个流程");
log.info("成功中止运行中的流程实例: {}", processInstId);
}
LambdaQueryWrapper<TaskTask> deleteWrapper = new LambdaQueryWrapper<TaskTask>()
.eq(TaskTask::getProcessInstId, processInstId);
taskTaskServiceImpl.remove(deleteWrapper);
return true;
}
public List<BgXiSpeak> getRootListWithDept(String pid) {
// 1. 这里的参数 pid 实际是前端传过来的部门逗号拼接字符串,将其清洗并转换为 Set