修复获取路径预测流程执行结束导致报错问题

This commit is contained in:
yangqicheng 2024-07-02 10:41:37 +08:00
parent 8326f878e5
commit d8f428150c

View File

@ -10,6 +10,7 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.flowable.bpmn.model.CustomProperty;
import org.flowable.bpmn.model.ServiceTask;
import org.flowable.common.engine.impl.interceptor.Command;
@ -33,6 +34,7 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_INITIATOR;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_ASSIGNEE;
@ -45,6 +47,7 @@ import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.removeDup
* @author wangli
* @since 18/03/2024 11:33
*/
@Slf4j
public class CustomCarbonCopyUserSelectorCmd implements Command<List<BpmnTaskDelegateAssigner>>, Serializable {
private static final long serialVersionUID = 1L;
@ -97,6 +100,17 @@ public class CustomCarbonCopyUserSelectorCmd implements Command<List<BpmnTaskDel
} else {
executions.add((Execution) execution);
}
//流程为空表示已经执行完去历史版本获取
if (CollectionUtils.isEmpty(executions)) {
List<HistoricVariableInstance> hisVarInst = processEngineConfiguration.getHistoryService().createHistoricVariableInstanceQuery()
.processInstanceId(processInstanceId)
.variableName(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + serviceTask.getId()).list();
if (!CollectionUtils.isEmpty(hisVarInst)) {
return (List<BpmnTaskDelegateAssigner>) hisVarInst.get(0).getValue();
}
log.warn("executions is empty,get historic task assigner list empty,processInstanceId: {},serviceTaskId: {}", processInstanceId, serviceTask.getId());
return Collections.emptyList();
}
List<BpmnTaskDelegateAssigner> assigners = new ArrayList<>();
carbons.forEach(carbon -> {
CarbonCopyObjectType carbonCopyObjectType = carbon.getCarbonCopyObjectType();