From 938b35db33710afcbf42fe0b0b1137a6c6a0d7b4 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Sat, 09 Jun 2018 11:19:42 +0800
Subject: [PATCH] logging

---
 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