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;

@DubboService
public class ITradeConfigServiceProvider implements ITradeConfigServiceApi {

    @Autowired
    private IBdTradeConfigService iBdTradeConfigService;
    @Autowired
    private IBdTradeWhiteConfigService iBdTradeWhiteConfigService;
    @Autowired
    private ICuMemberTransferWhiteService iCuMemberTransferWhiteService;

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

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

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

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

}
