diff --git a/src/X1.Application/ApplicationServices/DeviceRuntimeService.cs b/src/X1.Application/ApplicationServices/DeviceRuntimeService.cs index 82ffad1..5b8643c 100644 --- a/src/X1.Application/ApplicationServices/DeviceRuntimeService.cs +++ b/src/X1.Application/ApplicationServices/DeviceRuntimeService.cs @@ -380,9 +380,9 @@ public class DeviceRuntimeService : IDeviceRuntimeCoreService try { _logger.LogInformation("开始批量启动设备运行时状态,设备数量: {DeviceCount}", deviceRequests?.Count ?? 0); - + bool checkRequestsParameter = deviceRequests != null && deviceRequests.Any() && deviceRequests.All(d => !string.IsNullOrEmpty(d.DeviceCode) && !string.IsNullOrEmpty(d.NetworkStackCode)); // 验证命令参数 - if (deviceRequests != null && deviceRequests.Any() && deviceRequests.All(d => !string.IsNullOrEmpty(d.DeviceCode) && !string.IsNullOrEmpty(d.NetworkStackCode))) + if (!checkRequestsParameter) { _logger.LogWarning("命令参数验证失败"); return OperationResult.CreateFailure("命令参数验证失败"); @@ -826,9 +826,11 @@ public class DeviceRuntimeService : IDeviceRuntimeCoreService try { + bool checkRequestsParameter = deviceCodes != null && deviceCodes.Any() && deviceCodes.All(code => !string.IsNullOrEmpty(code)); + // 验证请求参数 _logger.LogDebug("[{RequestId}] 开始验证请求参数", requestId); - if (deviceCodes != null && deviceCodes.Any() && deviceCodes.All(code => !string.IsNullOrEmpty(code))) + if (!checkRequestsParameter) { _logger.LogWarning("[{RequestId}] 请求参数验证失败", requestId); return OperationResult.CreateFailure("请求参数无效");