package com.sptg.permissions.api.feigns.fallback;

import com.sptg.permissions.api.entity.Street;
import com.sptg.permissions.api.feigns.StreetFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created By lidexi in 2020/12/23
 * 全国街道--对外服务容错处理
 **/
@Slf4j
@Component
public class StreetFeignFallbackFactory implements FallbackFactory<StreetFeign> {

    @Override
    public StreetFeign create(Throwable throwable) {
        return new StreetFeign() {
            @Override
            public List<Street> getStreetList(String areaCode) {
                return new ArrayList<>(0);
            }

            @Override
            public Street getStreetDetail(String streetCode) {
                return null;
            }
        };
    }
}
