|
@@ -1247,8 +1247,7 @@ namespace IMCS.CCS.Service.Impl
|
|
|
try
|
|
|
{
|
|
|
string message = "MonitorEquipmentStatusJob调度成功";
|
|
|
- List<Device> devices = new List<Device>();
|
|
|
- string device_redis_key = "IMCS_CCS:DeviceList";
|
|
|
+ List<Device> devices = new List<Device>();
|
|
|
var deviceData = await _redisService.Database.StringGetAsync(device_redis_key);
|
|
|
if (deviceData.IsNullOrEmpty)
|
|
|
{
|
|
@@ -1459,13 +1458,12 @@ namespace IMCS.CCS.Service.Impl
|
|
|
{
|
|
|
string message = "";
|
|
|
List<Device> devices = new List<Device>();
|
|
|
- List<Device> changeDevices = new List<Device>();
|
|
|
- string redis_key = "IMCS_CCS:DeviceList";
|
|
|
- var data = await _redisService.Database.StringGetAsync(redis_key);
|
|
|
+ List<Device> changeDevices = new List<Device>();
|
|
|
+ var data = await _redisService.Database.StringGetAsync(device_redis_key);
|
|
|
if (data.IsNullOrEmpty)
|
|
|
{
|
|
|
devices = _deviceService.GetDeviceAllList();
|
|
|
- await _redisService.Database.StringSetAsync(redis_key, JsonConvert.SerializeObject(devices));
|
|
|
+ await _redisService.Database.StringSetAsync(device_redis_key, JsonConvert.SerializeObject(devices));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1500,7 +1498,7 @@ namespace IMCS.CCS.Service.Impl
|
|
|
else
|
|
|
{
|
|
|
Device oldDevice = await _deviceService.GetDeviceById(device.Id);
|
|
|
- if (!oldDevice.State)
|
|
|
+ if (oldDevice != null && !oldDevice.State)
|
|
|
{
|
|
|
device.State = true;
|
|
|
await _deviceService.UpdateDevice(device);
|
|
@@ -1672,7 +1670,7 @@ namespace IMCS.CCS.Service.Impl
|
|
|
}
|
|
|
if (changeDevices != null)
|
|
|
{
|
|
|
- await _redisService.Database.StringSetAsync(redis_key, JsonConvert.SerializeObject(devices));
|
|
|
+ await _redisService.Database.StringSetAsync(device_redis_key, JsonConvert.SerializeObject(devices));
|
|
|
}
|
|
|
return message;
|
|
|
}
|