refactor:删除了DeviceDto,VariableDto,VariableTableDto,改为使用DMS.Core中的实体

This commit is contained in:
2025-10-07 17:51:24 +08:00
parent 94ad940e03
commit b753e5ea73
52 changed files with 291 additions and 463 deletions

View File

@@ -93,7 +93,7 @@ namespace DMS.Application.Services.Triggers.Impl
// Simple token replacement - in practice, use a templating engine like Scriban, RazorLight etc.
// Note: This assumes context.Variable and context.CurrentValue have Name properties/values.
// You might need to adjust the token names and values based on your actual VariableDto structure.
// You might need to adjust the token names and values based on your actual Variable structure.
var subject = subjectTemplate
.Replace("{VariableName}", context.Variable?.Name ?? "Unknown")
.Replace("{CurrentValue}", context.CurrentValue?.ToString() ?? "N/A")

View File

@@ -47,9 +47,10 @@ namespace DMS.Application.Services.Triggers.Impl
try
{
var triggers = await _triggerManagementService.GetTriggersForVariableAsync(variableId);
// 注意:这里不再通过 _variableAppService 获取 VariableDto
// 而是在调用 ExecuteActionAsync 时由上层DataEventService提供
// 如果需要 VariableDto 信息,可以在 ExecuteActionAsync 的 TriggerContext 中携带。
// 注意:这里不再通过 _variableAppService 获取 Variable
// 如果需要 Variable 信息,可以在 ExecuteActionAsync 的 TriggerContext 中携带
// 创建一个临时的上下文对象,其中 Variable 可以为 null
// 在实际应用中,你可能需要通过某种方式获取 Variable。
_logger.LogDebug($"Evaluating {triggers.Count(t => t.IsActive)} active triggers for variable ID: {variableId}");
@@ -59,9 +60,7 @@ namespace DMS.Application.Services.Triggers.Impl
{
if (EvaluateCondition(trigger, currentValue))
{
// 创建一个临时的上下文对象,其中 VariableDto 可以为 null
// 因为我们目前没有从 _variableAppService 获取它。
// 在实际应用中,你可能需要通过某种方式获取 VariableDto。
var context = new TriggerContext(trigger, currentValue, null);
await _actionExecutor.ExecuteActionAsync(context);