fix: 流程流转BUG
This commit is contained in:
+8
-30
@@ -19,7 +19,6 @@ import com.jero.modules.activiti.enums.CommitFlagEnum;
|
||||
import com.jero.modules.activiti.enums.FinishFlagEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessStatusEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
import com.jero.modules.activiti.process.standardinterpret.common.StandardInterpretCommon;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeService;
|
||||
@@ -411,37 +410,16 @@ public class MyGlobalEventListener implements ActivitiEventListener {
|
||||
String parentTaskId = (String) execution.getVariable(ActivitiCommon.PARENT_TASK_ID);
|
||||
if (StringUtils.isNotBlank(parentTaskId)) {
|
||||
int i = processAllService.countByParentTaskId(parentTaskId);
|
||||
|
||||
// 判断当前parentTaskId是否是第一个子流程 解读人填写信息节点的parentTaskId
|
||||
ProcessApprovalRecordService processApprovalRecordService = SpringContextUtil.getBean(ProcessApprovalRecordService.class);
|
||||
int count = processApprovalRecordService.count(
|
||||
new LambdaQueryWrapper<ProcessApprovalRecord>()
|
||||
.eq(ProcessApprovalRecord::getProcessInstanceId, processInstanceId)
|
||||
.eq(ProcessApprovalRecord::getNodeId, StandardInterpretCommon.INTERPRETING_PEOPLE_FILLOUT)
|
||||
.eq(ProcessApprovalRecord::getParentTaskId, parentTaskId));
|
||||
if (count > 0){
|
||||
// 判断子流程是否还有未完成的节点
|
||||
int childCount = processApprovalRecordService.count(
|
||||
new LambdaQueryWrapper<ProcessApprovalRecord>()
|
||||
.eq(ProcessApprovalRecord::getProcessInstanceId, processInstanceId)
|
||||
.isNotNull(ProcessApprovalRecord::getParentTaskId)
|
||||
.eq(ProcessApprovalRecord::getFinishFlag, FinishFlagEnum.INCOMPLETE.getValue()));
|
||||
if (childCount == 0){
|
||||
// 子流程都结束并且没有未分发数据才完成父任务
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
int unallocatedQuantity = (int) taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
|
||||
if (unallocatedQuantity == 0){
|
||||
taskService.complete(parentTaskId);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (i == 0) {
|
||||
// 子流程都结束并且没有未分发数据才完成父任务
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
int unallocatedQuantity = (int) taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
|
||||
if (unallocatedQuantity == 0){
|
||||
if (i == 0) {
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
Object variable = taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
|
||||
if (variable != null) {
|
||||
int unallocatedQuantity = (int) variable;
|
||||
if (unallocatedQuantity == 0) {
|
||||
taskService.complete(parentTaskId);
|
||||
}
|
||||
} else {
|
||||
taskService.complete(parentTaskId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user