fyf пре 2 година
родитељ
комит
f7efd815aa
2 измењених фајлова са 19 додато и 3 уклоњено
  1. +5
    -0
      DataVAPI.ServerDB/MongoDB/MongodbHelper.cs
  2. +14
    -3
      DataVAPI/Controllers/DeviceStatsController.cs

+ 5
- 0
DataVAPI.ServerDB/MongoDB/MongodbHelper.cs Прегледај датотеку

@@ -246,6 +246,11 @@ namespace DataVAPI.ServerDB.MongoDB
return collection.Find(a => a.ClientId == key)?.ToList();
}

public List<T> ALLDataName(string key,string name)
{
return collection.Find(a => a.ClientId == key && a.devicename==name)?.ToList();
}

public PaginationListModel<T> BasePagQuery(string clientId, string deviceId, DateTime datesta, DateTime datastop, int PageNumber, int PageSize)
{
BasePaginationModel pagination = new BasePaginationModel()


+ 14
- 3
DataVAPI/Controllers/DeviceStatsController.cs Прегледај датотеку

@@ -131,15 +131,26 @@ namespace DataVAPI.Controllers
/// 统计数量
/// </summary>
/// <param name="clientId"></param>
/// <param name="name"></param>
/// <returns></returns>
[HttpGet]
public JsonMsg<object> StatsConut(string clientId)
public JsonMsg<object> StatsConut(string clientId,string name)
{
st = System.Reflection.MethodBase.GetCurrentMethod().Name;
try
{
List<LogTable> log = mglog.ALLData(clientId);
List<AlarmTable> alarm = mggj.ALLData(clientId);
List<LogTable> log = new List<LogTable>();
List<AlarmTable> alarm = new List<AlarmTable>();
if (string.IsNullOrEmpty(name))
{
log = mglog.ALLData(clientId);
alarm = mggj.ALLData(clientId);
}
else
{
log = mglog.ALLDataName(clientId,name);
alarm = mggj.ALLDataName(clientId, name);
}
List<object> list = new List<object>();
int? count = log?.FindAll(par => par.LogMessage.Contains("设备在线了")).Count;
list.Add(new { Name = "运行次数", Count = count?.ToString()});


Loading…
Откажи
Сачувај