yeg
2026-09-29 b78295e8da96c3e5e76befeef9582ce5273dbb74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.battery.business.service;
 
import java.time.Instant;
import java.util.List;
import java.util.Map;
 
/** 分别提供测试、接收及设备实时事实与鉴权 SSE。 */
public interface ITestLiveService
{
    /** 返回指定测试及其绑定来源的最新设备、接收和测试状态。 */
    LiveState current(Long testId);
 
    /** 当前观测快照;updatedAt 为毫秒时间戳,不代表历史数据已完整接收。 */
    record LiveState(Long testId, String testStatus, String receptionStatus, long updatedAt,
            List<LiveSource> sources, List<Map<String, Object>> exceptions, TestPlanSnapshot testPlan)
    {
        public LiveState(Long testId, String testStatus, String receptionStatus, Instant updatedAt,
                List<LiveSource> sources, List<Map<String, Object>> exceptions)
        { this(testId, testStatus, receptionStatus, updatedAt.toEpochMilli(), sources, exceptions, null); }
    }
    record TestPlanSnapshot(int currentCycleNo, int currentStepNo, int plannedCycleCount,
            List<TestPlanRow> 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<String, Object> latestSnapshot) { }
}