mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-05 02:19:56 +08:00
云快充1.5.0 金额单位修正
This commit is contained in:
@@ -108,9 +108,9 @@ CREATE TABLE IF NOT EXISTS jcpp_order
|
|||||||
pile_id uuid not null,
|
pile_id uuid not null,
|
||||||
gun_id uuid not null,
|
gun_id uuid not null,
|
||||||
plate_no varchar(64),
|
plate_no varchar(64),
|
||||||
settlement_amount bigint default 0 not null,
|
settlement_amount numeric(16, 8) default 0 not null,
|
||||||
settlement_details jsonb,
|
settlement_details jsonb,
|
||||||
electricity_quantity numeric(16, 9) default 0 not null
|
electricity_quantity numeric(16, 8) default 0 not null
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS uni_internal_order_no
|
CREATE UNIQUE INDEX IF NOT EXISTS uni_internal_order_no
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package sanbing.jcpp.app.dal.mapper;
|
package sanbing.jcpp.app.dal.mapper;
|
||||||
|
|
||||||
import cn.hutool.core.math.Money;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -53,7 +52,7 @@ public class OrderMapperTest extends AbstractTestBase {
|
|||||||
.pileId(NORMAL_PILE_ID[0])
|
.pileId(NORMAL_PILE_ID[0])
|
||||||
.gunId(NORMAL_GUN_ID[0])
|
.gunId(NORMAL_GUN_ID[0])
|
||||||
.plateNo("浙A88888")
|
.plateNo("浙A88888")
|
||||||
.settlementAmount(new Money(100D).getCent())
|
.settlementAmount(new BigDecimal(100))
|
||||||
.settlementDetails(JacksonUtil.newObjectNode())
|
.settlementDetails(JacksonUtil.newObjectNode())
|
||||||
.electricityQuantity(new BigDecimal("100"))
|
.electricityQuantity(new BigDecimal("100"))
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class Order implements Serializable {
|
|||||||
|
|
||||||
private String plateNo;
|
private String plateNo;
|
||||||
|
|
||||||
private Long settlementAmount;
|
private BigDecimal settlementAmount;
|
||||||
|
|
||||||
private JsonNode settlementDetails;
|
private JsonNode settlementDetails;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import sanbing.jcpp.infrastructure.queue.Callback;
|
|||||||
import sanbing.jcpp.proto.gen.ProtocolProto.*;
|
import sanbing.jcpp.proto.gen.ProtocolProto.*;
|
||||||
import sanbing.jcpp.protocol.domain.DownlinkCmdEnum;
|
import sanbing.jcpp.protocol.domain.DownlinkCmdEnum;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -150,10 +151,10 @@ public class DefaultPileProtocolService implements PileProtocolService {
|
|||||||
periods.add(createPeriod(4, LocalTime.parse("18:00"), LocalTime.parse("00:00"), VALLEY));
|
periods.add(createPeriod(4, LocalTime.parse("18:00"), LocalTime.parse("00:00"), VALLEY));
|
||||||
|
|
||||||
Map<PricingModelFlag, FlagPrice> flagPriceMap = new HashMap<>();
|
Map<PricingModelFlag, FlagPrice> flagPriceMap = new HashMap<>();
|
||||||
flagPriceMap.put(TOP, new FlagPrice(75, 45));
|
flagPriceMap.put(TOP, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45")));
|
||||||
flagPriceMap.put(PEAK, new FlagPrice(75, 45));
|
flagPriceMap.put(PEAK, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45")));
|
||||||
flagPriceMap.put(FLAT, new FlagPrice(75, 45));
|
flagPriceMap.put(FLAT, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45")));
|
||||||
flagPriceMap.put(VALLEY, new FlagPrice(75, 45));
|
flagPriceMap.put(VALLEY, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45")));
|
||||||
|
|
||||||
PricingModel model = new PricingModel();
|
PricingModel model = new PricingModel();
|
||||||
model.setId(UUID.randomUUID());
|
model.setId(UUID.randomUUID());
|
||||||
@@ -161,8 +162,8 @@ public class DefaultPileProtocolService implements PileProtocolService {
|
|||||||
model.setPileCode(pileCode);
|
model.setPileCode(pileCode);
|
||||||
model.setType(CHARGE);
|
model.setType(CHARGE);
|
||||||
model.setRule(SPLIT_TIME);
|
model.setRule(SPLIT_TIME);
|
||||||
model.setStandardElec(75);
|
model.setStandardElec(new BigDecimal("0.75"));
|
||||||
model.setStandardServ(45);
|
model.setStandardServ(new BigDecimal("0.45"));
|
||||||
model.setFlagPriceList(flagPriceMap);
|
model.setFlagPriceList(flagPriceMap);
|
||||||
model.setPeriodsList(periods);
|
model.setPeriodsList(periods);
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class ProtoConverter {
|
|||||||
// 设置字段
|
// 设置字段
|
||||||
builder.setType(PricingModelType.valueOf(pricingModel.getType().name()));
|
builder.setType(PricingModelType.valueOf(pricingModel.getType().name()));
|
||||||
builder.setRule(PricingModelRule.valueOf(pricingModel.getRule().name()));
|
builder.setRule(PricingModelRule.valueOf(pricingModel.getRule().name()));
|
||||||
builder.setStandardElec(pricingModel.getStandardElec());
|
builder.setStandardElec(pricingModel.getStandardElec().toPlainString());
|
||||||
builder.setStandardServ(pricingModel.getStandardServ());
|
builder.setStandardServ(pricingModel.getStandardServ().toPlainString());
|
||||||
|
|
||||||
// 转换 flagPriceList
|
// 转换 flagPriceList
|
||||||
for (Map.Entry<PricingModelFlag, FlagPrice> entry : pricingModel.getFlagPriceList().entrySet()) {
|
for (Map.Entry<PricingModelFlag, FlagPrice> entry : pricingModel.getFlagPriceList().entrySet()) {
|
||||||
@@ -34,8 +34,8 @@ public class ProtoConverter {
|
|||||||
|
|
||||||
FlagPriceProto flagPriceProto = FlagPriceProto.newBuilder()
|
FlagPriceProto flagPriceProto = FlagPriceProto.newBuilder()
|
||||||
.setFlag(PricingModelFlag.valueOf(flag.name())) // 枚举转换
|
.setFlag(PricingModelFlag.valueOf(flag.name())) // 枚举转换
|
||||||
.setElec(flagPrice.getElec())
|
.setElec(flagPrice.getElec().toPlainString())
|
||||||
.setServ(flagPrice.getServ())
|
.setServ(flagPrice.getServ().toPlainString())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
builder.putFlagPrice(flag.ordinal(), flagPriceProto); // 按 ordinal 值作为 key 存入
|
builder.putFlagPrice(flag.ordinal(), flagPriceProto); // 按 ordinal 值作为 key 存入
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelFlag;
|
|||||||
import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelRule;
|
import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelRule;
|
||||||
import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelType;
|
import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelType;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -29,14 +30,14 @@ public class PricingModel {
|
|||||||
private PricingModelRule rule;
|
private PricingModelRule rule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准电价(单位分)
|
* 标准电价(单位元)
|
||||||
*/
|
*/
|
||||||
private int standardElec;
|
private BigDecimal standardElec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准服务费(单位分)
|
* 标准服务费(单位元)
|
||||||
*/
|
*/
|
||||||
private int standardServ;
|
private BigDecimal standardServ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分时电价
|
* 分时电价
|
||||||
@@ -68,11 +69,11 @@ public class PricingModel {
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public static class FlagPrice {
|
public static class FlagPrice {
|
||||||
|
|
||||||
// 分时电价,单位分
|
// 分时电价,单位元
|
||||||
private int elec;
|
private BigDecimal elec;
|
||||||
|
|
||||||
// 分时服务费,单位分
|
// 分时服务费,单位元
|
||||||
private int serv;
|
private BigDecimal serv;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,8 +96,8 @@ message QueryPricingResponse {
|
|||||||
message PricingModelProto {
|
message PricingModelProto {
|
||||||
PricingModelType type = 3;
|
PricingModelType type = 3;
|
||||||
PricingModelRule rule = 4;
|
PricingModelRule rule = 4;
|
||||||
int32 standardElec = 5;
|
string standardElec = 5;
|
||||||
int32 standardServ = 6;
|
string standardServ = 6;
|
||||||
map<int32, FlagPriceProto> flagPrice = 8;
|
map<int32, FlagPriceProto> flagPrice = 8;
|
||||||
repeated PeriodProto period = 9;
|
repeated PeriodProto period = 9;
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@ message PeriodProto {
|
|||||||
|
|
||||||
message FlagPriceProto {
|
message FlagPriceProto {
|
||||||
PricingModelFlag flag = 1;
|
PricingModelFlag flag = 1;
|
||||||
int32 elec = 2;
|
string elec = 2;
|
||||||
int32 serv = 3;
|
string serv = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PricingModelType {
|
enum PricingModelType {
|
||||||
@@ -160,12 +160,12 @@ message ChargingProgressProto {
|
|||||||
string pileCode = 4;
|
string pileCode = 4;
|
||||||
string gunCode = 5;
|
string gunCode = 5;
|
||||||
string tradeNo = 6;
|
string tradeNo = 6;
|
||||||
float outputVoltage = 7;
|
string outputVoltage = 7;
|
||||||
float outputCurrent = 8;
|
string outputCurrent = 8;
|
||||||
float soc = 9;
|
int32 soc = 9;
|
||||||
int32 totalChargingDurationMin = 10;
|
int32 totalChargingDurationMin = 10;
|
||||||
float totalChargingEnergyKWh = 11;
|
string totalChargingEnergyKWh = 11;
|
||||||
int64 totalChargingCostCent = 12;
|
string totalChargingCostYuan = 12;
|
||||||
optional string additionalInfo = 20;
|
optional string additionalInfo = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ message RemoteStartChargingRequest {
|
|||||||
string pileCode = 4;
|
string pileCode = 4;
|
||||||
string gunCode = 5;
|
string gunCode = 5;
|
||||||
string tradeNo = 6;
|
string tradeNo = 6;
|
||||||
int32 limitCent = 7;
|
int32 limitYuan = 7;
|
||||||
optional string additionalInfo = 20;
|
optional string additionalInfo = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,18 +219,18 @@ message TransactionRecord {
|
|||||||
string tradeNo = 6;
|
string tradeNo = 6;
|
||||||
int64 startTs = 51;
|
int64 startTs = 51;
|
||||||
int64 endTs = 52;
|
int64 endTs = 52;
|
||||||
float topEnergyKWh = 53;
|
string topEnergyKWh = 53;
|
||||||
int64 topAmountCent = 54;
|
string topAmountYuan = 54;
|
||||||
float peakEnergyKWh = 55;
|
string peakEnergyKWh = 55;
|
||||||
int64 peakAmountCent = 56;
|
string peakAmountYuan = 56;
|
||||||
float flatEnergyKWh = 57;
|
string flatEnergyKWh = 57;
|
||||||
int64 flatAmountCent = 58;
|
string flatAmountYuan = 58;
|
||||||
float valleyEnergyKWh = 59;
|
string valleyEnergyKWh = 59;
|
||||||
int64 valleyAmountCent = 60;
|
string valleyAmountYuan = 60;
|
||||||
float deepEnergyKWh = 61;
|
string deepEnergyKWh = 61;
|
||||||
int64 deepAmountCent = 62;
|
string deepAmountYuan = 62;
|
||||||
float totalEnergyKWh = 63;
|
string totalEnergyKWh = 63;
|
||||||
int64 totalAmountCent = 64;
|
string totalAmountYuan = 64;
|
||||||
int64 tradeTs = 65;
|
int64 tradeTs = 65;
|
||||||
string stopReason = 66;
|
string stopReason = 66;
|
||||||
optional string additionalInfo = 20;
|
optional string additionalInfo = 20;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class DownlinkControllerTest extends AbstractProtocolTestBase {
|
|||||||
.setRemoteStartChargingRequest(ProtocolProto.RemoteStartChargingRequest.newBuilder()
|
.setRemoteStartChargingRequest(ProtocolProto.RemoteStartChargingRequest.newBuilder()
|
||||||
.setPileCode(pileCode)
|
.setPileCode(pileCode)
|
||||||
.setGunCode("01")
|
.setGunCode("01")
|
||||||
.setLimitCent(10000)
|
.setLimitYuan(100)
|
||||||
.setTradeNo("12345678901234567890")
|
.setTradeNo("12345678901234567890")
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe
|
|||||||
BigDecimal loseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4);
|
BigDecimal loseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4);
|
||||||
|
|
||||||
// 17.已充金额 (电费+服务费)*计损充电度数
|
// 17.已充金额 (电费+服务费)*计损充电度数
|
||||||
BigDecimal chargeAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal chargeAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 18.硬件故障 测试发现需要使用小端计算bit, 然后对照故障表查询故障码
|
// 18.硬件故障 测试发现需要使用小端计算bit, 然后对照故障表查询故障码
|
||||||
byte[] warnCodeBytes = new byte[2];
|
byte[] warnCodeBytes = new byte[2];
|
||||||
@@ -155,12 +155,12 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe
|
|||||||
.setPileCode(pileCode)
|
.setPileCode(pileCode)
|
||||||
.setGunCode(gunCode)
|
.setGunCode(gunCode)
|
||||||
.setTradeNo(tradeNo)
|
.setTradeNo(tradeNo)
|
||||||
.setOutputVoltage(outputVoltage.floatValue())
|
.setOutputVoltage(outputVoltage.toPlainString())
|
||||||
.setOutputCurrent(outputCurrent.floatValue())
|
.setOutputCurrent(outputCurrent.toPlainString())
|
||||||
.setSoc(soc)
|
.setSoc(soc)
|
||||||
.setTotalChargingDurationMin(totalChargeTime)
|
.setTotalChargingDurationMin(totalChargeTime)
|
||||||
.setTotalChargingEnergyKWh(loseEnergy.floatValue())
|
.setTotalChargingEnergyKWh(loseEnergy.toPlainString())
|
||||||
.setTotalChargingCostCent(chargeAmount.longValue())
|
.setTotalChargingCostYuan(chargeAmount.toPlainString())
|
||||||
.setAdditionalInfo(additionalInfo.toString());
|
.setAdditionalInfo(additionalInfo.toString());
|
||||||
|
|
||||||
UplinkQueueMessage chargingProgressMessage = uplinkMessageBuilder(pileCode, tcpSession, yunKuaiChongUplinkMessage)
|
UplinkQueueMessage chargingProgressMessage = uplinkMessageBuilder(pileCode, tcpSession, yunKuaiChongUplinkMessage)
|
||||||
@@ -169,7 +169,6 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe
|
|||||||
|
|
||||||
tcpSession.getForwarder().sendMessage(chargingProgressMessage);
|
tcpSession.getForwarder().sendMessage(chargingProgressMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class YunKuaiChongV150RemoteStartDLCmd extends YunKuaiChongDownlinkCmdExe
|
|||||||
String pileCode = remoteStartChargingRequest.getPileCode();
|
String pileCode = remoteStartChargingRequest.getPileCode();
|
||||||
String gunCode = remoteStartChargingRequest.getGunCode();
|
String gunCode = remoteStartChargingRequest.getGunCode();
|
||||||
String tradeNo = remoteStartChargingRequest.getTradeNo();
|
String tradeNo = remoteStartChargingRequest.getTradeNo();
|
||||||
int limitCent = remoteStartChargingRequest.getLimitCent();
|
int limitYuan = remoteStartChargingRequest.getLimitYuan();
|
||||||
|
|
||||||
byte[] cardNo = encodeCardNo(tradeNo);
|
byte[] cardNo = encodeCardNo(tradeNo);
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class YunKuaiChongV150RemoteStartDLCmd extends YunKuaiChongDownlinkCmdExe
|
|||||||
// 物理卡号
|
// 物理卡号
|
||||||
msgBody.writeBytes(cardNo);
|
msgBody.writeBytes(cardNo);
|
||||||
// 账户余额
|
// 账户余额
|
||||||
msgBody.writeIntLE(limitCent);
|
msgBody.writeIntLE(limitYuan);
|
||||||
|
|
||||||
encodeAndWriteFlush(REMOTE_START_CHARGING,
|
encodeAndWriteFlush(REMOTE_START_CHARGING,
|
||||||
msgBody,
|
msgBody,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class YunKuaiChongV150SetPricingModelDLCmd extends YunKuaiChongDownlinkCm
|
|||||||
setPricingAckMsgBody.writeBytes(encodePricingId(pricingId));
|
setPricingAckMsgBody.writeBytes(encodePricingId(pricingId));
|
||||||
|
|
||||||
// 4字节电价+4字节服务费
|
// 4字节电价+4字节服务费
|
||||||
BigDecimal accurate = new BigDecimal(1000);
|
BigDecimal accurate = new BigDecimal(100000);
|
||||||
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(TOP.ordinal()).getElec()).multiply(accurate).intValue());
|
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(TOP.ordinal()).getElec()).multiply(accurate).intValue());
|
||||||
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(TOP.ordinal()).getServ()).multiply(accurate).intValue());
|
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(TOP.ordinal()).getServ()).multiply(accurate).intValue());
|
||||||
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(PEAK.ordinal()).getElec()).multiply(accurate).intValue());
|
setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(PEAK.ordinal()).getElec()).multiply(accurate).intValue());
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
Instant endTime = CP56Time2aUtil.decode(endTimeBytes);
|
Instant endTime = CP56Time2aUtil.decode(endTimeBytes);
|
||||||
|
|
||||||
// 6.尖单价
|
// 6.尖单价
|
||||||
BigDecimal topPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000);
|
BigDecimal topPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000);
|
||||||
additionalInfo.put("尖单价", topPrice);
|
additionalInfo.put("尖单价", topPrice);
|
||||||
// 7. 尖电量
|
// 7. 尖电量
|
||||||
BigDecimal topEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal topEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
@@ -71,10 +71,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
BigDecimal topLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal topLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
additionalInfo.put("计损尖电量", topLoseEnergy);
|
additionalInfo.put("计损尖电量", topLoseEnergy);
|
||||||
// 9.尖金额
|
// 9.尖金额
|
||||||
BigDecimal topAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal topAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 10.峰单价
|
// 10.峰单价
|
||||||
BigDecimal peakPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000);
|
BigDecimal peakPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000);
|
||||||
additionalInfo.put("峰单价", peakPrice);
|
additionalInfo.put("峰单价", peakPrice);
|
||||||
// 11. 峰电量
|
// 11. 峰电量
|
||||||
BigDecimal peakEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal peakEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
@@ -82,10 +82,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
BigDecimal peakLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal peakLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
additionalInfo.put("计损峰电量", peakLoseEnergy);
|
additionalInfo.put("计损峰电量", peakLoseEnergy);
|
||||||
// 13.峰金额
|
// 13.峰金额
|
||||||
BigDecimal peakAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal peakAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 14.平单价
|
// 14.平单价
|
||||||
BigDecimal flatPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000);
|
BigDecimal flatPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000);
|
||||||
additionalInfo.put("平单价", flatPrice);
|
additionalInfo.put("平单价", flatPrice);
|
||||||
// 15. 平电量
|
// 15. 平电量
|
||||||
BigDecimal flatEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal flatEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
@@ -93,10 +93,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
BigDecimal flatLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal flatLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
additionalInfo.put("计损平电量", flatLoseEnergy);
|
additionalInfo.put("计损平电量", flatLoseEnergy);
|
||||||
// 17.平金额
|
// 17.平金额
|
||||||
BigDecimal flatAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal flatAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 18.谷单价
|
// 18.谷单价
|
||||||
BigDecimal valleyPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000);
|
BigDecimal valleyPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000);
|
||||||
additionalInfo.put("谷单价", valleyPrice);
|
additionalInfo.put("谷单价", valleyPrice);
|
||||||
// 19. 谷电量
|
// 19. 谷电量
|
||||||
BigDecimal valleyEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal valleyEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
@@ -104,7 +104,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
BigDecimal valleyLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
BigDecimal valleyLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
additionalInfo.put("计损谷电量", valleyLoseEnergy);
|
additionalInfo.put("计损谷电量", valleyLoseEnergy);
|
||||||
// 21.谷金额
|
// 21.谷金额
|
||||||
BigDecimal valleyAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal valleyAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 22.电表总起值
|
// 22.电表总起值
|
||||||
byte[] meterStartValueBytes = new byte[5];
|
byte[] meterStartValueBytes = new byte[5];
|
||||||
@@ -124,7 +124,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
BigDecimal totalLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4);
|
BigDecimal totalLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4);
|
||||||
additionalInfo.put("计损总电量", totalLoseEnergy);
|
additionalInfo.put("计损总电量", totalLoseEnergy);
|
||||||
// 26 .消费金额
|
// 26 .消费金额
|
||||||
BigDecimal totalAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100);
|
BigDecimal totalAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000);
|
||||||
|
|
||||||
// 27.电动汽车唯一标识
|
// 27.电动汽车唯一标识
|
||||||
byte[] carVINBytes = new byte[17];
|
byte[] carVINBytes = new byte[17];
|
||||||
@@ -157,16 +157,16 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm
|
|||||||
.setTradeNo(tradeNo)
|
.setTradeNo(tradeNo)
|
||||||
.setStartTs(startTime.toEpochMilli())
|
.setStartTs(startTime.toEpochMilli())
|
||||||
.setEndTs(endTime.toEpochMilli())
|
.setEndTs(endTime.toEpochMilli())
|
||||||
.setTopEnergyKWh(topEnergy.floatValue())
|
.setTopEnergyKWh(topEnergy.toPlainString())
|
||||||
.setTopAmountCent(topAmount.longValue())
|
.setTopAmountYuan(topAmount.toPlainString())
|
||||||
.setPeakEnergyKWh(peakEnergy.floatValue())
|
.setPeakEnergyKWh(peakEnergy.toPlainString())
|
||||||
.setPeakAmountCent(peakAmount.longValue())
|
.setPeakAmountYuan(peakAmount.toPlainString())
|
||||||
.setFlatEnergyKWh(flatEnergy.floatValue())
|
.setFlatEnergyKWh(flatEnergy.toPlainString())
|
||||||
.setFlatAmountCent(flatAmount.longValue())
|
.setFlatAmountYuan(flatAmount.toPlainString())
|
||||||
.setValleyEnergyKWh(valleyEnergy.floatValue())
|
.setValleyEnergyKWh(valleyEnergy.toPlainString())
|
||||||
.setValleyAmountCent(valleyAmount.longValue())
|
.setValleyAmountYuan(valleyAmount.toPlainString())
|
||||||
.setTotalEnergyKWh(totalEnergy.floatValue())
|
.setTotalEnergyKWh(totalEnergy.toPlainString())
|
||||||
.setTotalAmountCent(totalAmount.longValue())
|
.setTotalAmountYuan(totalAmount.toPlainString())
|
||||||
.setTradeTs(tradeTime.toEpochMilli())
|
.setTradeTs(tradeTime.toEpochMilli())
|
||||||
.setStopReason(stopReason)
|
.setStopReason(stopReason)
|
||||||
.setAdditionalInfo(additionalInfo.toString())
|
.setAdditionalInfo(additionalInfo.toString())
|
||||||
|
|||||||
Reference in New Issue
Block a user