回退-任务
This commit is contained in:
parent
c5a9f5d03d
commit
56eedfd147
|
@ -76,4 +76,13 @@ public class BpmTaskController {
|
||||||
taskService.updateTaskAssignee(getLoginUserId(), reqVO);
|
taskService.updateTaskAssignee(getLoginUserId(), reqVO);
|
||||||
return success(true);
|
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 不通过请求
|
* @param reqVO 不通过请求
|
||||||
*/
|
*/
|
||||||
void rejectTask(Long userId, @Valid BpmTaskRejectReqVO 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 cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flowable.engine.HistoryService;
|
import org.flowable.engine.HistoryService;
|
||||||
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.flowable.engine.TaskService;
|
import org.flowable.engine.TaskService;
|
||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
|
@ -51,6 +52,8 @@ public class BpmTaskServiceImpl implements BpmTaskService{
|
||||||
@Resource
|
@Resource
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private RuntimeService runtimeService;
|
||||||
|
@Resource
|
||||||
private HistoryService historyService;
|
private HistoryService historyService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -203,6 +206,16 @@ public class BpmTaskServiceImpl implements BpmTaskService{
|
||||||
.setResult(BpmProcessInstanceResultEnum.REJECT.getResult()).setComment(reqVO.getComment()));
|
.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
|
@Override
|
||||||
public void updateTaskAssignee(Long userId, BpmTaskUpdateAssigneeReqVO reqVO) {
|
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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领导驳回后申请人取消申请
|
* 领导驳回后申请人取消申请
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,6 +39,13 @@ export function rejectTask(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function backTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bpm/task/back',
|
||||||
|
method: 'PUT',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function updateTaskAssignee(data) {
|
export function updateTaskAssignee(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -109,7 +109,7 @@ import store from "@/store";
|
||||||
import {decodeFields} from "@/utils/formGenerator";
|
import {decodeFields} from "@/utils/formGenerator";
|
||||||
import Parser from '@/components/parser/Parser'
|
import Parser from '@/components/parser/Parser'
|
||||||
import {createProcessInstance, getProcessInstance} from "@/api/bpm/processInstance";
|
import {createProcessInstance, getProcessInstance} from "@/api/bpm/processInstance";
|
||||||
import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssignee} from "@/api/bpm/task";
|
import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssignee,backTask} from "@/api/bpm/task";
|
||||||
import {getDate} from "@/utils/dateUtils";
|
import {getDate} from "@/utils/dateUtils";
|
||||||
import {listSimpleUsers} from "@/api/system/user";
|
import {listSimpleUsers} from "@/api/system/user";
|
||||||
import {getActivityList} from "@/api/bpm/activity";
|
import {getActivityList} from "@/api/bpm/activity";
|
||||||
|
@ -406,7 +406,15 @@ export default {
|
||||||
},
|
},
|
||||||
/** 处理审批退回的操作 */
|
/** 处理审批退回的操作 */
|
||||||
handleBack(task) {
|
handleBack(task) {
|
||||||
this.$modal.msgError("暂不支持【退回】功能!");
|
const data = {
|
||||||
|
id: task.id,
|
||||||
|
assigneeUserId: 1
|
||||||
|
}
|
||||||
|
// this.$modal.msgError("暂不支持【--退回】功能!");
|
||||||
|
backTask(data).then(response => {
|
||||||
|
this.$modal.msgSuccess("回退成功!");
|
||||||
|
this.getDetail(); // 获得最新详情
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue