From e3c89e5bcfee9a8244b102276186037ccd9e21bb Mon Sep 17 00:00:00 2001 From: ZhuDongming <773644075@qq.com> Date: Wed, 31 Jul 2019 15:32:54 +0800 Subject: [PATCH] 排放量接口上新增Swagger注解 --- src/main/java/com/moral/controller/ScreenController.java | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index 43d6ef5..5f1f7eb 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -851,7 +851,9 @@ @ApiImplicitParam(name = "organizationId", defaultValue = "5", value = "���������������������id", required = true, paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "time", defaultValue = "2019", value = "���������������", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "sensorKey", defaultValue = "e27", value = "������������������������key", required = true, paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "regionCode", defaultValue = "130000", value = "���������", required = true, paramType = "query", dataType = "String")}) + @ApiImplicitParam(name = "regionCode", defaultValue = "130000", value = "���������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "monitorPointId", value = "���������id", required = false, paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "mac", value = "������mac", required = false, paramType = "query", dataType = "String")}) public ResultBean<List<Map<String, Object>>> getemissionsData(HttpServletRequest request) throws Exception { Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); List<Map<String, Object>> result = historyDailyService.getEmissionsData(parameters); @@ -973,6 +975,50 @@ List<Map<String, Object>> map = sensorUnitService.getSensorsByMonitPointId2(monitor_point_id); return new ResultBean<List<Map<String, Object>>>(map); } + + @GetMapping("getSensorByDeviceId") + @ApiOperation(value = "������������������������", notes = "������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "id", value = "������id", required = true, paramType = "query", dataType = "String") + }) + public ResultBean<List<Map<String, Object>>> getSensorByDeviceId(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); + String id = (String) parameters.get("id"); + List<Map<String, Object>> list = sensorService.getSensorByDeviceId(id); + Map<String,Object> map = list.get(0); + String monitor_point_id = map.get("monitor_point_id").toString(); + List<Map<String, Object>> sensorUnitList = sensorUnitService.getSensorsByMonitPointId2(monitor_point_id); + System.out.println(sensorUnitList); + for (Map<String, Object> sensorMap : list) { + for (Map<String, Object> sensorUnitMap : sensorUnitList) { + if (sensorUnitMap.get("sensor_key").equals(sensorMap.get("sensor_key"))) { + sensorMap.put("unit", sensorUnitMap.get("name")); + } + } + } + return new ResultBean<List<Map<String, Object>>>(list); + } + + @GetMapping("getSensorWithUnitByMonitorPointId") + @ApiOperation(value = "������������������������", notes = "������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "monitor_point_id", value = "������id", required = true, paramType = "query", dataType = "String") + }) + public ResultBean<List<Map<String, Object>>> getSensorWithUnitByMonitorPointId(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); + String monitor_point_id = (String) parameters.get("monitor_point_id"); + List<Map<String, Object>> list = sensorService.getSensorByMonitorPointId(monitor_point_id); + List<Map<String, Object>> sensorUnitList = sensorUnitService.getSensorsByMonitPointId2(monitor_point_id); + System.out.println(sensorUnitList); + for (Map<String, Object> sensorMap : list) { + for (Map<String, Object> sensorUnitMap : sensorUnitList) { + if (sensorUnitMap.get("sensor_key").equals(sensorMap.get("sensor_key"))) { + sensorMap.put("unit", sensorUnitMap.get("name")); + } + } + } + return new ResultBean<List<Map<String, Object>>>(list); + } @GetMapping("AIForecast") @ApiOperation(value = "AI������", notes = "AI������") -- Gitblit v1.8.0