package cn.iocoder.yudao.module.bpm.handler;

import cn.iocoder.yudao.module.bpm.service.workovertime.WorkOvertimeService;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author : AiKai
 * @Description : 利用Spring的发现机制,将实现了IChannelLoginService的类都put到channelLoginServiceMap里面。
 * 后面只需要根据channelType对应好 各个实现类的注解 如： @Component("sys") 就可以取出不同的业务实现类
 **/
@Service
public class WorkOvertimeHandler {
    private final Map<String, WorkOvertimeService> workServiceMap = new ConcurrentHashMap<>();

    public WorkOvertimeHandler(Map<String, WorkOvertimeService> strategyMap) {
        this.workServiceMap.clear();
        strategyMap.forEach((k, v) -> this.workServiceMap.put(k, v));
    }

    public WorkOvertimeService getResource(String channelType) {
        return workServiceMap.get(channelType);
    }

}
