Kaynağa Gözat

Merge branch 'han' into server-165
hebingchongtu

hanzhengyi 1 yıl önce
ebeveyn
işleme
74db970d07

+ 0 - 56
service-agbox/service-agbox-api/src/main/java/com/usky/agbox/RemotepatrolAgboxService.java

@@ -1,56 +0,0 @@
-package com.usky.agbox;
-
-import com.alibaba.fastjson.JSONObject;
-import com.usky.agbox.factory.RemotePatrolAgBoxFallbackFactory;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
-/**
- * @author han
- * @date 2024/04/02 15:07
- */
-@FeignClient(contextId = "remotePatrolAgBoxService", value = "service-agbox", fallbackFactory =
-        RemotePatrolAgBoxFallbackFactory.class)
-public interface RemotePatrolAgBoxService {
-    /**
-     * 获得事件编码
-     *
-     * @return 事件编码数组
-     */
-    @GetMapping("/getEventCode")
-    JSONObject getEventCode();
-
-    /**
-     * 获取设备列表信息
-     *
-     * @return 设备列表数组
-     */
-    @GetMapping("/getDeviceList")
-    JSONObject getDeviceList();
-
-    /**
-     * 更新心跳信息
-     *
-     * @return 更新结果
-     */
-    @PostMapping("/updateHeart")
-    JSONObject updateHeart(@RequestBody String requestBody);
-
-    /**
-     * 添加事件信息
-     *
-     * @return 添加结果
-     */
-    @PostMapping("/addEvent")
-    JSONObject addEvent(@RequestBody String requestBody);
-
-    /**
-     * 获取事件信息
-     *
-     * @return 事件信息数组
-     */
-    @PostMapping("/getEvent")
-    JSONObject getEvent(@RequestBody String requestBody);
-}

+ 0 - 47
service-agbox/service-agbox-api/src/main/java/com/usky/agbox/factory/RemotepatrolAgboxFallbackFactory.java

@@ -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());
-            }
-        };
-    }
-}