TRX 1 年間 前
コミット
f3509e312f

+ 1 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/config/OpenAPIConfig.java

@@ -1,6 +1,6 @@
 package com.zhongshu.iot.server.core.config;
 
-import com.zhongshu.gateway.client.config.OpenApiGatewayClientConfiguration;
+import com.zhongshu.opengateway.client.config.OpenApiGatewayClientConfiguration;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 

+ 11 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/controller/TestController.java

@@ -2,6 +2,7 @@ package com.zhongshu.iot.server.core.controller;
 
 import com.zhongshu.iot.client.model.mqtt.SendMessageModel;
 import com.zhongshu.iot.server.core.service.artemis.OperationMessageService;
+import com.zhongshu.iot.server.core.service.openApi.OpenAPIRegisterService;
 import com.zhongshu.iot.server.core.service.other.ScanExecuteService;
 import com.zhongshu.iot.server.core.util.result.ResultContent;
 import io.swagger.v3.oas.annotations.Operation;
@@ -28,6 +29,9 @@ public class TestController {
     @Autowired
     ScanExecuteService scanExecuteService;
 
+    @Autowired
+    OpenAPIRegisterService openAPIRegisterService;
+
     @Operation(summary = "发送指令")
     @RequestMapping(value = "free/sendMessage", method = {RequestMethod.POST})
     public ResultContent sendMessage(@RequestBody SendMessageModel param) {
@@ -47,5 +51,12 @@ public class TestController {
         return ResultContent.buildSuccess();
     }
 
+    @Operation(summary = "同步API")
+    @RequestMapping(value = "initRegisterPAIS", method = {RequestMethod.GET})
+    public ResultContent initRegisterPAIS() {
+        openAPIRegisterService.initRegisterPAIS();
+        return ResultContent.buildSuccess();
+    }
+
 }
 

+ 2 - 3
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/controller/openAPi/IotSendApiController.java

@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author TRX
  * @date 2024/3/21
  */
-@RequestMapping("/openAPI/manager/sendMessage")
+@RequestMapping("/oitOpenAPI/manager")
 @RestController
 @Validated
 @Tag(name = "物模型-调用服务")
@@ -32,9 +32,8 @@ public class IotSendApiController {
     @Autowired
     IotSendMessageService iotSendMessageService;
 
-    @Operation(summary = "下发消息")
+    @Operation(summary = "下发消息", description = "下发消息")
     @RequestMapping(value = "/sendIotMessage", method = {RequestMethod.POST})
-    @Hidden
     public ResultContent sendIotMessageFree(@RequestBody @Valid IotSendParam param) {
         return iotSendMessageService.sendIotMessage(param);
     }

+ 5 - 5
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/openApi/OpenAPIRegisterService.java

@@ -4,7 +4,7 @@ import com.github.microservice.models.openAPI.OpenApiInfo;
 import com.github.microservice.models.openAPI.RefreshApiParam;
 import com.github.microservice.net.ResultContent;
 import com.github.microservice.utils.OpenAPIScan;
-import com.zhongshu.gateway.client.type.ApiType;
+import com.zhongshu.opengateway.client.type.ApiType;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -31,14 +31,14 @@ public class OpenAPIRegisterService {
 
     public ResultContent initRegisterPAIS() {
         String str = restTemplate.getForObject("http://" + serviceId + "/v3/api-docs", String.class);
-        List<OpenApiInfo> openAPIS = OpenAPIScan.scanAPI(str, "物联网");
+        String sign = "oitOpenAPI";
+        List<OpenApiInfo> openAPIS = OpenAPIScan.scanAPI(str, "物联网", sign);
         RefreshApiParam param = new RefreshApiParam();
         param.setServerName(serviceId.toLowerCase());
-        param.setPredicateArgs("/openAPI/**");
+        param.setPredicateArgs(String.format("/%s/**", sign));
         param.setOpenApiInfo(openAPIS);
         param.setApiType(ApiType.IOT.name());
-
-        ResultContent content = restTemplate.postForObject("http://openapiserver/openapi/manager/api/refresh", param, ResultContent.class);
+        ResultContent content = restTemplate.postForObject("http://openapiserver-wjf/manager/apiManager/refresh", param, ResultContent.class);
         if (content == null) {
             content = ResultContent.buildSuccess();
         }