|
|
|
@ -7,6 +7,7 @@ using NetTaste;
|
|
|
|
|
using NLog;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data.SqlTypes;
|
|
|
|
|
using System.Linq;
|
|
|
|
@ -552,10 +553,13 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
{
|
|
|
|
|
if (recordDnbInstant.zxyg != appConfig.virtualValue)
|
|
|
|
|
{
|
|
|
|
|
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
|
|
|
|
|
if (info > 0)
|
|
|
|
|
if (FIlterDnbInstant(recordDnbInstant))
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{recordDnbInstant.monitorId}数据保存成功");
|
|
|
|
|
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
|
|
|
|
|
if (info > 0)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{recordDnbInstant.monitorId}数据保存成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -583,7 +587,7 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Dictionary<string, decimal> monitorInstant = new Dictionary<string, decimal>();
|
|
|
|
|
private ConcurrentDictionary<string, decimal> monitorInstant = new ConcurrentDictionary<string, decimal>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 过滤数据,与前一条相差超过4000不进行保存
|
|
|
|
@ -608,14 +612,14 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
if (!monitorInstant.ContainsKey(dnbInstant.monitorId))
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"本地未获取到{dnbInstant.monitorId};");
|
|
|
|
|
monitorInstant.Add(dnbInstant.monitorId,(decimal)dnbInstant.zxyg);
|
|
|
|
|
monitorInstant.TryAdd(dnbInstant.monitorId,(decimal)dnbInstant.zxyg);
|
|
|
|
|
logger.Info($"本地缓存{dnbInstant.monitorId};数据:{dnbInstant.zxyg}");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.Info($"校验判断{dnbInstant.monitorId};");
|
|
|
|
|
var lastDnbInstant = monitorInstant[dnbInstant.monitorId];
|
|
|
|
|
logger.Info($"本地缓存{dnbInstant.monitorId};前一条数据:{dnbInstant.zxyg}");
|
|
|
|
|
logger.Info($"本地缓存{dnbInstant.monitorId};前一条数据:{lastDnbInstant}");
|
|
|
|
|
/*RecordDnbInstant lastDnbInstant = SqlSugarHelper.Db.Queryable<RecordDnbInstant>()
|
|
|
|
|
.OrderByDescending(x => x.collectTime)
|
|
|
|
|
.First(x => x.monitorId == dnbInstant.monitorId);
|
|
|
|
@ -654,6 +658,12 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
|
|
|
|
|
monitorInstant[dnbInstant.monitorId] = (decimal)dnbInstant.zxyg;
|
|
|
|
|
logger.Info($"更新本地缓存{dnbInstant.monitorId};数据:{dnbInstant.zxyg}");
|
|
|
|
|
|
|
|
|
|
if (zxygRes < 0)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{dnbInstant.monitorId};与前一条数据相差:{zxygRes};小于0,不进行保存");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (zxygRes >= appConfigDifferenceValue)
|
|
|
|
|
{
|
|
|
|
|