package com.yn.bftl.thirdparty.modules.business.util;

import com.yn.bftl.common.modules.configuration.entity.ThirdPartyPaySet;
import com.yn.bftl.thirdparty.common.repository.ThirdPartyPaySetRepository;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 第三方配置工具类
 *
 * @author huabiao
 * @create 2023/7/8  15:14
 **/
@Component
public class ThirdPartyConfigUtil {

    @Resource
    private ThirdPartyPaySetRepository thirdPartyPaySetRepository;

    /***
     * 获取第三方平台配置
     *
     * @return ThirdPartyPaySet
     * @author huabiao
     * @ 2023/7/8  15:14
     */
    public ThirdPartyPaySet getPlatform() {
        return thirdPartyPaySetRepository.findFirstByCompanyIsNullOrderByIdDesc();
    }

    /**
     * 获取第三方企业配置
     *
     * @param companyId
     * @return ThirdPartyPaySet
     * @author huabiao
     * @create 2023/7/8  15:15
     */
    public ThirdPartyPaySet getCompany(Long companyId) {
        return thirdPartyPaySetRepository.findFirstByCompanyId(companyId);
    }
}
