yeg
5 天以前 60a8c9d2bd33c3b1ec8085ccf28a969615955d94
battery-business/src/main/java/com/battery/business/service/impl/PushIngestAdapter.java
@@ -422,14 +422,23 @@
     */
    private enum StepDirection
    {
        CHARGE("charge"), DISCHARGE("discharge"), REST("rest"), UNKNOWN(null);
        CHARGE("charge", "充电"), DISCHARGE("discharge", "放电"), REST("rest", "搁置"), UNKNOWN(null, null);
        private final String label;
        private final String displayName;
        StepDirection(String label) { this.label = label; }
        StepDirection(String label, String displayName) { this.label = label; this.displayName = displayName; }
        /** 写进工步记录的类型:来源没给类型时交出的是判定出的方向名称,未知方向留空。 */
        String label() { return label; }
        /**
         * 交出去的工步名称。这类来源的工步方案里只有「步_N」这种标号,没有描述性名称
         * (2026-10-09 现场核对 .pcj:<Step StepLabel="步_1"> + CtrlTypeName=Rest/Current);
         * 而甲方软件那一列「状态」显示的就是充电/放电/搁置——所以用同一套词当工步名称,
         * 值同样来自电流符号判定,**不是设备给的名称**(现场清单与 ADR-0067 都记了这一条)。
         */
        String displayName() { return displayName; }
        /** 该工步自身累计的单项值。搁置段实测两向都不增长,所以它的累计是 0 而不是缺失。 */
        BigDecimal own(BigDecimal charge, BigDecimal discharge)
@@ -503,8 +512,10 @@
        putIfPresent(measurements, "dischargeEnergy", last.getDischargeEnergyWh());
        BigDecimal capacity = direction.own(last.getChargeCapacityAh(), last.getDischargeCapacityAh());
        BigDecimal energy = direction.own(last.getChargeEnergyWh(), last.getDischargeEnergyWh());
        // 工步名称用判定出的方向(充电/放电/搁置):该来源的方案里只有「步_N」标号,没有描述性名称,
        // 而甲方软件自己那一列「状态」显示的就是这三个词。它和方向同源,不是设备给的名称。
        return new StepRecord(sourceRecordId(sourceRef, "step", group.key().cycleNo() + ":" + group.key().stepNo()),
                group.key().cycleNo(), group.key().stepNo(), null, direction.label(), deviceTime(first),
                group.key().cycleNo(), group.key().stepNo(), direction.displayName(), direction.label(), deviceTime(first),
                deviceTime(last), decimal(last.getVoltageV()), decimal(last.getCurrentA()),
                capacity == null ? null : capacity.doubleValue(), energy == null ? null : energy.doubleValue(),
                last.getDeviceTimeRaw(), last.getTimezoneId(), receivedAt(last), measurements);