mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
回退-任务
This commit is contained in:
@ -76,4 +76,13 @@ public class BpmTaskController {
|
||||
taskService.updateTaskAssignee(getLoginUserId(), reqVO);
|
||||
return success(true);
|
||||
}
|
||||
@PutMapping("/back")
|
||||
@ApiOperation(value = "回退")
|
||||
// @PreAuthorize("@ss.hasPermission('bpm:task:back')")
|
||||
public CommonResult<Boolean> backTask(@Valid @RequestBody BpmTaskUpdateAssigneeReqVO reqVO) {
|
||||
//先硬编码到 回退到第一个审批节点
|
||||
String destinationTaskDefKey = "task01";
|
||||
taskService.backTask(reqVO.getId(),destinationTaskDefKey);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,12 @@ public interface BpmTaskService {
|
||||
* @param reqVO 不通过请求
|
||||
*/
|
||||
void rejectTask(Long userId, @Valid BpmTaskRejectReqVO reqVO);
|
||||
/**
|
||||
* 回退任务
|
||||
*
|
||||
* @param taskId 任务编号
|
||||
*/
|
||||
void backTask(String taskId,String destinationTaskDefKey);
|
||||
|
||||
/**
|
||||
* 将流程任务分配给指定用户
|
||||
|
@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
@ -51,6 +52,8 @@ public class BpmTaskServiceImpl implements BpmTaskService{
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private HistoryService historyService;
|
||||
|
||||
@Resource
|
||||
@ -203,6 +206,16 @@ public class BpmTaskServiceImpl implements BpmTaskService{
|
||||
.setResult(BpmProcessInstanceResultEnum.REJECT.getResult()).setComment(reqVO.getComment()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backTask(String taskId,String destinationTaskDefKey) {
|
||||
Task currentTask = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
|
||||
runtimeService.createChangeActivityStateBuilder()
|
||||
.processInstanceId(currentTask.getProcessInstanceId())
|
||||
.moveActivityIdTo(currentTask.getTaskDefinitionKey(), destinationTaskDefKey)
|
||||
.changeState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskAssignee(Long userId, BpmTaskUpdateAssigneeReqVO reqVO) {
|
||||
// 校验任务存在
|
||||
|
@ -87,6 +87,23 @@ public class LeaveFormKeyTest extends AbstractOATest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 任意流程的跳转
|
||||
*/
|
||||
@Test
|
||||
public void taskJump(){
|
||||
// 当前任务
|
||||
String taskId="ddd";
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
String assignee = "下一个自由跳转人";
|
||||
taskService.setAssignee(taskId,assignee);
|
||||
// 自由跳转
|
||||
String taskDefKey="目标-任务名称";
|
||||
//moveActivityIdTo的两个参数,源任务key,目标任务key
|
||||
runtimeService.createChangeActivityStateBuilder().processInstanceId(task.getProcessInstanceId()).moveActivityIdTo(task.getTaskDefinitionKey(), taskDefKey).changeState();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 领导驳回后申请人取消申请
|
||||
*/
|
||||
|
Reference in New Issue
Block a user