fix: 重新分发驳回后提交自动结束主流程BUG

This commit is contained in:
2024-07-19 20:08:26 +08:00
parent 0ee1bf2e83
commit 8a62fd4a12
@@ -26,7 +26,6 @@ import com.jero.modules.activiti.service.ProcessNodeService;
import com.jero.modules.activiti.util.SpringContextUtil;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
@@ -430,8 +429,7 @@ public class MyGlobalEventListener implements ActivitiEventListener {
if (childCount == 0){
// 子流程都结束并且没有未分发数据才完成父任务
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
RuntimeService runtimeService = SpringContextUtil.getBean(RuntimeService.class);
int unallocatedQuantity = (int) runtimeService.getVariable(mainInstanceId, UNALLOCATED_QUANTITY);
int unallocatedQuantity = (int) taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
if (unallocatedQuantity == 0){
taskService.complete(parentTaskId);
}
@@ -440,8 +438,7 @@ public class MyGlobalEventListener implements ActivitiEventListener {
if (i == 0) {
// 子流程都结束并且没有未分发数据才完成父任务
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
RuntimeService runtimeService = SpringContextUtil.getBean(RuntimeService.class);
int unallocatedQuantity = (int) runtimeService.getVariable(mainInstanceId, UNALLOCATED_QUANTITY);
int unallocatedQuantity = (int) taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
if (unallocatedQuantity == 0){
taskService.complete(parentTaskId);
}