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.domian.ArdCamera; 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 org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.TreeMap; /** * 相机服务降级处理 * * @author ard */ @Component public class RemoteCameraFallbackFactory implements FallbackFactory { private static final Logger log = LoggerFactory.getLogger(RemoteCameraFallbackFactory.class); @Override public RemoteCameraService create(Throwable throwable) { log.error("相机服务调用失败:{}", throwable.getMessage()); return new RemoteCameraService() { @Override public R> getAllCamera(String source) { return R.fail("获取全部相机失败:" + throwable.getMessage()); } @Override public R> getAllCameraRpc(ArdCamera ardCamera,String source) { return R.fail("获取全部相机失败:" + throwable.getMessage()); } @Override public R getCameraInfoRpc(String id,String source) { return R.fail("获取相机详情失败:" + throwable.getMessage()); } @Override public R> getNearbyCamerasRpc(CameraCmd cmd, String source) { return R.fail("获取附近的相机:" + throwable.getMessage()); } @Override public R setPTZLockRpc( CameraCmd cmd, String source) { return R.fail("设置锁定相机:" + throwable.getMessage()); } @Override public R getCameraByRadar(String radarId, String source) { return R.fail("获取雷达所在塔上的大光电:" + throwable.getMessage()); } @Override public R getCameraByName(String name, String source) { return R.fail("通过名称获取相机:" + throwable.getMessage()); } @Override public R updateCamera(ArdCamera camera, String source) { return R.fail("更新相机:" + throwable.getMessage()); } @Override public R updateCameraLocationAndYaw(String cameraId, Double longitude, Double latitude, Double altitude, Float baseYaw, String source) { return R.fail("更新坐标和基座偏航角失败:" + throwable.getMessage()); } }; } }