TRX před 1 rokem
rodič
revize
fd30b34746

+ 1 - 1
src/main/java/com/github/microservice/models/hxz/base/IotBaseResult.java

@@ -20,7 +20,7 @@ import java.io.Serializable;
 public class IotBaseResult implements Serializable {
 
     @JsonProperty("Status")
-    // 1:成功; 0:失败
+    // 1:成功; 0:失败 -1: 支付中
     private int Status = 0;
 
     @JsonProperty("Msg")

+ 2 - 0
src/main/java/com/github/microservice/models/openAPI/RefreshApiParam.java

@@ -19,5 +19,7 @@ public class RefreshApiParam {
 
     private String apiType;
 
+    private Object apiDocs;
+
     private List<OpenApiInfo> openApiInfo;
 }

+ 1 - 0
src/main/java/com/github/microservice/models/type/DeviceType.java

@@ -10,6 +10,7 @@ public enum DeviceType {
     GateWay("网关"),
     Door("门禁机"),
     GateDoor("门闸"),
+    SmartLock("智能门锁"),
     Elevator("电梯"),
     ;
 

+ 27 - 0
src/main/java/com/github/microservice/utils/OpenAPIScan.java

@@ -126,4 +126,31 @@ public class OpenAPIScan {
         return openAPIS;
     }
 
+    public static JSONObject filterOpenApi(String str, String sign) {
+        if (StringUtils.isEmpty(sign)) {
+            sign = "openAPI";
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject = new JSONObject(str);
+            JSONObject schemas = new JSONObject();
+            if (jsonObject.containsKey("components")) {
+                schemas = jsonObject.getJSONObject("components").getJSONObject("schemas");
+            }
+            if (jsonObject.containsKey("paths")) {
+                JSONObject paths = jsonObject.getJSONObject("paths");
+                List<String> keys = List.of(paths.keySet().toArray(new String[0]));
+                for (String key : keys) {
+                    if (key.indexOf(sign) < 0) {
+                        paths.remove(key);
+                    }
+                }
+                jsonObject.set("paths", paths);
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        return jsonObject;
+    }
+
 }