TRX 1 سال پیش
والد
کامیت
93403011cf

+ 4 - 0
src/main/java/com/github/microservice/models/iot/IotSendParam.java

@@ -1,6 +1,7 @@
 package com.github.microservice.models.iot;
 
 import cn.hutool.json.JSONObject;
+import com.github.microservice.types.FunctionType;
 import io.swagger.v3.oas.annotations.Hidden;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotEmpty;
@@ -27,6 +28,9 @@ public class IotSendParam {
     @Hidden
     private String userId;
 
+    @Schema(description = "功能类型,属性 事件 服务")
+    private FunctionType functionType;
+
     @Schema(description = "标识符,如:ConsumTransactions")
     @NotEmpty(message = "identifier不能为空")
     private String identifier;

+ 20 - 0
src/main/java/com/github/microservice/types/FunctionType.java

@@ -0,0 +1,20 @@
+package com.github.microservice.types;
+
+import lombok.Getter;
+
+/**
+ * 功能类型
+ */
+public enum FunctionType {
+    Attribute("属性"),
+    Event("事件"),
+    Server("服务"),
+    ;
+
+    @Getter
+    private String remark;
+
+    FunctionType(String remark) {
+        this.remark = remark;
+    }
+}

+ 6 - 2
src/main/java/com/github/microservice/utils/OpenAPIScan.java

@@ -16,7 +16,10 @@ import java.util.List;
 @Slf4j
 public class OpenAPIScan {
 
-    public static List<OpenApiInfo> scanAPI(String str, String groupName) {
+    public static List<OpenApiInfo> scanAPI(String str, String groupName, String sign) {
+        if (StringUtils.isEmpty(sign)) {
+            sign = "openAPI";
+        }
         List<OpenApiInfo> openAPIS = new ArrayList<>();
         try {
             JSONObject jsonObject = new JSONObject(str);
@@ -29,8 +32,9 @@ public class OpenAPIScan {
                 JSONObject paths = jsonObject.getJSONObject("paths");
                 JSONObject finalSchemas = schemas;
 
+                String finalSign = sign;
                 paths.keySet().forEach(key -> {
-                    if (key.indexOf("openAPI") >= 0) {
+                    if (key.indexOf(finalSign) >= 0) {
                         log.info("key; {}", key);
                         JSONObject tempObj = paths.getJSONObject(key);
                         String method = "";