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<RemoteChannelService>
|
{
|
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>> list(ArdChannel ardChannel, String source) {
|
return R.fail("获取通道列表失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<ArdChannel> getInfo(String id, String source) {
|
return R.fail("获取通道信息失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<List<ArdChannel>> queryByIds(List<String> startChannelIdList, String inner) {
|
return R.fail("获取通道列表失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<Boolean> update(ArdChannel ardChannel, String source) {
|
return R.fail("更新通道失败:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|