fix - 修复驳回功能导致卡片异常

This commit is contained in:
wangli 2025-12-11 15:38:52 +08:00
parent e6cb590f6a
commit 345f55898d

View File

@ -17,6 +17,8 @@ import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.HashMap;
@ -28,6 +30,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CLOSE_PROCESS_ASSIG
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PROCESS_FLAG;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_REJECT;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
import static cn.axzo.workflow.common.constant.BpmnConstants.SKIP_MQ;
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.DELETED;
@ -44,7 +47,7 @@ import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.validTask
* @since 2024/1/4 13:36
*/
public class CustomRejectionTaskCmd extends AbstractCommand<Void> implements Serializable {
private static final Logger log = LoggerFactory.getLogger(CustomRejectionTaskCmd.class);
private final String taskId;
private final String advice;
private String operationDesc;
@ -101,10 +104,13 @@ public class CustomRejectionTaskCmd extends AbstractCommand<Void> implements Ser
validTask(historicTaskInstance, task, approver, nodeTypes);
BpmnTaskDelegateAssigner originAssignee = BpmnTaskDelegateAssigner.toObjectCompatible(task.getVariable(INTERNAL_TASK_RELATION_ASSIGNEE_INFO + task.getId()));
log.info("origin assignee is : {}", JSON.toJSONString(originAssignee));
task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + task.getId(), DELETED.getStatus());
TaskEntity virtualTask = createVirtualTask(commandContext, extAxHiTaskInstService, task.getProcessInstanceId(), task.getName(),
task.getTaskDefinitionKey(), advice,
Objects.equals(operationDesc, "自动驳回") ? null : approver, REJECTED.getStatus(),
Objects.equals(operationDesc, "自动驳回") ? null : Objects.isNull(originAssignee) ? approver : originAssignee, REJECTED.getStatus(),
new AddComment(operationDesc));
virtualTask.setTransientVariable(SKIP_MQ, true);