Ver código fonte

区间范围改成改成静态集合

menglu 3 anos atrás
pai
commit
e515e49ec2

+ 0 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/DaemonThread.java

@@ -275,15 +275,6 @@ public class DaemonThread extends Thread {
 				log.error(e.getMessage(), e);
 			}
 			log.warn("********************************" + "\t" + "refresh weather finish");
-			if (Constant.scaleplate_enable) {
-				log.warn("********************************" + "\t" + "refresh scaleplate start");
-				try {
-					RWDLoadUtil.Read_scaleplate(Repository);
-				} catch (Exception e) {
-					log.error(e.getMessage(), e);
-				}
-				log.warn("********************************" + "\t" + "refresh scaleplate finish");
-			}
 
 			try {
 				log.warn("********************************" + "\t" + "deamon start");

+ 1 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Constant.java

@@ -30,7 +30,7 @@ public class Constant {
 	public static boolean use_thread = true;
 	public static boolean enable_factor = true;
 	public static boolean clear_old_dir = true;
-	public static int print_status_times = 10;
+	public static int print_status_times = 0;
 
 	public static int compute_thread_count;
 	public static long compute_thread_sdv_interval;

+ 69 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

@@ -17,6 +17,7 @@ import com.persagy.ibms.core.util.FastJsonUtil;
 import com.persagy.ibms.core.util.FileUtil;
 import com.persagy.ibms.core.util.LogOfDownload;
 import com.persagy.ibms.core.util.LogUtil;
+import com.persagy.ibms.core.util.RWDUtil;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -170,6 +171,74 @@ public class RWDDownloadUtil {
 		}
 		FileUtil.Save(path + Constant.getSeperator() + "info-point-list" + ".json", FastJsonUtil.toFormatString(InfoPointListArray));
 		FileUtil.Save(path + Constant.getSeperator() + "info-point-relation" + ".json", FastJsonUtil.toFormatString(InfoPointRelationArray));
+
+		{
+			String[] typeCodes = { "tdb", "rH", "cO2", "cO", "pM2d5" };
+			{
+				JSONArray array = new JSONArray();
+				int value = 29;
+				for (String typeCode : typeCodes) {
+					JSONObject param = new JSONObject();
+					param.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
+					param.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+					param.put("typeCode", typeCode);
+					String post_result = HttpClientUtil.instance("scaleplate").post(Constant.scaleplate_url + "/listDyeScaleplateByType",
+							param.toJSONString());
+					JSONObject resultJSON = JSON.parseObject(post_result);
+					JSONArray content = (JSONArray) resultJSON.get("content");
+					for (int i = 0; i < content.size(); i++) {
+						JSONObject contentItem = content.getJSONObject(i);
+						String upperLimit = contentItem.getString("upperLimit");
+						String lowerLimit = contentItem.getString("lowerLimit");
+						JSONObject arrayItem = new JSONObject();
+						arrayItem.put("typeCode", typeCode);
+						arrayItem.put("id", contentItem.get("id"));
+						arrayItem.put("数值", value++);
+						arrayItem.put("名称", contentItem.get("name"));
+						arrayItem.put("颜色", contentItem.get("colorValue"));
+						arrayItem.put("上限", (upperLimit == null || upperLimit.length() == 0) ? null : Double.parseDouble(upperLimit));
+						arrayItem.put("下限", (lowerLimit == null || lowerLimit.length() == 0) ? null : Double.parseDouble(lowerLimit));
+						array.add(arrayItem);
+					}
+				}
+				FileUtil.Save(path + Constant.getSeperator() + "scaleplate" + ".json", FastJsonUtil.toFormatString(array));
+			}
+		}
+	}
+
+	public static void Read_scaleplate(RepositoryImpl Repository) throws Exception {
+		String[] typeCodes = { "tdb", "rH", "cO2", "cO", "pM2d5" };
+		{
+			JSONArray array = new JSONArray();
+			int value = 29;
+			for (String typeCode : typeCodes) {
+				JSONObject param = new JSONObject();
+				param.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
+				param.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+				param.put("typeCode", typeCode);
+				String post_result = HttpClientUtil.instance("scaleplate").post(Constant.scaleplate_url + "/listDyeScaleplateByType",
+						param.toJSONString());
+				JSONObject resultJSON = JSON.parseObject(post_result);
+				JSONArray content = (JSONArray) resultJSON.get("content");
+				for (int i = 0; i < content.size(); i++) {
+					JSONObject contentItem = content.getJSONObject(i);
+					String upperLimit = contentItem.getString("upperLimit");
+					String lowerLimit = contentItem.getString("lowerLimit");
+					JSONObject arrayItem = new JSONObject();
+					arrayItem.put("typeCode", typeCode);
+					arrayItem.put("id", contentItem.get("id"));
+					arrayItem.put("数值", value++);
+					arrayItem.put("名称", contentItem.get("name"));
+					arrayItem.put("颜色", contentItem.get("colorValue"));
+					arrayItem.put("上限", (upperLimit == null || upperLimit.length() == 0) ? null : Double.parseDouble(upperLimit));
+					arrayItem.put("下限", (lowerLimit == null || lowerLimit.length() == 0) ? null : Double.parseDouble(lowerLimit));
+					array.add(arrayItem);
+				}
+			}
+			FileUtil.Save("tmp-" + "scaleplate" + ".json", FastJsonUtil.toFormatString(array));
+			Repository.scaleplate.set = RWDUtil.array2SDOList(array);
+			Repository.addWaitCompute(Repository.scaleplate);
+		}
 	}
 
 	public static boolean Process_physical_world(LogOfDownload LogOfDownload) throws Exception {

+ 6 - 40
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -975,16 +975,16 @@ public class RWDLoadUtil {
 		{
 			JSONArray classArray = FastJsonReaderUtil.Instance()
 					.ReadJSONArray(new File(validPath + Constant.getSeperator() + "info-point-list.json"));
-			SceneDataSet SceneDataSet = new SceneDataSet(false, "info-point-list");
-			SceneDataSet.set = RWDUtil.array2SDOList(classArray);
-			Repository.InfoPointListArray = SceneDataSet;
+			Repository.InfoPointListArray.set = RWDUtil.array2SDOList(classArray);
 		}
 		{
 			JSONArray classArray = FastJsonReaderUtil.Instance()
 					.ReadJSONArray(new File(validPath + Constant.getSeperator() + "info-point-relation.json"));
-			SceneDataSet SceneDataSet = new SceneDataSet(false, "info-point-relation");
-			SceneDataSet.set = RWDUtil.array2SDOList(classArray);
-			Repository.InfoPointRelationArray = SceneDataSet;
+			Repository.InfoPointRelationArray.set = RWDUtil.array2SDOList(classArray);
+		}
+		{
+			JSONArray classArray = FastJsonReaderUtil.Instance().ReadJSONArray(new File(validPath + Constant.getSeperator() + "scaleplate.json"));
+			Repository.scaleplate.set = RWDUtil.array2SDOList(classArray);
 		}
 	}
 
@@ -1212,38 +1212,4 @@ public class RWDLoadUtil {
 		}
 	}
 
-	public static void Read_scaleplate(RepositoryImpl Repository) throws Exception {
-		String[] typeCodes = { "tdb", "rH", "cO2", "cO", "pM2d5" };
-		{
-			JSONArray array = new JSONArray();
-			int value = 29;
-			for (String typeCode : typeCodes) {
-				JSONObject param = new JSONObject();
-				param.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
-				param.put("projectId", RepositoryContainer.RepositoryProject.projectId);
-				param.put("typeCode", typeCode);
-				String post_result = HttpClientUtil.instance("scaleplate").post(Constant.scaleplate_url + "/listDyeScaleplateByType",
-						param.toJSONString());
-				JSONObject resultJSON = JSON.parseObject(post_result);
-				JSONArray content = (JSONArray) resultJSON.get("content");
-				for (int i = 0; i < content.size(); i++) {
-					JSONObject contentItem = content.getJSONObject(i);
-					String upperLimit = contentItem.getString("upperLimit");
-					String lowerLimit = contentItem.getString("lowerLimit");
-					JSONObject arrayItem = new JSONObject();
-					arrayItem.put("typeCode", typeCode);
-					arrayItem.put("id", contentItem.get("id"));
-					arrayItem.put("数值", value++);
-					arrayItem.put("名称", contentItem.get("name"));
-					arrayItem.put("颜色", contentItem.get("colorValue"));
-					arrayItem.put("上限", (upperLimit == null || upperLimit.length() == 0) ? null : Double.parseDouble(upperLimit));
-					arrayItem.put("下限", (lowerLimit == null || lowerLimit.length() == 0) ? null : Double.parseDouble(lowerLimit));
-					array.add(arrayItem);
-				}
-			}
-			FileUtil.Save("tmp-" + "scaleplate" + ".json", FastJsonUtil.toFormatString(array));
-			Repository.scaleplate.set = RWDUtil.array2SDOList(array);
-			Repository.addWaitCompute(Repository.scaleplate);
-		}
-	}
 }

