package com.hzs.system.config.provider;

import cn.hutool.core.bean.BeanUtil;
import com.hzs.common.core.domain.R;
import com.hzs.common.domain.system.config.BdTradeConfig;
import com.hzs.common.domain.system.config.BdTradeWhiteConfig;
import com.hzs.system.config.ITradeConfigServiceApi;
import com.hzs.system.config.dto.TradeConfigDTO;
import com.hzs.system.config.service.IBdTradeConfigService;
import com.hzs.system.config.service.IBdTradeWhiteConfigService;
import com.hzs.system.config.service.ICuMemberTransferWhiteService;
import com.hzs.system.config.vo.BdTradeConfigVO;
import com.hzs.system.config.vo.BdTradeWhiteConfigVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Description:
 * @Author: ljc
 * @Time: 2023/8/21 15:10
 * @Classname: ITradeConfigServiceProvider
 * @Package_name: com.hzs.system.config.provider
 */
@DubboService
public class ITradeConfigServiceProvider implements ITradeConfigServiceApi {
    @Autowired
    private IBdTradeConfigService bdTradeConfigService;


    @Autowired
    private IBdTradeWhiteConfigService bdTradeWhiteConfigService;


    @Autowired
    private ICuMemberTransferWhiteService cuMemberTransferWhiteService;

    @Override
    public R<BdTradeConfig> selectTradeConfigByCondition(TradeConfigDTO tradeConfigDTO) {
        return R.ok(bdTradeConfigService.selectTradeConfigByCondition(BeanUtil.copyProperties(tradeConfigDTO, BdTradeConfigVO.class)));
    }

    @Override
    public R<BdTradeWhiteConfig> selectTradeWhiteConfigByCondition(TradeConfigDTO tradeConfigDTO) {
        return R.ok(bdTradeWhiteConfigService.selectTradeWhiteConfigByCondition(BeanUtil.copyProperties(tradeConfigDTO, BdTradeWhiteConfigVO.class)));
    }


    @Override
    public R<List<Integer>> selectTransferWhiteByPkMember(Long pkMember, Integer pkCountry) {
        return R.ok(cuMemberTransferWhiteService.selectTransferWhiteByPkMember(pkMember, pkCountry));
    }


    @Override
    public R<List<Long>> selectTradeWhiteConfigByUnderBlood(TradeConfigDTO tradeConfigDTO) {
        return R.ok(bdTradeWhiteConfigService.selectTradeWhiteConfigByUnderBlood(BeanUtil.copyProperties(tradeConfigDTO, BdTradeWhiteConfigVO.class)));
    }

}
