feat: 我发起流程加载处理优化
parent
ae0226a8f4
commit
83bb7cd5ba
|
|
@ -315,28 +315,58 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult findReturnTaskList(FlowTaskVo flowTaskVo) {
|
||||
// // 当前任务 task
|
||||
// Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
|
||||
// // 从流程历史任务中获取可退回节点
|
||||
//// List<HistoricActivityInstance> hisActIns = historyService.createHistoricActivityInstanceQuery()
|
||||
//// .executionId(task.getExecutionId())
|
||||
//// .activityType("userTask")
|
||||
//// .orderByHistoricActivityInstanceStartTime()
|
||||
//// .finished()
|
||||
//// .desc()
|
||||
//// .list();
|
||||
////
|
||||
//// // 可回退的节点列表
|
||||
//// List<ReturnTaskNodeVo> returnTaskNodeList = new ArrayList<>();
|
||||
//// ReturnTaskNodeVo returnTaskNodeVo;
|
||||
//// for (HistoricActivityInstance activityInstance : hisActIns) {
|
||||
//// returnTaskNodeVo = new ReturnTaskNodeVo();
|
||||
//// returnTaskNodeVo.setId(activityInstance.getActivityId());
|
||||
//// // 根据流程节点处理时间校验改节点是否已完成
|
||||
//// returnTaskNodeVo.setName(activityInstance.getActivityName());
|
||||
//// returnTaskNodeList.add(returnTaskNodeVo);
|
||||
//// }
|
||||
// List<UserTask> userTaskList = new ArrayList<>();
|
||||
// // 获取流程定义信息
|
||||
// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
|
||||
// // 获取所有节点信息,暂不考虑子流程情况
|
||||
// Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0);
|
||||
// Collection<FlowElement> flowElements = process.getFlowElements();
|
||||
// // 获取当前任务节点元素
|
||||
// UserTask source = null;
|
||||
// if (flowElements != null) {
|
||||
// for (FlowElement flowElement : flowElements) {
|
||||
// // 类型为用户节点
|
||||
// if (flowElement.getId().equals(task.getTaskDefinitionKey())) {
|
||||
// source = (UserTask) flowElement;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 获取节点的所有路线
|
||||
// List<List<UserTask>> roads = FlowableUtils.findRoad(source, null, null, null);
|
||||
//
|
||||
// for (List<UserTask> road : roads) {
|
||||
// if (userTaskList.size() == 0) {
|
||||
// // 还没有可回退节点直接添加
|
||||
// userTaskList = road;
|
||||
// } else {
|
||||
// // 如果已有回退节点,则比对取交集部分
|
||||
// userTaskList.retainAll(road);
|
||||
// }
|
||||
// }
|
||||
// return AjaxResult.success(userTaskList);
|
||||
// 当前任务 task
|
||||
Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
|
||||
// 从流程历史任务中获取可退回节点
|
||||
// List<HistoricActivityInstance> hisActIns = historyService.createHistoricActivityInstanceQuery()
|
||||
// .executionId(task.getExecutionId())
|
||||
// .activityType("userTask")
|
||||
// .orderByHistoricActivityInstanceStartTime()
|
||||
// .finished()
|
||||
// .desc()
|
||||
// .list();
|
||||
//
|
||||
// // 可回退的节点列表
|
||||
// List<ReturnTaskNodeVo> returnTaskNodeList = new ArrayList<>();
|
||||
// ReturnTaskNodeVo returnTaskNodeVo;
|
||||
// for (HistoricActivityInstance activityInstance : hisActIns) {
|
||||
// returnTaskNodeVo = new ReturnTaskNodeVo();
|
||||
// returnTaskNodeVo.setId(activityInstance.getActivityId());
|
||||
// // 根据流程节点处理时间校验改节点是否已完成
|
||||
// returnTaskNodeVo.setName(activityInstance.getActivityName());
|
||||
// returnTaskNodeList.add(returnTaskNodeVo);
|
||||
// }
|
||||
List<UserTask> userTaskList = new ArrayList<>();
|
||||
// 获取流程定义信息
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
|
||||
// 获取所有节点信息,暂不考虑子流程情况
|
||||
|
|
@ -354,7 +384,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
}
|
||||
// 获取节点的所有路线
|
||||
List<List<UserTask>> roads = FlowableUtils.findRoad(source, null, null, null);
|
||||
|
||||
// 可回退的节点列表
|
||||
List<UserTask> userTaskList = new ArrayList<>();
|
||||
for (List<UserTask> road : roads) {
|
||||
if (userTaskList.size() == 0) {
|
||||
// 还没有可回退节点直接添加
|
||||
|
|
@ -465,13 +496,15 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
flowTask.setCategory(pd.getCategory());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
// 当前所处流程 todo: 本地启动放开以下注释
|
||||
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
// flowTask.setTaskId(taskList.get(0).getId());
|
||||
// } else {
|
||||
// List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
// flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
// }
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
flowTask.setTaskId(taskList.get(0).getId());
|
||||
flowTask.setTaskName(taskList.get(0).getName());
|
||||
} else {
|
||||
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
flowTask.setTaskName(historicTaskInstance.get(0).getName());
|
||||
}
|
||||
flowList.add(flowTask);
|
||||
}
|
||||
page.setRecords(flowList);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,6 @@ export default {
|
|||
},
|
||||
// 传值给父组件
|
||||
getData(){
|
||||
debugger
|
||||
this.$emit('getData', this[this.formConf.formModel])
|
||||
// this.$emit('getData',this.formConfCopy)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,13 +378,14 @@ export default {
|
|||
},
|
||||
/** 流程流转记录 */
|
||||
getFlowRecordList(procInsId, deployId) {
|
||||
const that = this
|
||||
const params = {procInsId: procInsId, deployId: deployId}
|
||||
flowRecord(params).then(res => {
|
||||
this.flowRecordList = res.data.flowList;
|
||||
that.flowRecordList = res.data.flowList;
|
||||
// 流程过程中不存在初始化表单 直接读取的流程变量中存储的表单值
|
||||
if (res.data.formData) {
|
||||
this.formConf = res.data.formData;
|
||||
this.formConfOpen = true
|
||||
that.formConf = res.data.formData;
|
||||
that.formConfOpen = true
|
||||
}
|
||||
}).catch(res => {
|
||||
this.goBack();
|
||||
|
|
@ -403,7 +404,6 @@ export default {
|
|||
if (taskId) {
|
||||
// 提交流程申请时填写的表单存入了流程变量中后续任务处理时需要展示
|
||||
getProcessVariables(taskId).then(res => {
|
||||
// this.variables = res.data.variables;
|
||||
this.variablesData = res.data.variables;
|
||||
this.variableOpen = true
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue