Browse Source

更新!

TRX 1 year ago
parent
commit
ce18110af8

+ 2 - 6
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/controller/iot/openAPI/IotThingOpenAPIController.java

@@ -1,13 +1,12 @@
 package com.zhongshu.iot.server.core.controller.iot.openAPI;
 
-import com.github.microservice.auth.security.annotations.ResourceAuth;
-import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.busInfoModel.thing.IotThing2DeviceModel;
 import com.github.microservice.busInfoModel.thing.IotThing2DeviceSearch;
 import com.github.microservice.busInfoModel.thing.IotThingModel;
 import com.github.microservice.busInfoModel.thing.IotThingSearch;
 import com.github.microservice.models.baseParam.IDParam;
 import com.github.microservice.net.ResultContent;
+import com.github.microservice.staticVariable.OpenApiMark;
 import com.zhongshu.iot.server.core.service.iot.IotThing2DeviceService;
 import com.zhongshu.iot.server.core.service.iot.IotThingService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -29,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author TRX
  * @date 2024/3/21
  */
-@RequestMapping("/iotOpenAPI/manager/v1/thing")
+@RequestMapping("/" + OpenApiMark.iotOpenAPI + "/manager/v1/thing")
 @RestController
 @Validated
 @Tag(name = "物模型-物模型管理")
@@ -41,7 +40,6 @@ public class IotThingOpenAPIController {
     @Autowired
     private IotThing2DeviceService iotThing2DeviceService;
 
-    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "物模型列表-分页查询")
     @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
     public ResultContent<Page<IotThingModel>> page(
@@ -50,7 +48,6 @@ public class IotThingOpenAPIController {
         return iotThingService.page(pageable, param);
     }
 
-    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "物模型详情")
     @RequestMapping(value = "getDetail", method = {RequestMethod.POST})
     public ResultContent getDetail(@RequestBody IDParam param) {
@@ -59,7 +56,6 @@ public class IotThingOpenAPIController {
 
     //--------------------------------物模型设备信息 start-----------------
 
-    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "物模型设备列表-分页查询")
     @RequestMapping(value = {"pageDevice"}, method = {RequestMethod.POST})
     public ResultContent<Page<IotThing2DeviceModel>> pageDevice(

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

@@ -1,6 +1,7 @@
 package com.zhongshu.iot.server.core.controller.openAPi;
 
 import com.github.microservice.net.ResultContent;
+import com.github.microservice.staticVariable.OpenApiMark;
 import com.zhongshu.iot.client.model.iot.IotMainSearch;
 import com.zhongshu.iot.client.model.mqtt.DeviceInfoSearchParam;
 import com.zhongshu.iot.client.openApi.base.DeviceIdParam;
@@ -26,7 +27,7 @@ import java.util.List;
  * @author TRX
  * @date 2024/11/11
  */
-@RequestMapping("/iotOpenAPI/manager/v1/devices")
+@RequestMapping("/" + OpenApiMark.iotOpenAPI + "/manager/v1/devices")
 @RestController
 @Validated
 @Tag(name = "设备管理-开放接口")

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

@@ -1,13 +1,9 @@
 package com.zhongshu.iot.server.core.controller.openAPi;
 
-import com.github.microservice.auth.security.annotations.ResourceAuth;
-import com.github.microservice.auth.security.helper.AuthHelper;
-import com.github.microservice.auth.security.type.AuthType;
-import com.github.microservice.models.iot.IotSendGateWayParam;
 import com.github.microservice.models.iot.IotSendParam;
-import com.zhongshu.iot.server.core.service.iot.IotSendMessageService;
 import com.github.microservice.net.ResultContent;
-import io.swagger.v3.oas.annotations.Hidden;
+import com.github.microservice.staticVariable.OpenApiMark;
+import com.zhongshu.iot.server.core.service.iot.IotSendMessageService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.validation.Valid;
@@ -24,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author TRX
  * @date 2024/3/21
  */
-@RequestMapping("/iotOpenAPI/v1")
+@RequestMapping("/" + OpenApiMark.iotOpenAPI + "/v1")
 @RestController
 @Validated
 @Tag(name = "物模型-调用服务")

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

@@ -3,6 +3,7 @@ package com.zhongshu.iot.server.core.service.openApi;
 import com.github.microservice.models.openAPI.OpenApiInfo;
 import com.github.microservice.models.openAPI.RefreshApiParam;
 import com.github.microservice.net.ResultContent;
+import com.github.microservice.staticVariable.OpenApiMark;
 import com.github.microservice.utils.OpenAPIScan;
 import com.zhongshu.opengateway.client.type.ApiType;
 import lombok.extern.slf4j.Slf4j;
@@ -31,11 +32,10 @@ public class OpenAPIRegisterService {
 
     public ResultContent initRegisterPAIS() {
         String str = restTemplate.getForObject("http://" + serviceId + "/v3/api-docs", String.class);
-        String sign = "iotOpenAPI";
-        List<OpenApiInfo> openAPIS = OpenAPIScan.scanAPI(str, "物联网", sign);
+        List<OpenApiInfo> openAPIS = OpenAPIScan.scanAPI(str, "物联网", OpenApiMark.iotOpenAPI);
         RefreshApiParam param = new RefreshApiParam();
         param.setServerName(serviceId.toLowerCase());
-        param.setPredicateArgs(String.format("/%s/**", sign));
+        param.setPredicateArgs(String.format("/%s/**", OpenApiMark.iotOpenAPI));
         param.setOpenApiInfo(openAPIS);
         param.setApiType(ApiType.IOT.name());
         ResultContent content = restTemplate.postForObject("http://openapiserver/manager/gateway/api/refresh", param, ResultContent.class);