package com.engine.recruit.wrapper;


import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.recruit.factory.RecruitButtonFactory;
import com.engine.recruit.service.RecruitButtonService;
import weaver.general.Util;
import weaver.hrm.User;

import java.util.Map;

/**
 * <p>聚才林招聘</p>
 *
 * @author:dxfeng
 * @createTime: 2023/09/18
 * @version: 1.0
 */
public class RecruitButtonWrapper extends Service {

    /**
     * 根据类全路径，获取对应的实现类
     *
     * @param user      当前用户
     * @param classPath 类全路径
     * @return
     */
    private RecruitButtonService getRecruitButtonService(User user, String classPath) {
        return ServiceUtil.getService(RecruitButtonFactory.getClass(classPath), user);
    }

    /**
     * 执行对应实现类的方法
     *
     * @param params 参数集合
     */
    public Map<String, Object> execute(Map<String, Object> params) {
        // 获取实现类全路径
        String buttonKey = Util.null2String(params.get("buttonKey"));
        return getRecruitButtonService(user, buttonKey).execute(params);
    }
}
