package com.ard.work.api.factory; import com.ard.common.core.domain.R; import com.ard.work.api.RemoteRadarService; import com.ard.work.api.RemoteTubesService; import com.ard.work.api.domian.ArdRadar; import com.ard.work.api.domian.ArdTubes; import com.ard.work.api.domian.ArdTubesDetails; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; /** * 雷达服务降级处理 * * @author ard */ @Component public class RemoteRadarFallbackFactory implements FallbackFactory { private static final Logger log = LoggerFactory.getLogger(RemoteRadarFallbackFactory.class); @Override public RemoteRadarService create(Throwable throwable) { log.error("雷达服务调用失败:{}", throwable.getMessage()); return new RemoteRadarService() { @Override public R> listRpc(ArdRadar ardRadar, String source) { return R.fail(" 雷达管理列表:" + throwable.getMessage()); } @Override public R getInfoRpc(String id, String source) { return R.fail(" 雷达详情:" + throwable.getMessage()); } @Override public R editRpc(ArdRadar ardRadar, String source) { return R.fail(" 雷达修改:" + throwable.getMessage()); } }; } }