缓存设置

zw
smartwyy 6 months ago
parent 701daed9fe
commit 468e825396

@ -23,6 +23,8 @@ public static class ClientMgr
private static readonly Dictionary<string, ChargerClient> Dictionary = new();
private static bool AutoChargeWorking { get; set; }
public static ChargerClient? GetBySn(string sn)
{
Dictionary.TryGetValue(sn, out var o);
@ -78,12 +80,16 @@ public static class ClientMgr
///
/// </summary>
public static void StartAutoChargeThread()
{
if (!AutoChargeWorking)
{
Thread thread = new Thread(AutoChargeThread)
{
Name = @"auto-charge"
};
thread.Start();
AutoChargeWorking = true;
}
}
/// <summary>
///
@ -99,6 +105,8 @@ public static class ClientMgr
while (true)
{
Thread.Sleep(1000 * 30);
try
{
DateTime now = DateTime.Now;
ElecPriceModelVersion elecPriceModelVersion = elecPriceModelVersionRepository.QueryByClause(i => i.StartTime >= now && i.EndTime < now);
if (elecPriceModelVersion == null)
@ -126,6 +134,11 @@ public static class ClientMgr
Log.Info($"start {pair.Key} charge {result.IsSuccess}:{result.Msg}");
}
}
catch (Exception e)
{
Log.Error("AutoChargeThread error", e);
}
}
}
private static void ConnClient(EquipNetInfo netInfo)

@ -201,6 +201,7 @@ namespace Service.System
string newValue = Convert.ToString(value);
Dictionary.AddOrUpdate(key, newValue, (s, s1) => newValue);
redisHelper.SetKeyValueStr(key, newValue);
SysConfig sysConfig = _sysConfigRep.QueryByClause(i => i.GroupCode == keys[0] && i.Code == keys[1]);
if (sysConfig == null)

Loading…
Cancel
Save