Browse Source

二级编组忘了刷新,添加

menglu 3 years ago
parent
commit
55899b75e9

+ 14 - 6
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/RefreshThread.java

@@ -32,7 +32,7 @@ public class RefreshThread extends Thread {
 		try {
 			this.join();
 		} catch (InterruptedException e) {
-			log.error(e.getMessage(),e);
+			log.error(e.getMessage(), e);
 		}
 	}
 
@@ -41,7 +41,7 @@ public class RefreshThread extends Thread {
 			try {
 				Thread.sleep(1000L);
 			} catch (InterruptedException e) {
-				log.error(e.getMessage(),e);
+				log.error(e.getMessage(), e);
 			}
 
 			if (RepositoryContainer.RepositoryBase.compute_finish) {
@@ -52,11 +52,12 @@ public class RefreshThread extends Thread {
 		Date last_refresh_config = null;
 		Date last_refresh_physical_world = null;
 		Date last_refresh_zkt_physical_world = null;
+		Date last_refresh_ibms_physical_world = null;
 		while (!stop) {
 			try {
 				Thread.sleep(1000L);
 			} catch (InterruptedException e) {
-				log.error(e.getMessage(),e);
+				log.error(e.getMessage(), e);
 			}
 
 			Date currTime = new Date();
@@ -82,17 +83,24 @@ public class RefreshThread extends Thread {
 					}
 					last_refresh_zkt_physical_world = currTime;
 				}
-				if (changed_config || changed_physical_world || changed_zkt_physical_world) {
+				boolean changed_ibms_physical_world = false;
+				if (last_refresh_ibms_physical_world == null || currTime.getTime() - last_refresh_ibms_physical_world.getTime() > 1000L * 60 * 60) {
+					if (Constant.ibms_physical_world_enable && Constant.ibms_physical_world_refresh_enable) {
+						changed_ibms_physical_world = RWDDownloadUtil.Process_ibms_physical_world();
+					}
+					last_refresh_ibms_physical_world = currTime;
+				}
+				if (changed_config || changed_physical_world || changed_zkt_physical_world || changed_ibms_physical_world) {
 					log.warn("recompute begin");
 					RepositoryImpl Repository = new RepositoryImpl();
 					Repository.use_thread = !Constant.debug;
 					Repository.RepositoryBase = RepositoryContainer.RepositoryBase;
-					RWDRepositoryUtil.DoRepository(Repository, changed_physical_world || changed_zkt_physical_world);
+					RWDRepositoryUtil.DoRepository(Repository, changed_physical_world || changed_zkt_physical_world || changed_ibms_physical_world);
 					RepositoryContainer.instance = Repository;
 					log.warn("recompute finish");
 				}
 			} catch (Exception e) {
-				log.error(e.getMessage(),e);
+				log.error(e.getMessage(), e);
 			}
 		}
 	}

+ 1 - 1
ibms-data-sdk/src/main/resources/config.xml

@@ -8,7 +8,7 @@
 	<rwd url="http://192.168.100.33:9976/" />
 	<physical_world path="D-physical_world" refresh_enable="true" />
 	<zkt_physical_world path="D-zkt_physical_world" enable="true" refresh_enable="true" />
-	<ibms_physical_world path="D-ibms_physical_world" enable="true" refresh_enable="false" />
+	<ibms_physical_world path="D-ibms_physical_world" enable="true" refresh_enable="true" />
 	<!-- zkt-monitor的服务地址 -->
 	<zkt_monitor url="http://192.168.100.33:9909/zkt-monitor/" />
 	<zkt_control url="http://192.168.100.33:9909/zkt-control/" />