package com.ard.work.api.factory; import com.ard.common.core.domain.R; import com.ard.common.core.web.domain.AjaxResult; import com.ard.work.api.RemoteCameraService; import com.ard.work.api.RemoteChannelService; import com.ard.work.api.domian.ArdCamera; import com.ard.work.api.domian.ArdChannel; import com.ard.work.api.domian.CameraCmd; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; import java.util.List; import java.util.TreeMap; /** * 通道服务降级处理 * * @author ard */ @Component public class RemoteChannelFallbackFactory implements FallbackFactory { private static final Logger log = LoggerFactory.getLogger(RemoteChannelFallbackFactory.class); @Override public RemoteChannelService create(Throwable throwable) { log.error("相机服务调用失败:{}", throwable.getMessage()); return new RemoteChannelService() { @Override public R> list(ArdChannel ardChannel, String source) { return R.fail("获取通道列表失败:" + throwable.getMessage()); } @Override public R getInfo(String id, String source) { return R.fail("获取通道信息失败:" + throwable.getMessage()); } @Override public R> queryByIds(List startChannelIdList, String inner) { return R.fail("获取通道列表失败:" + throwable.getMessage()); } @Override public R update(ArdChannel ardChannel, String source) { return R.fail("更新通道失败:" + throwable.getMessage()); } }; } }