feat(REQ-4468) - 调整提级审批引起的一系列问题
This commit is contained in:
parent
9deee985b8
commit
8862c62bca
@ -141,7 +141,7 @@ public class BpmnTaskDelegateAssigner extends BaseBpmnTaskDelegateAssigner imple
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public BpmnTaskDelegateAssigner(String assignee, String assigneeType, String assignerName, String personId, String tenantId, String ouId, String avatar, String nodeId) {
|
||||
public BpmnTaskDelegateAssigner(String assignee, String assigneeType, String assignerName, String personId, String tenantId) {
|
||||
this.assignerName = assignerName;
|
||||
this.personId = personId;
|
||||
this.tenantId = tenantId;
|
||||
|
||||
@ -4,6 +4,8 @@ import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.AttachmentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnModelUtils;
|
||||
import cn.axzo.workflow.core.common.utils.SpringContextUtils;
|
||||
import cn.axzo.workflow.core.service.support.FlowNodeForecastService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -13,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.FlowNode;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
@ -31,6 +34,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.BACK_NODE_CANNOT_REACHABLE;
|
||||
@ -146,7 +150,8 @@ public class CustomBackTaskCmd extends AbstractCommand<Void> implements Serializ
|
||||
task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + task.getId(), BACKED.getStatus());
|
||||
});
|
||||
// 移除回退到的指定节点的变量,让 EngineExecutionStartListener 重新计算该节点的人
|
||||
runtimeService.removeVariable(processInstanceId, INTERNAL_TASK_RELATION_ASSIGNEE_LIST_INFO + toActivityId);
|
||||
List<String> removeActivityIds = collectorThoughtFlowElement(processInstanceId, toActivityId, currentActivityId, true);
|
||||
runtimeService.removeVariables(processInstanceId, removeActivityIds.stream().map(i -> INTERNAL_TASK_RELATION_ASSIGNEE_LIST_INFO + i).collect(Collectors.toList()));
|
||||
runtimeService.createChangeActivityStateBuilder()
|
||||
.processInstanceId(processInstanceId)
|
||||
.moveActivityIdsToSingleActivityId(Collections.singletonList(currentActivityId), toActivityId)
|
||||
@ -154,6 +159,22 @@ public class CustomBackTaskCmd extends AbstractCommand<Void> implements Serializ
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> collectorThoughtFlowElement(String processInstanceId, String startActivityId, String currentActivityId, Boolean containsStart) {
|
||||
FlowNodeForecastService forecastService = SpringContextUtils.getBean(FlowNodeForecastService.class);
|
||||
List<FlowElement> flowElements = forecastService.performProcessForecasting(processInstanceId, null, startActivityId, containsStart);
|
||||
AtomicBoolean flag = new AtomicBoolean(true);
|
||||
return flowElements.stream()
|
||||
.map(FlowElement::getId)
|
||||
.filter(id -> StringUtils.startsWithIgnoreCase(id, "node_"))
|
||||
.filter(id -> {
|
||||
if (Objects.equals(id, currentActivityId) && flag.get()) {
|
||||
flag.set(false);
|
||||
return true;
|
||||
}
|
||||
return flag.get();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
@ -118,7 +118,7 @@ public class CustomResetTaskApproversCmd extends AbstractCommand<Void> implement
|
||||
|
||||
CustomTaskHelper.deleteMultiTasks(commandContext, tasks);
|
||||
// 移除引擎内部用于确定人的快照变量
|
||||
runtimeService.removeVariables(taskEntity.getProcessInstanceId(), variables.keySet());
|
||||
// runtimeService.removeVariables(taskEntity.getProcessInstanceId(), variables.keySet());
|
||||
}
|
||||
|
||||
private void resolveOriginTask(CommandContext commandContext, TaskService taskService, TaskEntity task) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user