mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-08 11:59:56 +08:00
@@ -281,27 +281,54 @@ message RemoteStopChargingResponse {
|
|||||||
optional string additionalInfo = 20;
|
optional string additionalInfo = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum DetailType {
|
||||||
|
PEAK_VALLEY = 0; // 峰谷电量明细
|
||||||
|
TIME_PERIOD = 1; // 时段电量明细
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeakValleyDetail {
|
||||||
|
string topEnergyKWh = 1; // 尖峰电量
|
||||||
|
string topAmountYuan = 2; // 尖峰电费
|
||||||
|
string peakEnergyKWh = 3; // 峰时电量
|
||||||
|
string peakAmountYuan = 4; // 峰时电费
|
||||||
|
string flatEnergyKWh = 5; // 平时电量
|
||||||
|
string flatAmountYuan = 6; // 平时电费
|
||||||
|
string valleyEnergyKWh = 7; // 谷时电量
|
||||||
|
string valleyAmountYuan = 8; // 谷时电费
|
||||||
|
string deepEnergyKWh = 9; // 深谷电量
|
||||||
|
string deepAmountYuan = 10; // 深谷电费
|
||||||
|
}
|
||||||
|
|
||||||
|
message TimePeriodDetail {
|
||||||
|
message PeriodItem {
|
||||||
|
int32 periodNo = 1; // 时段序号,从1开始
|
||||||
|
string startTime = 2; // 开始时间,格式 HH:mm:ss
|
||||||
|
string endTime = 3; // 结束时间,格式 HH:mm:ss
|
||||||
|
string energyKWh = 4; // 该时段电量
|
||||||
|
optional string amountYuan = 5; // 该时段电费,可选
|
||||||
|
}
|
||||||
|
repeated PeriodItem periods = 1; // 时段列表
|
||||||
|
}
|
||||||
|
|
||||||
|
message TransactionDetail {
|
||||||
|
DetailType type = 1; // 明细类型
|
||||||
|
optional PeakValleyDetail peakValley = 2; // 峰谷电量明细
|
||||||
|
optional TimePeriodDetail timePeriod = 3; // 时段电量明细
|
||||||
|
}
|
||||||
|
|
||||||
message TransactionRecord {
|
message TransactionRecord {
|
||||||
string pileCode = 4;
|
string pileCode = 4; // 充电桩编码
|
||||||
string gunCode = 5;
|
string gunCode = 5; // 枪编号
|
||||||
string tradeNo = 6;
|
string tradeNo = 6; // 交易流水号
|
||||||
int64 startTs = 51;
|
int64 startTs = 51; // 开始时间戳
|
||||||
int64 endTs = 52;
|
int64 endTs = 52; // 结束时间戳
|
||||||
string topEnergyKWh = 53;
|
string totalEnergyKWh = 53; // 总电量(必填)
|
||||||
string topAmountYuan = 54;
|
optional string totalAmountYuan = 54; // 总电费(可选)
|
||||||
string peakEnergyKWh = 55;
|
int64 tradeTs = 55; // 交易时间戳
|
||||||
string peakAmountYuan = 56;
|
string stopReason = 56; // 停止原因
|
||||||
string flatEnergyKWh = 57;
|
int64 pricingId = 57; // 计费ID
|
||||||
string flatAmountYuan = 58;
|
optional TransactionDetail detail = 58; // 电量电费明细
|
||||||
string valleyEnergyKWh = 59;
|
optional string additionalInfo = 20; // 附加信息
|
||||||
string valleyAmountYuan = 60;
|
|
||||||
string deepEnergyKWh = 61;
|
|
||||||
string deepAmountYuan = 62;
|
|
||||||
string totalEnergyKWh = 63;
|
|
||||||
string totalAmountYuan = 64;
|
|
||||||
int64 tradeTs = 65;
|
|
||||||
string stopReason = 66;
|
|
||||||
optional string additionalInfo = 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message BmsChargingErrorProto {
|
message BmsChargingErrorProto {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public enum YunKuaiChongDownlinkCmdEnum {
|
|||||||
|
|
||||||
REMOTE_STOP_CHARGING(0x36),
|
REMOTE_STOP_CHARGING(0x36),
|
||||||
|
|
||||||
TRANSACTION_RECORD(0x40),
|
TRANSACTION_RECORD_ACK(0x40),
|
||||||
|
|
||||||
REMOTE_PARALLEL_START_CHARGING(0xA4),
|
REMOTE_PARALLEL_START_CHARGING(0xA4),
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import sanbing.jcpp.protocol.yunkuaichong.annotation.YunKuaiChongCmd;
|
|||||||
|
|
||||||
import static sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage.FAILURE_BYTE;
|
import static sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage.FAILURE_BYTE;
|
||||||
import static sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage.SUCCESS_BYTE;
|
import static sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage.SUCCESS_BYTE;
|
||||||
import static sanbing.jcpp.protocol.yunkuaichong.enums.YunKuaiChongDownlinkCmdEnum.TRANSACTION_RECORD;
|
import static sanbing.jcpp.protocol.yunkuaichong.enums.YunKuaiChongDownlinkCmdEnum.TRANSACTION_RECORD_ACK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 云快充1.5.0 交易记录确认
|
* 云快充1.5.0 交易记录确认
|
||||||
@@ -46,7 +46,7 @@ public class YunKuaiChongV150TransactionRecordAckDLCmd extends YunKuaiChongDownl
|
|||||||
msgBody.writeBytes(encodeTradeNo(transactionRecordAck.getTradeNo()));
|
msgBody.writeBytes(encodeTradeNo(transactionRecordAck.getTradeNo()));
|
||||||
msgBody.writeByte(transactionRecordAck.getSuccess() ? SUCCESS_BYTE : FAILURE_BYTE);
|
msgBody.writeByte(transactionRecordAck.getSuccess() ? SUCCESS_BYTE : FAILURE_BYTE);
|
||||||
|
|
||||||
encodeAndWriteFlush(TRANSACTION_RECORD,
|
encodeAndWriteFlush(TRANSACTION_RECORD_ACK,
|
||||||
requestData.getSequenceNumber(),
|
requestData.getSequenceNumber(),
|
||||||
requestData.getEncryptionFlag(),
|
requestData.getEncryptionFlag(),
|
||||||
msgBody,
|
msgBody,
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import sanbing.jcpp.infrastructure.util.codec.BCDUtil;
|
import sanbing.jcpp.infrastructure.util.codec.BCDUtil;
|
||||||
import sanbing.jcpp.infrastructure.util.codec.CP56Time2aUtil;
|
import sanbing.jcpp.infrastructure.util.codec.CP56Time2aUtil;
|
||||||
import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
|
import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
|
||||||
import sanbing.jcpp.proto.gen.ProtocolProto.TransactionRecord;
|
import sanbing.jcpp.proto.gen.ProtocolProto.*;
|
||||||
import sanbing.jcpp.proto.gen.ProtocolProto.UplinkQueueMessage;
|
|
||||||
import sanbing.jcpp.protocol.ProtocolContext;
|
import sanbing.jcpp.protocol.ProtocolContext;
|
||||||
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
|
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
|
||||||
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkCmdExe;
|
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkCmdExe;
|
||||||
@@ -154,12 +153,8 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
String cardNo = BCDUtil.toString(cardNoBytes);
|
String cardNo = BCDUtil.toString(cardNoBytes);
|
||||||
additionalInfo.put("物理卡号", cardNo);
|
additionalInfo.put("物理卡号", cardNo);
|
||||||
|
|
||||||
TransactionRecord transactionRecord = TransactionRecord.newBuilder()
|
// 构建峰谷电量明细
|
||||||
.setPileCode(pileCode)
|
PeakValleyDetail peakValleyDetail = PeakValleyDetail.newBuilder()
|
||||||
.setGunCode(gunCode)
|
|
||||||
.setTradeNo(tradeNo)
|
|
||||||
.setStartTs(startTime.toEpochMilli())
|
|
||||||
.setEndTs(endTime.toEpochMilli())
|
|
||||||
.setTopEnergyKWh(topEnergy.toPlainString())
|
.setTopEnergyKWh(topEnergy.toPlainString())
|
||||||
.setTopAmountYuan(topAmount.toPlainString())
|
.setTopAmountYuan(topAmount.toPlainString())
|
||||||
.setPeakEnergyKWh(peakEnergy.toPlainString())
|
.setPeakEnergyKWh(peakEnergy.toPlainString())
|
||||||
@@ -168,10 +163,26 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
.setFlatAmountYuan(flatAmount.toPlainString())
|
.setFlatAmountYuan(flatAmount.toPlainString())
|
||||||
.setValleyEnergyKWh(valleyEnergy.toPlainString())
|
.setValleyEnergyKWh(valleyEnergy.toPlainString())
|
||||||
.setValleyAmountYuan(valleyAmount.toPlainString())
|
.setValleyAmountYuan(valleyAmount.toPlainString())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 构建交易明细
|
||||||
|
TransactionDetail transactionDetail = TransactionDetail.newBuilder()
|
||||||
|
.setType(DetailType.PEAK_VALLEY)
|
||||||
|
.setPeakValley(peakValleyDetail)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 构建交易记录
|
||||||
|
TransactionRecord transactionRecord = TransactionRecord.newBuilder()
|
||||||
|
.setPileCode(pileCode)
|
||||||
|
.setGunCode(gunCode)
|
||||||
|
.setTradeNo(tradeNo)
|
||||||
|
.setStartTs(startTime.toEpochMilli())
|
||||||
|
.setEndTs(endTime.toEpochMilli())
|
||||||
.setTotalEnergyKWh(totalEnergy.toPlainString())
|
.setTotalEnergyKWh(totalEnergy.toPlainString())
|
||||||
.setTotalAmountYuan(totalAmount.toPlainString())
|
.setTotalAmountYuan(totalAmount.toPlainString())
|
||||||
.setTradeTs(tradeTime.toEpochMilli())
|
.setTradeTs(tradeTime.toEpochMilli())
|
||||||
.setStopReason(stopReason)
|
.setStopReason(stopReason)
|
||||||
|
.setDetail(transactionDetail)
|
||||||
.setAdditionalInfo(additionalInfo.toString())
|
.setAdditionalInfo(additionalInfo.toString())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user