From b97887d232f865b6a4bf835861aac8a4ebc55c28 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Tue, 03 Jul 2018 14:10:17 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/java/com/moral/controller/ScreenController.java | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index 16dc30f..e0ef646 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -566,6 +566,7 @@ @ApiImplicitParam(name = "dimension", value = "������(profession���region���monitorPoint������)", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "sensorKey", value = "���������key", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "accountId", value = "������id", required = true, paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "timeType", value = "������������(month���day���hour������)", required = true, paramType = "query", dataType = "int"), }) public ResultBean<List<Map<String, Object>>> getRegionRankingData(HttpServletRequest request){ Map<String, Object> parameters = getParametersStartingWith(request, null); @@ -598,7 +599,7 @@ } else { MonitorPoint monitorPoint = monitorPointService.queryMonitorPointById(Integer.parseInt(primaryKey)); - List<DeviceVersion> versionList = deviceVersionService.queryByOrgId(monitorPoint.getOrganizationId()); + List<DeviceVersion> versionList = deviceVersionService.queryByMpointId(monitorPoint.getId()); if(versionList.size() > 0) { List<Integer> versionNolist = versionList.stream().map(item -> { return item.getVersion(); @@ -609,7 +610,34 @@ } } } - return new ResultBean(rtdLayout); + if(rtdLayout!=null && rtdLayout.getDefaultMonitorItems().size() == 0 ) { + rtdLayout.getDefaultMonitorItems().addAll(rtdLayout.getCoreMonitorItems()); + } + return new ResultBean(rtdLayout == null? new RealTimeDeviceLayout():rtdLayout); + } + + @GetMapping("report_avg_data") + @ApiOperation(value = "������������������������������", notes = "������������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "monitorPoint", value = "���������id", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "mac", value = "������mac", required = false, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "sensorKey", value = "���������key,���������������������������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������,������(���������2018-03)", required = true, paramType = "query", dataType = "String"), + }) + public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgDataBySensorKey(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + parameters.put("type", "month"); + parameters.put("monitorPointId", parameters.remove("monitorPoint")); + String[] sensorKeys = parameters.remove("sensorKey").toString().split(","); + parameters.put("sensors", Arrays.asList(sensorKeys)); + List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters); + + for (Map<String, Object> map : list) { + String time = map.get("time").toString(); + time = time.substring(time.length() - 2); + map.put("time", Integer.valueOf(time)); + } + return new ResultBean<List<Map<String, Object>>>(list); } } -- Gitblit v1.8.0