|
@@ -8,11 +8,11 @@ import javax.annotation.PostConstruct;
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import com.persagy.ibms.data.sdk.util.RepositoryContainer;
|
|
|
import com.persagy.ibms.data.sdk.util.Constant;
|
|
|
import com.persagy.ibms.data.sdk.util.FileUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.RWDDownloadUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.RWDRepositoryUtil;
|
|
|
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
|
|
|
import com.persagy.ibms.data.sdk.util.RepositoryImpl;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -36,8 +36,6 @@ public class RefreshThread extends Thread {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
-
|
|
|
public void run() {
|
|
|
while (true) {
|
|
|
try {
|
|
@@ -72,7 +70,7 @@ public class RefreshThread extends Thread {
|
|
|
boolean changed_physical_world = false;
|
|
|
if (last_refresh_physical_world == null || currTime.getTime() - last_refresh_physical_world.getTime() > 1000L * 60 * 60) {
|
|
|
if (Constant.physical_world_download_enable) {
|
|
|
- changed_physical_world = this.Process_physical_world();
|
|
|
+ changed_physical_world = RWDDownloadUtil.Process_physical_world();
|
|
|
}
|
|
|
last_refresh_physical_world = currTime;
|
|
|
}
|
|
@@ -91,6 +89,7 @@ public class RefreshThread extends Thread {
|
|
|
}
|
|
|
|
|
|
private boolean Process_config() throws Exception {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
String validPath = Constant.getLatestPath(Constant.config, false);
|
|
|
File valid = new File(validPath);
|
|
|
|
|
@@ -107,39 +106,4 @@ public class RefreshThread extends Thread {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private boolean Process_physical_world() throws Exception {
|
|
|
- String validPath = Constant.getLatestPath(Constant.physical_world, true);
|
|
|
- // 存储临时文件
|
|
|
- File dir1;
|
|
|
- {
|
|
|
- String tmpPath = Constant.physical_world + Constant.getSeperator() + "tmp1";
|
|
|
- dir1 = new File(tmpPath);
|
|
|
- RWDDownloadUtil.LoadPhysicalWorld(tmpPath);
|
|
|
- }
|
|
|
- File dir2;
|
|
|
- {
|
|
|
- String tmpPath = Constant.physical_world + Constant.getSeperator() + "tmp2";
|
|
|
- dir2 = new File(tmpPath);
|
|
|
- RWDDownloadUtil.LoadPhysicalWorld(tmpPath);
|
|
|
- }
|
|
|
- // 检查一致性
|
|
|
- boolean compare = FileUtil.compareRecursive(dir1, dir2);
|
|
|
- log.debug("Compare tmp1" + (compare ? "==" : "!=") + "tmp2");
|
|
|
- if (compare) {
|
|
|
- File valid = new File(validPath);
|
|
|
- boolean compare_valid = FileUtil.compareRecursive(valid, dir2);
|
|
|
- log.debug("Compare valid" + (compare_valid ? "==" : "!=") + "tmp2");
|
|
|
- if (compare_valid) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- // 移动tmp2
|
|
|
- Date currTime = new Date();
|
|
|
- dir2.renameTo(new File(Constant.physical_world + Constant.getSeperator() + sdf.format(currTime)));
|
|
|
- return true;
|
|
|
- }
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
}
|