package org.springblade.mdm.flow.service;
|
|
import lombok.AllArgsConstructor;
|
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;
|
import org.flowable.task.api.Task;
|
import org.springblade.mdm.flow.constants.FlowContants;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.Map;
|
|
@AllArgsConstructor
|
@Service
|
public class FlowTransferService {
|
|
private final TaskService taskService;
|
|
private final ApproveRecordService approveRecordService;
|
|
/**
|
* 转派,并记录自己的备注信息
|
* @param taskId 任务id
|
* @param newAssigneeId 转派给
|
* @param comment 评论信息
|
*/
|
@Transactional
|
public void transferTask(String taskId, String newAssigneeId,String comment) {
|
|
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
// 增加评论
|
|
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
// 完成任务
|
taskService.setAssignee(taskId, newAssigneeId);
|
|
//自荐表增加评论数据
|
approveRecordService.saveApproveRecords(task,"Y",comment);
|
}
|
}
|