From 8ea24dd5fb6e1b24d3a7ef62a0060ef516f8f759 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 24 May 2018 08:58:16 +0800
Subject: [PATCH] 更新 监测点 数据

---
 src/main/java/com/moral/controller/MobileController.java |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/moral/controller/MobileController.java b/src/main/java/com/moral/controller/MobileController.java
index 1e290e6..b9f1174 100644
--- a/src/main/java/com/moral/controller/MobileController.java
+++ b/src/main/java/com/moral/controller/MobileController.java
@@ -74,7 +74,14 @@
 		OperateUser operateUser = operateUserService.updatePassword(uid,password,newpassword);
 		return new AppData<OperateUser>(operateUser); 
 	}
-
+	/**
+	 * ������ ������id ���������������������
+	 */
+	@RequestMapping("deviceInfo")
+	public AppData<Device> deviceInfo(Integer id){
+		Device device = deviceService.queryById(id);
+		return  new AppData<Device>(device);
+	}
 	/**
 	 *
 	 * @param equDeviceAdapter
@@ -82,7 +89,7 @@
 	 */
 	@RequestMapping("reportDevice")
 	public AppData<String> installDevice(EquDeviceAdapter equDeviceAdapter) {
-		deviceService.saveOrUpdateDevice(equDeviceAdapter.toDevice());
+		deviceService.addOrModify(equDeviceAdapter.toDevice());
 		return new AppData<String>("");
 	}
 
@@ -110,10 +117,14 @@
 	@RequestMapping("getEquInfoByMac")
 	public AppData<Map> getDeviceByMac(@RequestParam(value="mac", required=true)String mac) {
 		Device device = deviceService.getDeviceByMac(mac,false);//���������������
-		Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device));
-		deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint"));
-		deviceMap.remove("monitorPoint");
-		return new AppData<Map>(deviceMap);
+		if(device!=null){
+			Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device));
+			deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint"));
+			deviceMap.remove("monitorPoint");
+			return new AppData<Map>(deviceMap);
+		}else{
+			return  new AppData("mac���������������",AppData.FAIL);
+		}
 	}
 
 	/**

--
Gitblit v1.8.0