diff --git a/langguanApi.xml b/langguanApi.xml
index 4451b9b..72a4586 100644
--- a/langguanApi.xml
+++ b/langguanApi.xml
@@ -29,6 +29,11 @@
缓存天气信息
+
+
+ 缓存清洁数据
+
+
redis 服务地址
@@ -86,7 +91,7 @@
-
+
新加
@@ -100,13 +105,26 @@
-
+
更新
+
+
+ 取单条
+
+
+
+
+
+
+ 取设备类型集合
+
+
+
获取指定设备的历史数据
@@ -532,6 +550,11 @@
所属组织ID
+
+
+ 设备类型,1 voc,2 cems,3,tsp,4 video
+
+
HJ212_2017
@@ -1273,27 +1296,34 @@
-
+
新加
-
+
是否存在
-
+
更新
+
+
+ 取单个
+
+
+
+
remove
@@ -1308,6 +1338,12 @@
+
+
+ 获取设备类型
+
+
+
分页取数据
@@ -1550,6 +1586,12 @@
+
+
+ 首页统计
+
+
+
分页取数据
diff --git a/langguanApi/Common/Redis/RedisKeylist.cs b/langguanApi/Common/Redis/RedisKeylist.cs
index 295fbd5..e1364a6 100644
--- a/langguanApi/Common/Redis/RedisKeylist.cs
+++ b/langguanApi/Common/Redis/RedisKeylist.cs
@@ -7,5 +7,9 @@
/// 缓存天气信息
///
public static string Weather = "weather";
+ ///
+ /// 缓存清洁数据
+ ///
+ public static string CleanData = "cleandata";
}
}
diff --git a/langguanApi/Controllers/DeviceController.cs b/langguanApi/Controllers/DeviceController.cs
index 0807df7..93f385b 100644
--- a/langguanApi/Controllers/DeviceController.cs
+++ b/langguanApi/Controllers/DeviceController.cs
@@ -35,7 +35,7 @@ namespace langguanApi.Controllers
///
///
[HttpPost]
- public async Task Addd([FromBody] DeviceDto input)
+ public async Task Addd([FromBody] DeviceAddDto input)
{
var result = await _deviceService.Add(input);
return Ok(result);
@@ -57,11 +57,31 @@ namespace langguanApi.Controllers
///
///
[HttpPut]
- public async Task update([FromBody] DeviceDto input)
+ public async Task update([FromBody] DeviceUpdateDto input)
{
var result = await _deviceService.update(input);
return Ok(result);
}
-
+ ///
+ /// 取单条
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task FindOne(string Id)
+ {
+ var result = await _deviceService.FindeById(Id);
+ return Ok(new ApiResult() { code = 0, data = result });
+ }
+ ///
+ /// 取设备类型集合
+ ///
+ ///
+ [HttpGet]
+ public async Task GetDeviceTypes()
+ {
+ var result=await _deviceService.GetDeviceTypes();
+ return Ok(new ApiResult() { code = 0, data = result });
+ }
}
}
diff --git a/langguanApi/Model/Device.cs b/langguanApi/Model/Device.cs
index 589908b..8e8eccd 100644
--- a/langguanApi/Model/Device.cs
+++ b/langguanApi/Model/Device.cs
@@ -17,5 +17,25 @@
/// 所属组织ID
///
public string OrgId { get; set; }
+ ///
+ /// 设备类型,1 voc,2 cems,3,tsp,4 video
+ ///
+ public int DeviceType { get; set; }
+ }
+ public class DeviceAddDto
+ {
+
+ public string deviceMN { get; set; }
+ public string Ip { get; set; }
+ public double lng { get; set; }
+ public double lat { get; set; }
+ public string NickName { get; set; }
+ }
+ public class DeviceUpdateDto
+ {
+ public string Id { get; set; }
+ public string NickName { get; set; }
+ public string OrgId { get; set; }
+ public int DeviceType { get; set; }
}
}
diff --git a/langguanApi/Model/Dto/AddDevice.cs b/langguanApi/Model/Dto/AddDevice.cs
deleted file mode 100644
index 76c3330..0000000
--- a/langguanApi/Model/Dto/AddDevice.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace langguanApi.Model.Dto
-{
- public class DeviceDto
- {
- public string deviceMN { get; set; }
- public string Name { get; set; }
- public string Ip { get; set; }
- public double lng { get; set; }
- public double lat { get; set; }
- public string desricption { get; set; }
- public int state { get; set; }
- }
-}
diff --git a/langguanApi/Service/DeviceService.cs b/langguanApi/Service/DeviceService.cs
index 83c9eff..5bc931d 100644
--- a/langguanApi/Service/DeviceService.cs
+++ b/langguanApi/Service/DeviceService.cs
@@ -18,11 +18,11 @@ namespace langguanApi.Service
///
///
///
- public async Task Add(DeviceDto input)
+ public async Task Add(DeviceAddDto input)
{
if (await Exist(input))
{
- return new ApiResult { code = 1, msg = $"已经存在名称为:{input.Name}" };
+ return new ApiResult { code = 1, msg = $"已经存在名称为:{input.NickName}" };
}
var entity = input.Adapt();
if (entity != null)
@@ -37,7 +37,7 @@ namespace langguanApi.Service
///
///
///
- public async Task Exist(DeviceDto input)
+ public async Task Exist(DeviceAddDto input)
{
var entity = input.Adapt();
Expression> exp = filter => filter.deviceMN == entity.deviceMN;
@@ -48,13 +48,22 @@ namespace langguanApi.Service
///
///
///
- public async Task update(DeviceDto input)
+ public async Task update(DeviceUpdateDto input)
{
var entity = input.Adapt();
await base.UpdateAsync(entity.Id, entity);
return new ApiResult { code = 0, msg = "" };
}
///
+ /// 取单个
+ ///
+ ///
+ ///
+ public async Task FindeById(string id)
+ {
+ return await GetAsync(id);
+ }
+ ///
/// remove
///
///
@@ -79,7 +88,6 @@ namespace langguanApi.Service
Expression> exp = filter => filter.deviceMN == deviceMN && filter.IsDelete == false;
return (await base.GetListWithExp(exp)).FirstOrDefault();
}
-
///
/// 通过orgid获取设备信息
///
@@ -91,22 +99,35 @@ namespace langguanApi.Service
var list = (await base.GetListWithExp(exp)).ToList();
return list;
}
-
-
-
///
- /// 分页取数据
+ /// 获取设备类型
///
- ///
///
- public async Task