Files
jsowell-charger-web/jsowell-pile/src/main/java/com/jsowell/pile/util/TouElectricityEstimateResult.java
jsowell 40c34fa49c fix: 修复无交易记录自动结算并增加分时电量观测对比
复用 settleOrder 主路径纠正状态/锁/实时数据取值等问题,补充 mock 单测与 sys_job SQL;交易记录到达时按实时曲线估算尖峰平谷仅打日志对比,不参与结算。
2026-08-12 16:17:31 +08:00

68 lines
3.1 KiB
Java

package com.jsowell.pile.util;
import java.math.BigDecimal;
/**
* 平台根据实时监测曲线估算的尖峰平谷电量(仅观测,不参与结算)。
*/
public class TouElectricityEstimateResult {
private BigDecimal sharp = BigDecimal.ZERO;
private BigDecimal peak = BigDecimal.ZERO;
private BigDecimal flat = BigDecimal.ZERO;
private BigDecimal valley = BigDecimal.ZERO;
/** 最后一条实时累计电量 */
private BigDecimal totalFromLastSample = BigDecimal.ZERO;
/** 各时段差分电量之和 */
private BigDecimal totalFromDeltas = BigDecimal.ZERO;
private int sampleCount;
private int positiveDeltaCount;
private int negativeOrZeroDeltaCount;
private int unmatchedPeriodCount;
private String note;
public BigDecimal getSharp() { return sharp; }
public void setSharp(BigDecimal sharp) { this.sharp = sharp; }
public BigDecimal getPeak() { return peak; }
public void setPeak(BigDecimal peak) { this.peak = peak; }
public BigDecimal getFlat() { return flat; }
public void setFlat(BigDecimal flat) { this.flat = flat; }
public BigDecimal getValley() { return valley; }
public void setValley(BigDecimal valley) { this.valley = valley; }
public BigDecimal getTotalFromLastSample() { return totalFromLastSample; }
public void setTotalFromLastSample(BigDecimal totalFromLastSample) { this.totalFromLastSample = totalFromLastSample; }
public BigDecimal getTotalFromDeltas() { return totalFromDeltas; }
public void setTotalFromDeltas(BigDecimal totalFromDeltas) { this.totalFromDeltas = totalFromDeltas; }
public int getSampleCount() { return sampleCount; }
public void setSampleCount(int sampleCount) { this.sampleCount = sampleCount; }
public int getPositiveDeltaCount() { return positiveDeltaCount; }
public void setPositiveDeltaCount(int positiveDeltaCount) { this.positiveDeltaCount = positiveDeltaCount; }
public int getNegativeOrZeroDeltaCount() { return negativeOrZeroDeltaCount; }
public void setNegativeOrZeroDeltaCount(int negativeOrZeroDeltaCount) { this.negativeOrZeroDeltaCount = negativeOrZeroDeltaCount; }
public int getUnmatchedPeriodCount() { return unmatchedPeriodCount; }
public void setUnmatchedPeriodCount(int unmatchedPeriodCount) { this.unmatchedPeriodCount = unmatchedPeriodCount; }
public String getNote() { return note; }
public void setNote(String note) { this.note = note; }
public void addToType(String timeType, BigDecimal delta) {
if (delta == null) {
return;
}
if ("1".equals(timeType)) {
sharp = sharp.add(delta);
} else if ("2".equals(timeType)) {
peak = peak.add(delta);
} else if ("3".equals(timeType)) {
flat = flat.add(delta);
} else if ("4".equals(timeType)) {
valley = valley.add(delta);
} else {
// 未知时段先记入平,并计数
flat = flat.add(delta);
unmatchedPeriodCount++;
}
totalFromDeltas = totalFromDeltas.add(delta);
positiveDeltaCount++;
}
}