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
42
43
44
45
46
47
| package com.battery.device.model;
|
| import java.math.BigDecimal;
| import java.time.Instant;
| import java.util.List;
| import java.util.Map;
|
| public record RealtimeSnapshot(
| ChannelIdentity channel,
| DeviceWorkStatus workStatus,
| Integer cycleNo,
| Integer stepNo,
| String stepType,
| String barcode,
| BigDecimal currentA,
| BigDecimal voltageV,
| BigDecimal capacityAh,
| BigDecimal energyWh,
| Long totalTimeSeconds,
| Long relativeTimeSeconds,
| String logCode,
| Instant receivedAt,
| Map<String, Measurement> measurements,
| DeviceConnectionStatus connectionStatus,
| Instant deviceTime,
| List<PlannedStep> plannedSteps,
| String failureReason)
| {
| /** 兼容已有适配器调用的实时快照构造方式。 */
| public RealtimeSnapshot(ChannelIdentity channel, DeviceWorkStatus workStatus, Integer cycleNo, Integer stepNo,
| String stepType, String barcode, BigDecimal currentA, BigDecimal voltageV, BigDecimal capacityAh,
| BigDecimal energyWh, Long totalTimeSeconds, Long relativeTimeSeconds, String logCode, Instant receivedAt,
| Map<String, Measurement> measurements)
| {
| this(channel, workStatus, cycleNo, stepNo, stepType, barcode, currentA, voltageV, capacityAh, energyWh,
| totalTimeSeconds, relativeTimeSeconds, logCode, receivedAt, measurements,
| DeviceConnectionStatus.ONLINE, null, List.of(), null);
| }
|
| public RealtimeSnapshot
| {
| measurements = measurements == null ? Map.of() : Map.copyOf(measurements);
| plannedSteps = plannedSteps == null ? List.of() : List.copyOf(plannedSteps);
| connectionStatus = connectionStatus == null ? DeviceConnectionStatus.ONLINE : connectionStatus;
| failureReason = failureReason == null || failureReason.isBlank() ? null : failureReason.trim();
| }
| }
|
|