feat(REQ-5965) - 调整待办发送时的变量获取方式

This commit is contained in:
wangli 2025-12-03 10:12:03 +08:00
parent 5172810fa5
commit 783d441a8d

View File

@ -40,6 +40,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CLOSE_PROCESS_ASSIG
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_ADVICE;
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_SPECIFY_NEXT_APPROVER;
import static cn.axzo.workflow.common.constant.BpmnConstants.PENDING_TEMPLATE_VARIABLE;
import static cn.axzo.workflow.common.constant.BpmnConstants.SIGNATURE_COLLECTION;
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
@ -161,6 +162,16 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
}
task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + taskId, APPROVED.getStatus());
Map<String, Object> pendingVariables = runtimeService.getVariable(task.getProcessInstanceId(), PENDING_TEMPLATE_VARIABLE, Map.class);
if (!CollectionUtils.isEmpty(pendingVariables) && !CollectionUtils.isEmpty(variables)) {
variables.forEach((k, v) -> {
if (pendingVariables.containsKey(k)) {
pendingVariables.put(k, v);
}
});
}
// 如果有待办模板变量则更新待办模板变量
variables.put(PENDING_TEMPLATE_VARIABLE, pendingVariables);
// 更新流程内的变量
runtimeService.setVariables(task.getProcessInstanceId(), variables);
// 记录电子签名的图片