refactor: 移除 stats 统计功能

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scottxjw
2026-08-14 09:23:26 +08:00
parent 2b031995e1
commit f3472d21ee
7 changed files with 4 additions and 286 deletions

View File

@@ -1,112 +0,0 @@
using System.CommandLine;
using Gpulse.WCT.DataAnalyzer.Core.Application;
namespace Gpulse.WCT.DataAnalyzer.Commands;
/// <summary>
/// 统计查询命令
/// </summary>
public class StatsCommand : Command
{
public StatsCommand(StatsService statsService)
: base("stats", "Query statistics from database")
{
var summaryOption = new Option<bool>(
"--summary",
() => false,
"Show overall statistics summary"
);
var byFodTypeOption = new Option<bool>(
"--by-fod-type",
() => false,
"Show statistics by FOD type"
);
var byPanelOption = new Option<bool>(
"--by-panel",
() => false,
"Show statistics by TX panel"
);
var byHardwareOption = new Option<bool>(
"--by-hardware",
() => false,
"Show statistics by TX hardware version"
);
var byRxTypeOption = new Option<bool>(
"--by-rx-type",
() => false,
"Show statistics by RX type"
);
AddOption(summaryOption);
AddOption(byFodTypeOption);
AddOption(byPanelOption);
AddOption(byHardwareOption);
AddOption(byRxTypeOption);
this.SetHandler(async (summary, byFodType, byPanel, byHardware, byRxType) =>
{
// 如果没有指定任何选项,默认显示摘要
if (!summary && !byFodType && !byPanel && !byHardware && !byRxType)
{
summary = true;
}
if (summary)
{
var s = await statsService.GetSummaryAsync();
Console.WriteLine("=== Statistics Summary ===");
Console.WriteLine($" Scenarios: {s.ScenarioCount}");
Console.WriteLine($" Qfod Records: {s.QfodCount}");
Console.WriteLine($" Ploss Records: {s.PlossCount}");
Console.WriteLine($" TX Panels: {s.PanelCount}");
Console.WriteLine($" TX Hardware: {s.HardwareCount}");
Console.WriteLine($" TX Software: {s.SoftwareCount}");
Console.WriteLine($" RX Types: {s.RxTypeCount}");
}
if (byFodType)
{
Console.WriteLine("\n=== By FOD Type ===");
var stats = await statsService.GetStatsByFodTypeAsync();
foreach (var s in stats)
{
Console.WriteLine($" FOD Type {s.FodType}: {s.Count}");
}
}
if (byPanel)
{
Console.WriteLine("\n=== By TX Panel ===");
var stats = await statsService.GetStatsByPanelAsync();
foreach (var s in stats)
{
Console.WriteLine($" {s.Name}: {s.Count}");
}
}
if (byHardware)
{
Console.WriteLine("\n=== By TX Hardware ===");
var stats = await statsService.GetStatsByHardwareAsync();
foreach (var s in stats)
{
Console.WriteLine($" {s.Name}: {s.Count}");
}
}
if (byRxType)
{
Console.WriteLine("\n=== By RX Type ===");
var stats = await statsService.GetStatsByRxTypeAsync();
foreach (var s in stats)
{
Console.WriteLine($" {s.Name}: {s.Count}");
}
}
}, summaryOption, byFodTypeOption, byPanelOption, byHardwareOption, byRxTypeOption);
}
}

View File

@@ -74,7 +74,6 @@ public class Program
rootCommand.AddCommand(new ParseCommand(provider.GetRequiredService<ParseService>()));
rootCommand.AddCommand(new AggregateCommand(provider.GetRequiredService<AggregationService>()));
rootCommand.AddCommand(new StatsCommand(provider.GetRequiredService<StatsService>()));
rootCommand.AddCommand(new ExportCommand(provider.GetRequiredService<ExportService>()));
rootCommand.AddCommand(new CleanCommand(provider.GetRequiredService<CleanService>()));