From d0e6f9233235ee68eb74b350f15717173918cc69 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 22 Nov 2018 15:20:58 +0800
Subject: [PATCH] update

---
 src/main/java/com/moral/controller/ScreenController.java |   50 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index a7005ec..7d68481 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -20,6 +20,7 @@
 import com.moral.entity.layout.RealTimeDeviceLayout;
 import com.moral.service.*;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.net.ftp.FTPClient;
 import org.apache.log4j.Logger;
 import org.dom4j.Document;
@@ -38,6 +39,7 @@
 import com.moral.common.bean.PageResult;
 import com.moral.common.bean.ResultBean;
 import com.moral.common.util.ValidateUtil;
+import com.moral.common.util.WebUtils;
 import com.moral.common.xml.Version;
 import com.moral.entity.alarm.AlarmSensorLevel;
 
@@ -148,17 +150,24 @@
 							areaNamesBuilder.append(String.join("/",names));
 						}
 					// ������������
-					if( 0 == organization.getRank()) {
+					if(organization.getRank()!=null && organization.getRank() == 0) {
 						resultMap.put("type","enterprise");
                     }else{
 						resultMap.put("type","government");
 					}
-					resultMap.put("areaCode",
-							organization.getVillageCode()|
-							organization.getTownCode()|
-							organization.getAreaCode()*1000000|
-							organization.getCityCode()*1000000|
-							organization.getProvinceCode()*1000000);
+					Number mapAreaCode  = null;
+					if(organization.getVillageCode()!=null){
+						mapAreaCode  = organization.getVillageCode();
+					}else if (organization.getTownCode()!=null){
+						mapAreaCode  = organization.getTownCode();
+					}else if(organization.getAreaCode()!=null) {
+						mapAreaCode  = organization.getAreaCode();
+					}else if(organization.getCityCode()!=null) {
+						mapAreaCode  = organization.getCityCode();
+					}else if(organization.getProvinceCode()!=null) {
+						mapAreaCode  = organization.getProvinceCode();
+					}
+					resultMap.put("mapAreaCode",mapAreaCode.toString() );
                 }
                 resultMap.put("mapPath",areaNamesBuilder.toString());
             }
@@ -697,7 +706,7 @@
 	@ApiImplicitParams(value = {
 			@ApiImplicitParam(name = "orgid",defaultValue = "5",value = "������id", required = true, paramType = "query", dataType = "Integer"),
 	})
-	public ResultBean<List<Map>> getAqi24HoursNC(@RequestParam("orgid") Integer organizationId) {
+	public ResultBean<List<Map<String,Object>>> getAqi24HoursNC(@RequestParam("orgid") Integer organizationId) {
 		return new ResultBean<>(hangzhouAqiService.queryAqi24Hours(organizationId));
 	}
 	@GetMapping("mpt-dev-summary")
@@ -751,4 +760,29 @@
 		Map<String, Object> map = qualityDailyService.getQualityCountDayByRegion(parameters);
 		return new ResultBean<Map<String, Object>>(map);
 	}
+
+	@GetMapping("monitorpoints-devices")
+	@ApiOperation(value = "���������������������������", notes = "���������������������������")
+	@ApiImplicitParams(value = {
+			@ApiImplicitParam(name = "organizationId",defaultValue = "8", value = "���������������������id", required = true, paramType = "query", dataType = "Integer"),
+			@ApiImplicitParam(name = "regionCode",defaultValue = "320583", value = "���������", required = true, paramType = "query", dataType = "String")
+	})
+	public ResultBean<List<MonitorPoint>> getMonitorPointsAndDevicesByRegion(HttpServletRequest request) throws Exception {
+		Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+		List<MonitorPoint> monitorPoints= monitorPointService.getMonitorPointsAndDevicesByRegion(parameters);
+		return new ResultBean<List<MonitorPoint>>(monitorPoints);
+	}
+
+
+	@GetMapping("devices-state")
+	@ApiOperation(value = "������������������", notes = "������������������")
+	@ApiImplicitParams(value = {
+			@ApiImplicitParam(name = "organizationId",defaultValue = "8", value = "���������������������id", required = true, paramType = "query", dataType = "Integer"),
+			@ApiImplicitParam(name = "regionCode",defaultValue = "320583", value = "���������", required = true, paramType = "query", dataType = "String")
+	})
+	public ResultBean<Collection<Object>> getDevicesStateByRegion(HttpServletRequest request) throws Exception {
+		Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+		Collection<Object> monitorPoints= monitorPointService.getDevicesStateByRegion(parameters);
+		return new ResultBean<Collection<Object>>(monitorPoints);
+	}
 }

--
Gitblit v1.8.0