From af2ff6353abb09500ff08293490446a4d40d8e87 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Fri, 31 Jul 2020 17:03:19 +0800 Subject: [PATCH] 更换天气预测接口,根据城市名获取预测与实测数据对比 --- src/main/java/com/moral/controller/ScreenController.java | 40 +++++++++++++++++++++++++++++++++++----- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index f42bc29..a0149a3 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -77,11 +77,13 @@ import com.moral.util.TempAllocationUtils; import com.moral.util.mapUtils; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import net.sf.json.JSONString; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.net.ftp.FTPClient; @@ -723,8 +725,8 @@ String time = map.get("time").toString(); time = time.substring(time.length() - 2); map.put("time", Integer.valueOf(time)); - if(parameters.get("type").equals("day")){ - map.put("time", Integer.valueOf(time)+1); + if (parameters.get("type").equals("day")) { + map.put("time", Integer.valueOf(time) + 1); } map.put("value", map.remove(sensorKey)); } @@ -1927,8 +1929,8 @@ if (minAngle > (Double) longAndLatiList.get(j).get("angle")) { minAngle = (Double) longAndLatiList.get(j).get("angle"); indexAngle = j; - }else { - indexAngle=indexAngle; + } else { + indexAngle = indexAngle; } } preAngleDeviceList.add(deviceList.get((Integer) longAndLatiList.get(indexAngle).get("h"))); @@ -1960,8 +1962,36 @@ locationList.add(fivethLoction); String preAngleDeviceString = JSON.toJSON(preAngleDeviceList).toString(); params.put("preAngleDeviceString", preAngleDeviceString);//��������������������������� - params.put("locationList",locationList); + params.put("locationList", locationList); return params; } + @GetMapping("forecastO3") + @ApiOperation(value = "���������������������������", notes = "���������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "monitorPointId", defaultValue = "1", value = "���������id", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> getWeatherNextDayDataByRegion(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + parameters.put("typeFormat", "%Y-%m-%d %H:%i:%s"); + List<Map<String, Object>> resultList = weatherService.getForecastAndReal(parameters); + return new ResultBean<List<Map<String, Object>>>(resultList); + } + + @GetMapping("weatherData") + @ApiOperation(value = "������city���������������������������", notes = "������city���������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "city", value = "���������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> getWeatherData(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + parameters.put("typeFormat", "%Y-%m-%d %H:%i:%s"); + List<Map<String, Object>> weatherList = weatherService.getWeatherData(parameters); + return new ResultBean<List<Map<String, Object>>>(weatherList); + } + + @RequestMapping("updateForecastWeather") + public void updateForecastWeather(@RequestBody List<Map<String,Object>> list) { + weatherService.updateForecastWeather(list); + } } -- Gitblit v1.8.0