package com.ruoyi.api.invest.factory;

import com.ruoyi.api.invest.RemoteInvestService;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteInvestFallbackFactory implements FallbackFactory<RemoteInvestService>
{
    private static final Logger log = LoggerFactory.getLogger(com.ruoyi.api.invest.factory.RemoteInvestFallbackFactory.class);

    @Override
    public RemoteInvestService create(Throwable throwable)
    {
        log.error("投资服务调用失败:{}", throwable.getMessage());
        return new RemoteInvestService()
        {

            @Override
            public R generateUnpaidCreditBillTask() {
                return R.fail("投资服务调用生成未出信用卡账单数据失败");
            }

            @Override
            public R updateUnpaidInstallmentDataTask() {
                return R.fail("投资服务调用更新未出信用卡分期账单入账数据失败");
            }

        };
    }
}