+ 0 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDRepositoryUtil.java

@@ -122,15 +122,6 @@ public class RWDRepositoryUtil {
 			log.error(e.getMessage(), e);
 		}
 		log.warn("********************************" + "\t" + "refresh weather finish");
-		if (Constant.scaleplate_enable) {
-			log.warn("********************************" + "\t" + "refresh scaleplate start");
-			try {
-				RWDLoadUtil.Read_scaleplate(Repository);
-			} catch (Exception e) {
-				log.error(e.getMessage(), e);
-			}
-			log.warn("********************************" + "\t" + "refresh scaleplate finish");
-		}
 
 		try {
 			log.warn("********************************" + "\t" + "deamon start");

+ 4 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryImpl.java

@@ -69,14 +69,14 @@ public class RepositoryImpl extends RepositoryBase {
 	public Map<String, Map<String, SceneDataSet>> IBMSArrayDic = new ConcurrentHashMap<String, Map<String, SceneDataSet>>();
 
 	// 信息点
-	public SceneDataSet InfoPointListArray = new SceneDataSet(false);
-	public SceneDataSet InfoPointRelationArray = new SceneDataSet(false);
+	public SceneDataSet InfoPointListArray = new SceneDataSet(false, "info-point-list");
+	public SceneDataSet InfoPointRelationArray = new SceneDataSet(false, "info-point-relation");
+	public SceneDataSet scaleplate = new SceneDataSet(false, "scaleplate");
 
 	// 日历模式:周期性刷新,不需要拷贝
 	public SceneDataSet IBMSCalendarModel = new SceneDataSet(false, true);
 	public SceneDataSet IBMSCalendarBinding = new SceneDataSet(false, true);
 	public SceneDataSet weather = new SceneDataSet(false, true);
-	public SceneDataSet scaleplate = new SceneDataSet(false, true);
 
 	public RepositoryImpl(RepositoryProject RepositoryProject, boolean use_thread, boolean enable_factor, int thread_count,
 			long interval_between_compute) {
@@ -118,6 +118,7 @@ public class RepositoryImpl extends RepositoryBase {
 
 		this.InfoPointListArray = RepositoryContainer.instance.InfoPointListArray;
 		this.InfoPointRelationArray = RepositoryContainer.instance.InfoPointRelationArray;
+		this.scaleplate = RepositoryContainer.instance.scaleplate;
 	}
 
 	public ConcurrentHashMap<SceneDataPrimitive, String> sdv2point() {