Commit dabd903f authored by wujiang's avatar wujiang

修改部盾采集

parent e9d326ee
...@@ -135,18 +135,19 @@ public class LargeScreenImpl { ...@@ -135,18 +135,19 @@ public class LargeScreenImpl {
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info; String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter); LocalDate yesterday = currentDate.minusDays(1);
String formattedDate = yesterday.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate, JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate,
Constants.REQUEST_GET, "", Constants.resovleRule_data); Constants.REQUEST_GET, "", Constants.resovleRule_data);
if (data != null) { if (data != null) {
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据 // // 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) { // if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
// 计算昨天日期 // // 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1); // LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter); // formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate, // data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate,
Constants.REQUEST_GET, "", Constants.resovleRule_data); // Constants.REQUEST_GET, "", Constants.resovleRule_data);
} // }
mapdta.put("SS", data.getDouble("average_wind_speed")); mapdta.put("SS", data.getDouble("average_wind_speed"));
mapdta.put("ZFS", data.getDouble("avg_irradiance")); mapdta.put("ZFS", data.getDouble("avg_irradiance"));
mapdta.put("ZFSLJ", data.getDouble("sum_irradiance")); mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
...@@ -243,7 +244,7 @@ public class LargeScreenImpl { ...@@ -243,7 +244,7 @@ public class LargeScreenImpl {
} }
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
@PostConstruct //@PostConstruct
private void sendQYYXZBMqtt() { private void sendQYYXZBMqtt() {
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream() Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream()
...@@ -406,7 +407,8 @@ public class LargeScreenImpl { ...@@ -406,7 +407,8 @@ public class LargeScreenImpl {
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info; String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter); LocalDate yesterday = currentDate.minusDays(1);
String formattedDate = yesterday.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s, JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s,
Constants.REQUEST_GET, "", Constants.resovleRule_data); Constants.REQUEST_GET, "", Constants.resovleRule_data);
DecimalFormat df = new DecimalFormat("#.0000"); DecimalFormat df = new DecimalFormat("#.0000");
...@@ -430,13 +432,13 @@ public class LargeScreenImpl { ...@@ -430,13 +432,13 @@ public class LargeScreenImpl {
} }
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据 // 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) { // if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
// 计算昨天日期 // // 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1); // LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter); // formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate+"&code="+s, Constants.REQUEST_GET, // data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate+"&code="+s, Constants.REQUEST_GET,
"", Constants.resovleRule_data); // "", Constants.resovleRule_data);
} // }
mapdta.put("SS", data.getString("average_wind_speed")); mapdta.put("SS", data.getString("average_wind_speed"));
mapdta.put("ZFS", data.getString("avg_irradiance")); mapdta.put("ZFS", data.getString("avg_irradiance"));
mapdta.put("ZFSLJ", data.getString("sum_irradiance")); mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
......
...@@ -1110,7 +1110,8 @@ public class MonitoringServiceImpl { ...@@ -1110,7 +1110,8 @@ public class MonitoringServiceImpl {
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info; String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter); LocalDate yesterday = currentDate.minusDays(1);
String formattedDate = yesterday.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "", JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
Constants.resovleRule_data); Constants.resovleRule_data);
DecimalFormat df = new DecimalFormat("#.0000"); DecimalFormat df = new DecimalFormat("#.0000");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment