From dce0021131e955bac968cb2a7e24ce3673eb1a3b Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Mon, 02 Aug 2021 17:22:15 +0800 Subject: [PATCH] 监测因子趋势图 --- screen-api/src/main/java/com/moral/api/controller/WebController.java | 70 +++++++++++++++++++++++++--------- 1 files changed, 51 insertions(+), 19 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/controller/WebController.java b/screen-api/src/main/java/com/moral/api/controller/WebController.java index b16c7d7..0345043 100644 --- a/screen-api/src/main/java/com/moral/api/controller/WebController.java +++ b/screen-api/src/main/java/com/moral/api/controller/WebController.java @@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -24,6 +26,12 @@ import com.moral.constant.ResultMessage; import com.moral.util.WebUtils; +/** + * web��������� + * + * @author moral + * @version v1.0 + */ @Slf4j @Api(tags = {"web���������"}) @RestController @@ -45,6 +53,10 @@ @Autowired private SysAreaService sysAreaService; + /** + * @param request ������������ + * @return ������������������������������������ + */ @GetMapping("getHourlyAqi") @ApiOperation(value = "���������������AQI", notes = "���������������AQI") @ApiImplicitParams(value = { @@ -56,10 +68,14 @@ 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 = { @@ -72,10 +88,14 @@ 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 = { @@ -89,43 +109,55 @@ } 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������������������������") + @ApiOperation(value = "������������mac������������������", notes = "������������mac������������������") @ApiImplicitParams(value = { @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), - @ApiImplicitParam(name = "mac", value = "������mac", required = true, paramType = "query", dataType = "String") + @ApiImplicitParam(name = "macs", value = "������mac���������������������", required = true, paramType = "query", dataType = "String") }) public ResultMessage getMacSensors(HttpServletRequest request) { Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); - if (!params.containsKey("mac")) { + if (!params.containsKey("macs")) { 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); + return ResultMessage.ok(response); } + /** + * @param request ������������ + * @return ������������������������������������ + */ @GetMapping("getTrendChartData") - @ApiOperation(value = "���������������������������������", notes = "���������������������������������") + @ApiOperation(value = "���������������������������������", notes = "���������������������������������.") @ApiImplicitParams(value = { @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), - @ApiImplicitParam(name = "mac", value = "������mac", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "macs", value = "������mac���������������������", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "sensorCode", value = "������code", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "type", value = "���������������������day���,������month���,������year���", required = true, paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "time", value = "������������", required = true, paramType = "query", dataType = "String") + @ApiImplicitParam(name = "times", value = "���������������������2021-07-29������������2021-07������������2021������������������������", required = true, paramType = "query", dataType = "String") }) public ResultMessage getTrendChartData(HttpServletRequest request) { Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); - if (!params.containsKey("mac") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("time")) { + if (!params.containsKey("macs") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("times")) { 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 = { @@ -137,8 +169,8 @@ 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); } } -- Gitblit v1.8.0