From c162a3ab239c5c2616143d9c02afad9f17876b2d Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Tue, 13 Aug 2019 11:04:03 +0800
Subject: [PATCH] 修改无人机接口查询起始时间和结束时间为必填项

---
 src/main/java/com/moral/controller/ScreenController.java |   63 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index c531812..1797eaa 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -362,6 +362,16 @@
         Map<String, Object> parameters = getParametersStartingWith(request, null);
         return historyMinutelyService.getDayAQIByDevice(parameters);
     }
+    
+    @GetMapping("hour-aqi")
+    @ApiOperation(value = "���������������AQI", notes = "���������������AQI")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "mac", value = "������mac������", required = true, paramType = "query", dataType = "String")
+    })
+    public Map<String, Object> getHourAQIByDevice(HttpServletRequest request) {
+    	Map<String, Object> parameters = getParametersStartingWith(request, null);
+    	return historyService.gitHourlyAQIByMacAndTimeslot(parameters);
+    }
 
     /**
      * Gets the average by all. ������������������������10������������5������������������������������������������
@@ -851,7 +861,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 +985,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������")
@@ -1110,8 +1166,8 @@
     @ApiOperation(value = "���������������������������", notes = "���������������������������")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "mac", value = "������mac������������p5dnd7a0392068���", required = true, paramType = "query", dataType = "String"),
-            @ApiImplicitParam(name = "startTime", value = "������������(���������2019-07-17 17:07:00)", required = false, paramType = "query", dataType = "String"),
-            @ApiImplicitParam(name = "endTime", value = "������������(���������2019-07-17 17:07:00)", required = false, paramType = "query", dataType = "String")
+            @ApiImplicitParam(name = "startTime", value = "������������(���������2019-07-17 17:07:00)", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "endTime", value = "������������(���������2019-07-17 17:07:00)", required = true, paramType = "query", dataType = "String")
     })
     public ModelAndView uavTrajectory(ModelAndView model, HttpServletRequest request) throws Exception {
         Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
@@ -1133,6 +1189,5 @@
             return model;
         }
     }
-
 
 }

--
Gitblit v1.8.0