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.system.feign.RemoteAreaService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * RemoteAreaService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteAreaServiceFallback implements FallbackFactory<RemoteAreaService> {

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

        return new RemoteAreaService() {
            @Override
            public ResultBean<List<Long>> findAreaParentId(Long areaId) {
                return null;
            }
        };
    }
}
