package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.EduDeptFunction;
import com.yida.data.system.feign.RemoteDeptFunctionService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteDeptFunctionService fallback处理类
 *
 * @author ZYJ
 * @date 2023/2/21
 */
@Slf4j
@Fallback
public class RemoteDeptFunctionServiceFallback implements FallbackFactory<RemoteDeptFunctionService> {

    @Override
    public RemoteDeptFunctionService create(Throwable throwable) {
        log.error("RemoteDeptFunctionService fallback reason:{}", throwable.getMessage());

        return new RemoteDeptFunctionService() {
            @Override
            public ResultBean<EduDeptFunction> getDeptFunction(String functionName, Long deptId) {
                return null;
            }
        };
    }
}
