|
@@ -1,47 +0,0 @@
|
|
|
-package com.usky.agbox.factory;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.usky.agbox.RemotePatrolAgBoxService;
|
|
|
-import com.usky.common.core.exception.FeignBadRequestException;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.cloud.openfeign.FallbackFactory;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author han
|
|
|
- * @date 2024/04/02 15:07
|
|
|
- */
|
|
|
-@Component
|
|
|
-public class RemotePatrolAgBoxFallbackFactory implements FallbackFactory<RemotePatrolAgBoxService> {
|
|
|
- private static final Logger log = LoggerFactory.getLogger(RemotePatrolAgBoxFallbackFactory.class);
|
|
|
-
|
|
|
- @Override
|
|
|
- public RemotePatrolAgBoxService create(Throwable throwable)
|
|
|
- {
|
|
|
- log.error("agbox服务调用失败:{}", throwable.getMessage());
|
|
|
- return new RemotePatrolAgBoxService()
|
|
|
- {
|
|
|
- @Override
|
|
|
- public JSONObject getEventCode() {
|
|
|
- throw new FeignBadRequestException(500,"获取事件编码异常"+throwable.getMessage());
|
|
|
- }
|
|
|
- @Override
|
|
|
- public JSONObject getDeviceList() {
|
|
|
- throw new FeignBadRequestException(500,"获取设备列表异常"+throwable.getMessage());
|
|
|
- }
|
|
|
- @Override
|
|
|
- public JSONObject updateHeart(String requestBody) {
|
|
|
- throw new FeignBadRequestException(500,"更新心跳异常"+throwable.getMessage());
|
|
|
- }
|
|
|
- @Override
|
|
|
- public JSONObject addEvent(String requestBody) {
|
|
|
- throw new FeignBadRequestException(500,"添加事件异常"+throwable.getMessage());
|
|
|
- }
|
|
|
- @Override
|
|
|
- public JSONObject getEvent(String requestBody) {
|
|
|
- throw new FeignBadRequestException(500,"获取事件异常"+throwable.getMessage());
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
-}
|