package com.ruoyi.system.service; import java.time.Instant; import java.util.List; import java.util.Map; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; /** 提供测试控制台的双状态实时事实与鉴权 SSE。 */ public interface ITestLiveService { /** 返回指定测试及其绑定来源的最新设备、接收和测试状态。 */ LiveState current(Long testId); /** 打开实时 SSE;连接初次发送当前事实,后续只推送最新快照。 */ SseEmitter stream(Long testId); record LiveState(Long testId, String testStatus, String receptionStatus, Instant updatedAt, List sources, List> exceptions, TestPlanSnapshot testPlan) { public LiveState(Long testId, String testStatus, String receptionStatus, Instant updatedAt, List sources, List> exceptions) { this(testId, testStatus, receptionStatus, updatedAt, sources, exceptions, null); } } record TestPlanSnapshot(int currentCycleNo, int currentStepNo, int plannedCycleCount, List rows) { } record TestPlanRow(String rowType, int stepNo, Integer cyclePosition, String stepName, double durationSeconds, Double voltageV, String executionStatus, Integer cycleCount, Long recordCount) { } record LiveSource(String sourceType, Long sourceId, String batteryNo, String deviceStatus, Map latestSnapshot) { } }