feat(xispeak): 新增删除单个流程实例接口
提供按 processInstId 删除单个流程的能力,区别于 withDrawXiSpeak 的批量删除整个业务表单下的所有流程。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+18
@@ -281,6 +281,24 @@ 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删除
|
||||
*
|
||||
|
||||
+2
@@ -82,6 +82,8 @@ public interface IBgXiSpeakService extends IService<BgXiSpeak> {
|
||||
|
||||
boolean withDrawXiSpeak(String id);
|
||||
|
||||
boolean deleteSingleProcess(String processInstId);
|
||||
|
||||
List<BgXiSpeak> getRootListWithDept(String pid);
|
||||
|
||||
void checkAndMarkCompletedByProcessInstId(String processInstanceId);
|
||||
|
||||
+24
@@ -280,6 +280,30 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user