package com.jianshui.income.factory;

import com.jianshui.income.domain.entity.IncomeInvoiceAuth;
import com.jianshui.income.service.IAuthInvoice;
import com.jianshui.income.service.IIncomeRequestService;
import com.jianshui.income.service.IIncomeResponseService;
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 10:43
 **/
@Service
public class IIncomeResponseFactory {

    @Autowired
    private final Map<String, IIncomeResponseService> services = new ConcurrentHashMap<>();

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


    public IIncomeResponseService getService(String key) {
        IIncomeResponseService requestService = services.get(key);
        if (requestService == null) {
            throw new RuntimeException("未定义的请求方式 " + key);
        }

        return requestService;
    }
}
