yeg
2026-09-05 27428b31edee97703b529559146cdd7eef87a7a9
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.battery.device.api;
 
import java.math.BigDecimal;
import java.time.Instant;
import java.util.List;
import com.battery.device.model.ChannelIdentity;
import com.battery.device.model.Measurement;
 
/** 供业务持久化使用的厂商无关测试数据观测扩展。 */
public interface TestDataObservationAdapter extends DeviceObservationAdapter
{
    CabinetRealtime latestCabinet(ChannelIdentity channel);
 
    CollectorRealtime latestCollector(long collectorId);
 
    List<StepRecord> stepRecords(ChannelIdentity channel);
 
    List<CycleRecord> cycleRecords(ChannelIdentity channel);
 
    long persistenceIntervalMillis(ChannelIdentity channel);
 
    record CabinetRealtime(long sequenceId, Instant deviceTime, double currentA, double voltageV,
            double capacityAh, double energyWh, int cycleNo, int stepNo, String stepName, String stepType,
            Instant serverReceivedAt) { }
 
    record CollectorRealtime(String collectorCode, boolean online, int sampleIntervalMs,
            List<CollectorMeasurement> measurements)
    {
        public CollectorRealtime { measurements = measurements == null ? List.of() : List.copyOf(measurements); }
    }
 
    record CollectorMeasurement(String channelCode, long sequenceId, Instant deviceTime, String deviceTimeRaw,
            Instant serverReceivedAt, String metricCode, BigDecimal value, String unit) { }
 
    record StepRecord(String sourceRecordId, int cycleNo, int stepNo, String stepName, String stepType,
            Instant startedAt, Instant endedAt, double endVoltageV, double capacityAh, double energyWh) { }
 
    record CycleRecord(String sourceRecordId, int cycleNo, Instant startedAt, Instant endedAt,
            double chargeCapacityAh, double dischargeCapacityAh, double chargeEnergyWh,
            double dischargeEnergyWh, double efficiency) { }
}