|
@@ -195,8 +195,8 @@ public class GetWeatherGeovisearth {
|
|
|
String xmoUrl;
|
|
|
String location = d.getLng() + "," + d.getLat();
|
|
|
//xmo综合数据查询
|
|
|
- url = "https://api.open.geovisearth.com/v2/cn/city/basic?token="+token+"&location=" + location + "&yesterday=false";
|
|
|
- url120 = "https://api.open.geovisearth.com/v2/cn/hourly/professional?token="+token+"&location=" + location;
|
|
|
+ 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; // 检查标志变量
|
|
@@ -204,8 +204,8 @@ public class GetWeatherGeovisearth {
|
|
|
for (DistrictCodeDO q : quList) {
|
|
|
if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
location = q.getLng() + "," + q.getLat();
|
|
|
- url = "https://api.open.geovisearth.com/v2/cn/city/basic?token="+token+"&location=" + location + "&yesterday=false";
|
|
|
- url120 = "https://api.open.geovisearth.com/v2/cn/hourly/professional?token="+token+"&location=" + location;
|
|
|
+ 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; // 检查标志变量
|
|
@@ -217,8 +217,8 @@ public class GetWeatherGeovisearth {
|
|
|
//2025-07-18 新增 甘肃库里 powerstation表里场站的经纬度也获取数据, td表的tag是场站编号而不是地区编号
|
|
|
for (DistrictCodeDO d : districtCodeDOList1) {
|
|
|
String location = d.getLng() + "," + d.getLat();
|
|
|
- String url = "https://api.open.geovisearth.com/v2/cn/city/basic?token="+token+"&location=" + location + "&yesterday=false";
|
|
|
- String url120 = "https://api.open.geovisearth.com/v2/precision_grid/forecast/day?start=" + getNowDateString() + "&end=" + getSevenDaysLater() + "&token="+token+"&meteCodes=ws_day,ws_night,wd_day,wd_night&location=" + location;
|
|
|
+ String url = "https://api.open.geovisearth.com/v2/cn/city/professional?token=" + token + "&location=" + location + "&yesterday=false";
|
|
|
+ String url120 = "https://api.open.geovisearth.com/v2/cn/hourly/professional?token=" + token + "&location=" + location;
|
|
|
String 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;
|
|
|
if (isApiQuotaExhausted) break; // 检查标志变量
|
|
|
isApiQuotaExhausted = analysisGeovisearth(url, url120, xmoUrl, d.getCode(), d.getName(), conn); // 传递标志变量
|
|
@@ -286,26 +286,22 @@ public class GetWeatherGeovisearth {
|
|
|
List<HeFengDay> heFengDay120List = new ArrayList<>();
|
|
|
List<HeFengDay> xmoList = new ArrayList<>();
|
|
|
//数据结果是16天 D-1 到 D+14
|
|
|
- if (datas.size() == 15) {
|
|
|
- for (int i = 0; i < datas.size(); i++) {
|
|
|
- JSONObject data = (JSONObject) datas.get(i);
|
|
|
- HeFengDay heFengDay = new HeFengDay();
|
|
|
- heFengDay.setTs(convertStringToTimestamp(data.get("fc_time").toString()));
|
|
|
- heFengDay.setTextDay(data.get("wp_day").toString());
|
|
|
- heFengDay.setTextNight(data.get("wp_night").toString());
|
|
|
- heFengDay.setTempMax(Float.parseFloat(data.get("tem_max").toString()));
|
|
|
- heFengDay.setTempMin(Float.parseFloat(data.get("tem_min").toString()));
|
|
|
- //heFengDay.setWindDirDay(data.get("wd_day").toString());
|
|
|
- //heFengDay.setWindDirNight(data.get("wd_night").toString());
|
|
|
- /*heFengDay.setWindScaleDay(extractLevel(data.get("ws_day").toString()));
|
|
|
- heFengDay.setWindScaleNight(extractLevel(data.get("ws_night").toString()));*/
|
|
|
- heFengDay.setPrecip(Integer.parseInt(data.get("rh_max").toString()));
|
|
|
- heFengDay.setPressure(Integer.parseInt(data.get("prs").toString()));
|
|
|
- heFengDay.setHumidity(Float.parseFloat(data.get("pre_day").toString()) + Float.parseFloat(data.get("pre_night").toString()));
|
|
|
- heFengDayList.add(heFengDay);
|
|
|
- }
|
|
|
- } else {
|
|
|
- log.info("{} 的星图日数据不足15天,不入库!", name);
|
|
|
+ for (int i = 0; i < datas.size(); i++) {
|
|
|
+ JSONObject data = (JSONObject) datas.get(i);
|
|
|
+ HeFengDay heFengDay = new HeFengDay();
|
|
|
+ heFengDay.setTs(convertStringToTimestamp(data.get("fc_time").toString()));
|
|
|
+ heFengDay.setTextDay(data.get("wp_day").toString());
|
|
|
+ heFengDay.setTextNight(data.get("wp_night").toString());
|
|
|
+ heFengDay.setTempMax(Float.parseFloat(data.get("tem_max").toString()));
|
|
|
+ heFengDay.setTempMin(Float.parseFloat(data.get("tem_min").toString()));
|
|
|
+ heFengDay.setWindDirDay(data.get("wd_day").toString());
|
|
|
+ heFengDay.setWindDirNight(data.get("wd_night").toString());
|
|
|
+ heFengDay.setWindScaleDay(extractLevel(data.get("ws_day").toString()));
|
|
|
+ heFengDay.setWindScaleNight(extractLevel(data.get("ws_night").toString()));
|
|
|
+ heFengDay.setPrecip(Integer.parseInt(data.get("rh_max").toString()));
|
|
|
+ heFengDay.setPressure(Integer.parseInt(data.get("prs").toString()));
|
|
|
+ heFengDay.setHumidity(Float.parseFloat(data.get("pre_day").toString()) + Float.parseFloat(data.get("pre_night").toString()));
|
|
|
+ heFengDayList.add(heFengDay);
|
|
|
}
|
|
|
if (datas120.size() == 120) {
|
|
|
for (int i = 0; i < datas120.size(); i++) {
|
|
@@ -495,6 +491,8 @@ public class GetWeatherGeovisearth {
|
|
|
existing.setWindSpeedMNight(item.getWindSpeedMNight());
|
|
|
existing.setWind360Day(item.getWind360Day());
|
|
|
existing.setWind360Night(item.getWind360Night());
|
|
|
+ existing.setWindScaleDay(item.getWindScaleDay());
|
|
|
+ existing.setWindScaleNight(item.getWindScaleNight());
|
|
|
} else {
|
|
|
mergedMap.put(date, item);
|
|
|
}
|