Prechádzať zdrojové kódy

add 设置网桥初始值

18339543638 4 rokov pred
rodič
commit
6f7278e957

+ 34 - 0
jetlinks-manager/bridge-manager/src/main/java/org/jetlinks/community/bridge/entity/AliIotBridgeEntity.java

@@ -18,6 +18,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.sql.JDBCType;
+import java.util.Objects;
 
 /**
  * @author lifang
@@ -120,5 +121,38 @@ public class AliIotBridgeEntity extends GenericEntity<String>  implements Record
         private String version;
         @NotNull
         private String iotInstanceId;
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            AccessConfig that = (AccessConfig) o;
+            return getProductKey().equals(that.getProductKey()) &&
+                getHttp2Endpoint().equals(that.getHttp2Endpoint()) &&
+                getAuthEndpoint().equals(that.getAuthEndpoint()) &&
+                getRegionId().equals(that.getRegionId()) &&
+                getAccessKey().equals(that.getAccessKey()) &&
+                getAccessSecret().equals(that.getAccessSecret()) &&
+                getIotInstanceId().equals(that.getIotInstanceId());
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(getProductKey(), getHttp2Endpoint(), getAuthEndpoint(), getRegionId(), getAccessKey(), getAccessSecret(), getVersion(), getIotInstanceId());
+        }
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        AliIotBridgeEntity that = (AliIotBridgeEntity) o;
+        return Objects.equals(getAccessConfig(), that.getAccessConfig()) &&
+            Objects.equals(getId(), that.getId());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(getAccessConfig(), getNodeId());
     }
 }

+ 3 - 0
jetlinks-manager/bridge-manager/src/main/java/org/jetlinks/community/bridge/server/aliyun/AliBridgeServer.java

@@ -141,6 +141,9 @@ public class AliBridgeServer extends AbstractClusterUniqueTask<AliBridgeServer>
     }
 
     public Mono<AliBridgeServer> refreshBootStrap(AliIotBridgeEntity params,boolean broadcast){
+        if(this.params.equals(params)){
+            return Mono.just(this);
+        }
         if (this.bootstrap!=null) {
             try {
                 this.bootstrap.disconnectBridge();