首页 > 其他分享 >基于jeecgboot的flowable流程并行审批的bug修复

基于jeecgboot的flowable流程并行审批的bug修复

时间:2023-02-27 14:35:30浏览次数:33  
标签:taskVo flowable res taskService processInstanceId getId jeecgboot bug variablesD


        对于下面的并行流程,会出现流程错误,特别是下面角色的处理与一个任务节点多个用户处理问题,所以需要进行修复bug。

      1、后端处理

     设置下一个审批人员的时候需要对一个任务节点多个数据进行容错处理,对于要是用户最好选择不通的用户处理,以最后审批选择的人员为准。

/**
* 设置下一个审批人的操作
*
* @param taskVo
*/
private void taskSetAssignee(FlowTaskVo taskVo, FlowNextDto nextFlowNode) {
if(taskVo.getValues().containsKey("approval")) {//有approval
if(taskService.createTaskQuery().processInstanceId(taskVo.getInstanceId()).taskDefinitionKey(nextFlowNode.getUserTask().getId()).active().count() == 1) {//一个目标用户任务节点只能设置一次
Task nexttask = taskService.createTaskQuery().processInstanceId(taskVo.getInstanceId()).taskDefinitionKey(nextFlowNode.getUserTask().getId()).active().singleResult();
if(Objects.nonNull(nexttask)) {
String assignee = taskVo.getValues().get("approval").toString();
taskService.setAssignee(nexttask.getId(), assignee);
}
}
else {
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(taskVo.getInstanceId()).taskDefinitionKey(nextFlowNode.getUserTask().getId()).active();
for(Task task : taskQuery.list()) {
String assignee = taskVo.getValues().get("approval").toString();
taskService.setAssignee(task.getId(), assignee);
}
}
}
}

对于myProcessNew和allProcess的任务ID统一做下面处理

// 当前所处流程

List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
if (CollUtil.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());
}

2、前端处理

对于角色的处理,无论是多人还是单人都进行选择处理

else if (data.type === 'candidateUsers') { // 指定人员(多个)
this.userDataList = res.result.userList;
//console.log("candidateUsers nodeType,bmutiInstanceFinish=",this.taskForm.nodeType,this.taskForm.bmutiInstanceFinish)
if(this.userDataList.length===1) {
this.checkSendUser = true;
}

同时对下面的函数做出错提示

getProcessVariables(taskId).then(res => {
console.log("getProcessVariables res=",res);
// this.variables = res.result.variables;
if(res.success) {
if(res.result.hasOwnProperty('variables')) {
this.variablesData = res.result.variables;
console.log("this.variablesData=",this.variablesData)
this.variableOpen = true;
this.formViewData = JSON.stringify(this.variablesData);
this.formVal = JSON.stringify(this.variablesData.formValue);
this.taskForm.values = JSON.parse(this.formVal);
console.log("this.taskForm.values=",this.taskForm.values);
}
}
else {
this.$message.error(res.message);
}

3、具体的流程图如下:

基于jeecgboot的flowable流程并行审批的bug修复_流程图

标签:taskVo,flowable,res,taskService,processInstanceId,getId,jeecgboot,bug,variablesD
From: https://blog.51cto.com/u_15070324/6088482

相关文章