| | |
| | | import com.moral.service.SensorService;
|
| | | import com.moral.service.SensorUnitService;
|
| | | import com.moral.service.WeatherService;
|
| | | import com.moral.util.AQICalculation;
|
| | | import com.moral.util.TempAllocationUtils;
|
| | |
|
| | | import io.swagger.annotations.Api;
|
| | |
| | | model.setViewName("pollutionsource");
|
| | | return model;
|
| | | }
|
| | | |
| | | @GetMapping("getAirQualityComparison")
|
| | | @ApiOperation(value = "空气质量对比", notes = "空气质量对比")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "organizationId", defaultValue = "5", value = "登录账号的组织id", required = true, paramType = "query", dataType = "String"),
|
| | | @ApiImplicitParam(name = "monitor_point_id", defaultValue = "5", value = "监控站点id", required = true, paramType = "query", dataType = "String")})
|
| | | public ResultBean<Map<String, Object>> getAirQualityComparison(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | Map<String, Object> map = weatherService.getWeatherDataByRegion(parameters);
|
| | | Map<String, Double> sensorMap = new HashMap<>();
|
| | | sensorMap.put("e1", Double.parseDouble(map.get("pm25").toString()));
|
| | | sensorMap.put("e2", Double.parseDouble(map.get("pm10").toString()));
|
| | | sensorMap.put("e11", Double.parseDouble(map.get("so2").toString()));
|
| | | sensorMap.put("e16", Double.parseDouble(map.get("no2").toString()));
|
| | | sensorMap.put("e10", Double.parseDouble(map.get("co").toString()));
|
| | | sensorMap.put("e15", Double.parseDouble(map.get("o3").toString()));
|
| | | Map<String, Object> StateControl = AQICalculation.hourlyAQI(sensorMap);
|
| | | System.out.println("StateControl:"+StateControl);
|
| | | Map<String, Object> hourAqi = historyService.gitHourlyAQIByMonitorPointIdAndTimeslot(parameters);
|
| | | System.out.println("hourAqi:"+hourAqi);
|
| | | Map<String, Object> returnMap = new HashMap<>();
|
| | | returnMap.put("站点AQI", hourAqi.get("AQI"));
|
| | | returnMap.put("国控AQI", StateControl.get("AQI"));
|
| | | return new ResultBean<Map<String, Object>>(returnMap);
|
| | | }
|
| | | |
| | |
|
| | | @GetMapping("mointorPointRank")
|
| | | @ApiOperation(value = "获取站点排名", notes = "获取站点排名")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "accountId", value = "账号id", required = true, paramType = "query", dataType = "String"),
|
| | | @ApiImplicitParam(name = "sensor", value = "因子", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<List<Map<String, Object>>> getMointorPointRank(HttpServletRequest request){
|
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
|
| | | String id = parameters.get("accountId").toString();
|
| | | String sensor = parameters.get("sensor").toString();
|
| | | Map<String, Object> account = accountService.getOrganizationIdByAccountId(id);
|
| | | //通过组织id来获取站点和设备信息
|
| | | account.put("sensor", sensor);
|
| | | List<Map<String, Object>> returnList = historyService.getMointorPointRankByOrganizationId(account);
|
| | | return new ResultBean<List<Map<String, Object>>>(returnList);
|
| | | }
|
| | | |
| | | }
|