|
@@ -224,6 +224,37 @@ public class GetWeatherGeovisearth {
|
|
|
isApiQuotaExhausted = analysisGeovisearth(url, url120, xmoUrl, d.getCode(), d.getName(), conn); // 传递标志变量
|
|
|
if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
+ List<DistrictCodeDO> shiList = districtCodeDOList.stream().filter(item -> item.getPid().toString().equals(code)).collect(Collectors.toList());
|
|
|
+ //市
|
|
|
+ for (DistrictCodeDO d : shiList) {
|
|
|
+ if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
+ List<DistrictCodeDO> quList = districtCodeDOList.stream().filter(item -> item.getPid().toString().equals(d.getCode())).collect(Collectors.toList());
|
|
|
+ String url;
|
|
|
+ String url120;
|
|
|
+ String xmoUrl;
|
|
|
+ String location = d.getLng() + "," + d.getLat();
|
|
|
+ //xmo综合数据查询
|
|
|
+ url = "https://api.open.geovisearth.com/v2/cn/city/professional?token=" + token + "&location=" + location + "&yesterday=false";
|
|
|
+ url120 = "https://api.open.geovisearth.com/v2/cn/hourly/professional?token=" + token + "&location=" + location;
|
|
|
+ xmoUrl = "https://weather-api.xm-opt.com/v1/forecastDaily?latitude=" + d.getLat() + "&longitude=" + d.getLng() + "&daily=wind_speed_10m_max,shortwave_radiation_sum&timezone=Asia%2FShanghai&start_date=" + startDate + "&end_date=" + endDate;
|
|
|
+ isApiQuotaExhausted = analysisGeovisearth(url, url120, xmoUrl, d.getCode(), d.getName(), conn); // 传递标志变量
|
|
|
+ if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
+ //区
|
|
|
+ for (DistrictCodeDO q : quList) {
|
|
|
+ if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
+ location = q.getLng() + "," + q.getLat();
|
|
|
+ url = "https://api.open.geovisearth.com/v2/cn/city/professional?token=" + token + "&location=" + location + "&yesterday=false";
|
|
|
+ url120 = "https://api.open.geovisearth.com/v2/cn/hourly/professional?token=" + token + "&location=" + location;
|
|
|
+ xmoUrl = "https://weather-api.xm-opt.com/v1/forecastDaily?latitude=" + q.getLat() + "&longitude=" + q.getLng() + "&daily=wind_speed_10m_max,shortwave_radiation_sum&timezone=Asia%2FShanghai&start_date=" + startDate + "&end_date=" + endDate;
|
|
|
+ isApiQuotaExhausted = analysisGeovisearth(url, url120, xmoUrl, q.getCode(), q.getName(), conn); // 传递标志变量
|
|
|
+ if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
+ //线程睡5秒 防止请求过快
|
|
|
+ //花钱了 硬气 不管他
|
|
|
+ //Thread.sleep(5000);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
conn.close();
|
|
@@ -524,6 +555,7 @@ public class GetWeatherGeovisearth {
|
|
|
+ item.getTs() + "', " + item.getWindSpeedDay() + ", " + item.getWindSpeedMDay() + ", " + item.getWindScaleDay() + ", " + item.getWindScaleNight() + ", " + item.getWind360Day() + ", " + item.getWind360Night() + ", "
|
|
|
+ item.getPrecip() + ", '" + item.getTextDay() + "', '" + item.getTextNight() + "', " + item.getTempMax() + ", " + item.getTempMin() + ", " + item.getHumidity() + ", " + item.getPressure() + ", "
|
|
|
+ item.getDswrf() + ")";
|
|
|
+ //log.info(name+"数据时间"+DateUtil.format(new Date(item.getTs().getTime()),"yyyy-MM-dd HH:mm:ss"));
|
|
|
int affectedRows = ps.executeUpdate(insertSQL);
|
|
|
}
|
|
|
if (ps != null)
|