package com.ruoyi.flowable.oa;

import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component("CallTechActivityExecutionListener")
public class CallTechActivityExecutionListener implements ExecutionListener {
    @Override
    public void notify(DelegateExecution delegateExecution) {
        Map<String, Object> variables = delegateExecution.getVariables();
        Authentication.setAuthenticatedUserId(variables.get("techInitiator").toString());
        delegateExecution.setVariableLocal("approval", variables.get("techInitiator"));
    }
}
