|
|
@@ -209,4 +209,28 @@ public class S8ExceptionService : ITransient
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// S2-EW:debug-only 软删 RelatedObjectCode 以 "TEST_G09_" 开头的异常。
|
|
|
+ /// 调用方仅限 <see cref="Controllers.S8.AdoS8WatchDebugController"/>,由其 _debugEndpointEnabled 守门。
|
|
|
+ /// 实现纪律:
|
|
|
+ /// - 仅 SET IsDeleted=true,不动业务字段(status/closed_at/source_rule_id 等)。
|
|
|
+ /// - 前缀字面量硬编码,不接受外部 prefix;防止前缀注入。
|
|
|
+ /// - 不联动 timeline / decision / evidence;业务读路径以父 IsDeleted 屏蔽。
|
|
|
+ /// </summary>
|
|
|
+ public async Task<int> SoftDeleteTestPrefixAsync(long tenantId, long factoryId)
|
|
|
+ {
|
|
|
+ const string prefix = "TEST_G09_";
|
|
|
+ var affected = await _rep.AsUpdateable()
|
|
|
+ .SetColumns(e => new AdoS8Exception { IsDeleted = true })
|
|
|
+ .Where(e => e.TenantId == tenantId
|
|
|
+ && e.FactoryId == factoryId
|
|
|
+ && !e.IsDeleted
|
|
|
+ && e.RelatedObjectCode != null
|
|
|
+ && e.RelatedObjectCode.StartsWith(prefix))
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ System.Diagnostics.Trace.TraceWarning(
|
|
|
+ $"[S2-EW] soft-deleted {affected} TEST_G09_ exceptions, tenant={tenantId} factory={factoryId}");
|
|
|
+ return affected;
|
|
|
+ }
|
|
|
}
|