| | |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | /** |
| | | * web端接口 |
| | | * @author moral |
| | | * @version v1.0 |
| | | * */ |
| | | @Slf4j |
| | | @Api(tags = {"web端接口"}) |
| | | @RestController |
| | |
| | | @Autowired |
| | | private SysAreaService sysAreaService; |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getHourlyAqi") |
| | | @ApiOperation(value = "获取一小时AQI", notes = "获取一小时AQI") |
| | | @ApiImplicitParams(value = { |
| | |
| | | if (!params.containsKey("mac")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | Map<String, Object> result = historyHourlyService.getHourlyAqiByMac(params.get("mac").toString()); |
| | | return ResultMessage.ok(result); |
| | | Map<String, Object> response = historyHourlyService.getHourlyAqiByMac(params.get("mac").toString()); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getMonthAvg") |
| | | @ApiOperation(value = "获取某设备某因子本月均值", notes = "获取某设备某因子本月均值") |
| | | @ApiImplicitParams(value = { |
| | |
| | | if (!params.containsKey("mac") || !params.containsKey("sensorCode")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | Map<String, Object> result = historyDailyService.getMonthAvg(params); |
| | | return ResultMessage.ok(result); |
| | | Map<String, Object> response = historyDailyService.getMonthAvg(params); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getWindData") |
| | | @ApiOperation(value = "获取风场数据", notes = "获取风场数据") |
| | | @ApiImplicitParams(value = { |
| | |
| | | } |
| | | String[] monitorPointIds = params.remove("monitorPointIds").toString().split(","); |
| | | params.put("monitorPointIds", monitorPointIds); |
| | | List<Object> result = historyFiveMinutelyService.getAreaWindData(params); |
| | | return ResultMessage.ok(result); |
| | | List<Object> response = historyFiveMinutelyService.getAreaWindData(params); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getMacSensors") |
| | | @ApiOperation(value = "根据mac获取对应所有因子", notes = "根据mac获取对应所有因子") |
| | | @ApiImplicitParams(value = { |
| | |
| | | if (!params.containsKey("mac")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | Map<String, Object> sensorsInfo = deviceService.getSensorsByMac(params.get("mac").toString()); |
| | | return ResultMessage.ok(sensorsInfo); |
| | | Map<String, Object> response = deviceService.getSensorsByMac(params.get("mac").toString()); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getTrendChartData") |
| | | @ApiOperation(value = "获取监测因子趋势图数据", notes = "获取监测因子趋势图数据") |
| | | @ApiImplicitParams(value = { |
| | |
| | | if (!params.containsKey("mac") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("time")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<Map<String, Object>> sensorsInfo = deviceService.getTrendChartData(params); |
| | | return ResultMessage.ok(sensorsInfo); |
| | | List<Map<String, Object>> response = deviceService.getTrendChartData(params); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | * */ |
| | | @GetMapping("getMapPath") |
| | | @ApiOperation(value = "获取当前用户地图权限", notes = "获取当前用户地图权限") |
| | | @ApiImplicitParams(value = { |
| | |
| | | if (!params.containsKey("organizationId")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<Map<String, Object>> result = sysAreaService.getMapPath(Integer.parseInt(params.get("organizationId").toString())); |
| | | return ResultMessage.ok(result); |
| | | List<Map<String, Object>> response = sysAreaService.getMapPath(Integer.parseInt(params.get("organizationId").toString())); |
| | | return ResultMessage.ok(response); |
| | | } |
| | | |
| | | } |