|
|
@@ -44,9 +44,9 @@ public class QxybDataService {
|
|
|
private String snowQzkFile;
|
|
|
|
|
|
protected static OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(600, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(180, TimeUnit.SECONDS)
|
|
|
+ .connectTimeout(10, TimeUnit.SECONDS)
|
|
|
+ .readTimeout(10, TimeUnit.SECONDS)
|
|
|
+ .writeTimeout(10, TimeUnit.SECONDS)
|
|
|
.build();
|
|
|
protected static String RDField = "LCJDomain";
|
|
|
protected static String domain = "domain02";
|
|
|
@@ -428,6 +428,30 @@ public class QxybDataService {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ hoursForGridRain.forEach(hour -> {//网格流量与网格降水预报预见期一样
|
|
|
+ try {
|
|
|
+ String dt1 = hour.format(DATE_TIME_FORMATTER1);
|
|
|
+ String url2 = BASE_URL + "/getForecastHydroMatrixByWrfRDField?RDField=" + RDField + "&publishDT="
|
|
|
+ + publishInfo.getPublishDT() + "&ensemble="
|
|
|
+ + publishInfo.getEnsemble() + "&domain="
|
|
|
+ + domain + "&content=2mTC&DT1="
|
|
|
+ + dt1 + "&step=" + 1;
|
|
|
+ log.info("下载网格流量预报数据(小时尺度):{}", url2);
|
|
|
+ String result = getResult(url2);
|
|
|
+ writeFile(result, downloadFilePath + "FlowGrid," + publishInfo.getPublishDT()
|
|
|
+ + "," + dt1 + "," + 1 + "," + ensemble + ","
|
|
|
+ + System.currentTimeMillis() + ".json");
|
|
|
+ log.info("下载成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("下载失败", e);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Thread.sleep(100);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ // ignore...
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -454,12 +478,12 @@ public class QxybDataService {
|
|
|
response = client.newCall(request).execute();
|
|
|
result = response.body().string();
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
- String data = json.getString("data");
|
|
|
- if (data == null || "[]".equals(data) || "{}".equals(data)) {
|
|
|
- throw new RuntimeException("无有效数据");
|
|
|
- }
|
|
|
Integer code = json.getInteger("code");
|
|
|
if (code != null && code == 200) {
|
|
|
+ String data = json.getString("data");
|
|
|
+ if (data == null || "[]".equals(data) || "{}".equals(data)) {
|
|
|
+ throw new RuntimeException("无有效数据");
|
|
|
+ }
|
|
|
return result;
|
|
|
} else {
|
|
|
throw new RuntimeException(result);
|