|
@@ -1100,4 +1100,109 @@ public class RWDLoadUtil {
|
|
|
Repository.IBMSCalendarBinding.set = RWDUtil.array2SDOList(arrayToday);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static void LoadWeather(RepositoryImpl Repository) throws Exception {
|
|
|
+ {
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ for (String key : Constant.weather_nowMap.keySet()) {
|
|
|
+ Map<String, String> oneMap = Constant.weather_nowMap.get(key);
|
|
|
+ String dataType = oneMap.get("dataType");
|
|
|
+ String info_code = oneMap.get("info_code");
|
|
|
+ String name = oneMap.get("name");
|
|
|
+ String unit = oneMap.get("unit");
|
|
|
+ JSONObject info = new JSONObject();
|
|
|
+ info.put("code", info_code);
|
|
|
+ info.put("name", name);
|
|
|
+ info.put("category", "SEQUENTIAL");
|
|
|
+ info.put("firstTag", "运行参数");
|
|
|
+ info.put("dataType", dataType);
|
|
|
+ info.put("unit", unit);
|
|
|
+ array.add(info);
|
|
|
+ }
|
|
|
+ for (String key : Constant.weather_forecastMap.keySet()) {
|
|
|
+ Map<String, String> oneMap = Constant.weather_forecastMap.get(key);
|
|
|
+ String dataType = oneMap.get("dataType");
|
|
|
+ String info_code = oneMap.get("info_code");
|
|
|
+ String name = oneMap.get("name");
|
|
|
+ String unit = oneMap.get("unit");
|
|
|
+ JSONObject info = new JSONObject();
|
|
|
+ info.put("code", info_code);
|
|
|
+ info.put("name", name);
|
|
|
+ info.put("category", "SEQUENTIAL");
|
|
|
+ info.put("firstTag", "运行参数");
|
|
|
+ info.put("dataType", dataType);
|
|
|
+ info.put("unit", unit);
|
|
|
+ array.add(info);
|
|
|
+ }
|
|
|
+ SceneDataSet SceneDataSet = new SceneDataSet(false);
|
|
|
+ SceneDataSet.set = RWDUtil.array2SDOList(array);
|
|
|
+ Repository.infoArrayDic.put("weather", SceneDataSet);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cityCode = RepositoryContainer.RepositoryProject.projectId.substring(2, 8);
|
|
|
+ {
|
|
|
+ JSONObject arrayItem = new JSONObject();
|
|
|
+ {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("cityCode", cityCode);
|
|
|
+ param.put("dataType", "all");
|
|
|
+ String post_result = HttpClientUtil.instance("weather")
|
|
|
+ .post(Constant.weather_url + "/Spring/MVC/entrance/unifierJson/NowWeatherQuery", param.toJSONString());
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ JSONArray content = (JSONArray) resultJSON.get("content");
|
|
|
+ if (content.size() > 0) {
|
|
|
+ JSONObject contentItem = content.getJSONObject(0);
|
|
|
+ for (String key : Constant.weather_nowMap.keySet()) {
|
|
|
+ Object value = contentItem.get(key);
|
|
|
+ if (value instanceof String) {
|
|
|
+ String valueString = (String) value;
|
|
|
+ Map<String, String> oneMap = Constant.weather_nowMap.get(key);
|
|
|
+ String dataType = oneMap.get("dataType");
|
|
|
+ if (dataType.equals("INTEGER")) {
|
|
|
+ arrayItem.put(key, Long.parseLong(valueString));
|
|
|
+ } else if (dataType.equals("DOUBLE")) {
|
|
|
+ arrayItem.put(key, Double.parseDouble(valueString));
|
|
|
+ } else {
|
|
|
+ arrayItem.put(key, valueString);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ arrayItem.put(key, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("cityCode", cityCode);
|
|
|
+ param.put("dataType", "all");
|
|
|
+ String post_result = HttpClientUtil.instance("weather").post(Constant.weather_url + "/Spring/MVC/entrance/unifierJson/DayForecast",
|
|
|
+ param.toJSONString());
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ JSONArray content = (JSONArray) resultJSON.get("content");
|
|
|
+ if (content.size() > 0) {
|
|
|
+ JSONObject contentItem = content.getJSONObject(0);
|
|
|
+ for (String key : Constant.weather_forecastMap.keySet()) {
|
|
|
+ Object value = contentItem.get(key);
|
|
|
+ if (value instanceof String) {
|
|
|
+ String valueString = (String) value;
|
|
|
+ Map<String, String> oneMap = Constant.weather_forecastMap.get(key);
|
|
|
+ String dataType = oneMap.get("dataType");
|
|
|
+ if (dataType.equals("INTEGER")) {
|
|
|
+ arrayItem.put(key, Long.parseLong(valueString));
|
|
|
+ } else if (dataType.equals("DOUBLE")) {
|
|
|
+ arrayItem.put(key, Double.parseDouble(valueString));
|
|
|
+ } else {
|
|
|
+ arrayItem.put(key, valueString);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ arrayItem.put(key, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ array.add(arrayItem);
|
|
|
+ Repository.weather.set = RWDUtil.array2SDOList(array);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|