package com.jianshui.invoiceall.factory;

import com.jianshui.invoiceall.service.IInvoiceAll;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * @Description 采集服务工厂类
 * @Author 巩权林
 * @Date 2022-03-25 14:57
 **/
@Service
public class IInvoceiAllServiceFactory {


    @Autowired
    private final Map<String, IInvoiceAll> servicesAuth = new ConcurrentHashMap<>();



    /**
     * 认证
     * @author xkng
     * @date 2022/9/20 17:40
     * @param key
     * @return com.jianshui.income.service.IAuthInvoice
     */
    public IInvoiceAll getService(String key) {
        IInvoiceAll requestService = servicesAuth.get(key);
        if (requestService == null) {
            throw new RuntimeException("未定义的请求方式 " + key);
        }

        return requestService;
    }
}
