@@ -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(); | return collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); | ||||
} | } | ||||
public List<T> 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<T> QueryClientIdName(string clientId,string name) | public List<T> QueryClientIdName(string clientId,string name) | ||||
{ | { | ||||
return collection.Find(a => a.ClientId == clientId && a.devicename==name)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); | return collection.Find(a => a.ClientId == clientId && a.devicename==name)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); | ||||
@@ -121,6 +121,31 @@ namespace DataVAPI.Controllers | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 根据客户端ID 设备名称查询当日未处理信息 | |||||
/// </summary> | |||||
/// <param name="clientId"></param> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public JsonMsg<List<AlarmTable>> QueryClientIdName(string clientId,string name) | |||||
{ | |||||
st = System.Reflection.MethodBase.GetCurrentMethod().Name; | |||||
try | |||||
{ | |||||
List<AlarmTable> 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<List<AlarmTable>>.OK(al, st); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
return JsonMsg<List<AlarmTable>>.Error(null, st, ex.Message); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 根据客户端ID查询最近告警 | /// 根据客户端ID查询最近告警 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="clientId"></param> | /// <param name="clientId"></param> | ||||