From b161484f5f8c4af685a461048eb9147899b7a4ec Mon Sep 17 00:00:00 2001 From: fyf Date: Tue, 31 May 2022 13:03:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=97=A1=E5=97=A1=E5=97=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataVAPI.ServerDB/MongoDB/MongodbHelper.cs | 5 +++++ DataVAPI/Controllers/AlarmController.cs | 25 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/DataVAPI.ServerDB/MongoDB/MongodbHelper.cs b/DataVAPI.ServerDB/MongoDB/MongodbHelper.cs index 9a831e5..72cba28 100644 --- a/DataVAPI.ServerDB/MongoDB/MongodbHelper.cs +++ b/DataVAPI.ServerDB/MongoDB/MongodbHelper.cs @@ -204,6 +204,11 @@ namespace DataVAPI.ServerDB.MongoDB return collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); } + public List QueryClientIdNameO(string clientId, string name) + { + return collection.Find(a => a.ClientId == clientId && a.devicename==name && a.CreateTime >= DateTime.Now.Date)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); + } + public List QueryClientIdName(string clientId,string name) { return collection.Find(a => a.ClientId == clientId && a.devicename==name)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); diff --git a/DataVAPI/Controllers/AlarmController.cs b/DataVAPI/Controllers/AlarmController.cs index ec59a86..96f902e 100644 --- a/DataVAPI/Controllers/AlarmController.cs +++ b/DataVAPI/Controllers/AlarmController.cs @@ -121,6 +121,31 @@ namespace DataVAPI.Controllers } } /// + /// 根据客户端ID 设备名称查询当日未处理信息 + /// + /// + /// + [HttpGet] + public JsonMsg> QueryClientIdName(string clientId,string name) + { + st = System.Reflection.MethodBase.GetCurrentMethod().Name; + try + { + List al = mg.QueryClientIdNameO(clientId, name); + al?.ForEach(par => + { + if (par.State == "y") { par.StatusMS = "未处理"; par.StatusColor = new { r = 255, g = 0, b = 0, a = 1 }; } + else { par.StatusMS = "已处理"; par.StatusColor = new { r = 51, g = 232, b = 34, a = 1 }; } + }); + al.Sort((a, b) => -a.State.CompareTo(b.State)); + return JsonMsg>.OK(al, st); + } + catch (Exception ex) + { + return JsonMsg>.Error(null, st, ex.Message); + } + } + /// /// 根据客户端ID查询最近告警 /// ///