From 539a7077cbf638a5aa9ae5e46c17be96daba7d9b Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Mon, 02 Jul 2018 10:54:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/main/java/com/moral/controller/ScreenController.java | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index 10915d3..b3d6354 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -108,6 +108,8 @@
private AlarmDailyService alarmDailyService;
@Resource
private OrganizationLayoutService orgLayoutService;
+ @Resource
+ private DeviceVersionService dviceVersionService;
/**
* Screen login. ������������
*
@@ -564,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);
@@ -594,8 +597,47 @@
return ResultBean.fail();
}
+ } else {
+ MonitorPoint monitorPoint = monitorPointService.queryMonitorPointById(Integer.parseInt(primaryKey));
+ List<DeviceVersion> versionList = deviceVersionService.queryByOrgId(monitorPoint.getOrganizationId());
+ if(versionList.size() > 0) {
+ List<Integer> versionNolist = versionList.stream().map(item -> {
+ return item.getVersion();
+ }).collect(Collectors.toList());
+ rtdLayout = orgLayoutService.queryRtdLayoutWithUnit(monitorPoint.getOrganizationId(),versionNolist);
+ if(rtdLayout == null) {
+ return ResultBean.fail();
+ }
+ }
}
- 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