From ecda209644fb0e8fc36d7ca8cad12f78dccbb79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E4=B8=99?= Date: Tue, 8 Oct 2024 16:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=BF=AB=E5=85=851.5.0=20=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=8D=95=E4=BD=8D=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/schema/schema-postgres.sql | 4 +- .../jcpp/app/dal/mapper/OrderMapperTest.java | 3 +- .../sanbing/jcpp/app/dal/entity/Order.java | 2 +- .../impl/DefaultPileProtocolService.java | 13 +++--- .../infrastructure/proto/ProtoConverter.java | 8 ++-- .../proto/model/PricingModel.java | 17 +++---- .../src/main/proto/protocol.proto | 44 +++++++++---------- .../adapter/DownlinkControllerTest.java | 2 +- .../YunKuaiChongV150RealTimeDataULCmd.java | 11 +++-- .../cmd/YunKuaiChongV150RemoteStartDLCmd.java | 4 +- .../YunKuaiChongV150SetPricingModelDLCmd.java | 2 +- ...unKuaiChongV150TransactionRecordULCmd.java | 38 ++++++++-------- 12 files changed, 74 insertions(+), 74 deletions(-) diff --git a/docker/schema/schema-postgres.sql b/docker/schema/schema-postgres.sql index ee2c0be..47d1ce0 100644 --- a/docker/schema/schema-postgres.sql +++ b/docker/schema/schema-postgres.sql @@ -108,9 +108,9 @@ CREATE TABLE IF NOT EXISTS jcpp_order pile_id uuid not null, gun_id uuid not null, plate_no varchar(64), - settlement_amount bigint default 0 not null, + settlement_amount numeric(16, 8) default 0 not null, 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 diff --git a/jcpp-app-bootstrap/src/test/java/sanbing/jcpp/app/dal/mapper/OrderMapperTest.java b/jcpp-app-bootstrap/src/test/java/sanbing/jcpp/app/dal/mapper/OrderMapperTest.java index eb2a24f..dcc0aa8 100644 --- a/jcpp-app-bootstrap/src/test/java/sanbing/jcpp/app/dal/mapper/OrderMapperTest.java +++ b/jcpp-app-bootstrap/src/test/java/sanbing/jcpp/app/dal/mapper/OrderMapperTest.java @@ -4,7 +4,6 @@ */ package sanbing.jcpp.app.dal.mapper; -import cn.hutool.core.math.Money; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import jakarta.annotation.Resource; @@ -53,7 +52,7 @@ public class OrderMapperTest extends AbstractTestBase { .pileId(NORMAL_PILE_ID[0]) .gunId(NORMAL_GUN_ID[0]) .plateNo("浙A88888") - .settlementAmount(new Money(100D).getCent()) + .settlementAmount(new BigDecimal(100)) .settlementDetails(JacksonUtil.newObjectNode()) .electricityQuantity(new BigDecimal("100")) .build(); diff --git a/jcpp-app/src/main/java/sanbing/jcpp/app/dal/entity/Order.java b/jcpp-app/src/main/java/sanbing/jcpp/app/dal/entity/Order.java index e86b1b1..4e18e40 100644 --- a/jcpp-app/src/main/java/sanbing/jcpp/app/dal/entity/Order.java +++ b/jcpp-app/src/main/java/sanbing/jcpp/app/dal/entity/Order.java @@ -59,7 +59,7 @@ public class Order implements Serializable { private String plateNo; - private Long settlementAmount; + private BigDecimal settlementAmount; private JsonNode settlementDetails; diff --git a/jcpp-app/src/main/java/sanbing/jcpp/app/service/impl/DefaultPileProtocolService.java b/jcpp-app/src/main/java/sanbing/jcpp/app/service/impl/DefaultPileProtocolService.java index 6699c10..87d114c 100644 --- a/jcpp-app/src/main/java/sanbing/jcpp/app/service/impl/DefaultPileProtocolService.java +++ b/jcpp-app/src/main/java/sanbing/jcpp/app/service/impl/DefaultPileProtocolService.java @@ -22,6 +22,7 @@ import sanbing.jcpp.infrastructure.queue.Callback; import sanbing.jcpp.proto.gen.ProtocolProto.*; import sanbing.jcpp.protocol.domain.DownlinkCmdEnum; +import java.math.BigDecimal; import java.time.LocalTime; 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)); Map flagPriceMap = new HashMap<>(); - flagPriceMap.put(TOP, new FlagPrice(75, 45)); - flagPriceMap.put(PEAK, new FlagPrice(75, 45)); - flagPriceMap.put(FLAT, new FlagPrice(75, 45)); - flagPriceMap.put(VALLEY, new FlagPrice(75, 45)); + flagPriceMap.put(TOP, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45"))); + flagPriceMap.put(PEAK, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45"))); + flagPriceMap.put(FLAT, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45"))); + flagPriceMap.put(VALLEY, new FlagPrice(new BigDecimal("0.75"), new BigDecimal("0.45"))); PricingModel model = new PricingModel(); model.setId(UUID.randomUUID()); @@ -161,8 +162,8 @@ public class DefaultPileProtocolService implements PileProtocolService { model.setPileCode(pileCode); model.setType(CHARGE); model.setRule(SPLIT_TIME); - model.setStandardElec(75); - model.setStandardServ(45); + model.setStandardElec(new BigDecimal("0.75")); + model.setStandardServ(new BigDecimal("0.45")); model.setFlagPriceList(flagPriceMap); model.setPeriodsList(periods); diff --git a/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/ProtoConverter.java b/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/ProtoConverter.java index 6d91913..def0edb 100644 --- a/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/ProtoConverter.java +++ b/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/ProtoConverter.java @@ -24,8 +24,8 @@ public class ProtoConverter { // 设置字段 builder.setType(PricingModelType.valueOf(pricingModel.getType().name())); builder.setRule(PricingModelRule.valueOf(pricingModel.getRule().name())); - builder.setStandardElec(pricingModel.getStandardElec()); - builder.setStandardServ(pricingModel.getStandardServ()); + builder.setStandardElec(pricingModel.getStandardElec().toPlainString()); + builder.setStandardServ(pricingModel.getStandardServ().toPlainString()); // 转换 flagPriceList for (Map.Entry entry : pricingModel.getFlagPriceList().entrySet()) { @@ -34,8 +34,8 @@ public class ProtoConverter { FlagPriceProto flagPriceProto = FlagPriceProto.newBuilder() .setFlag(PricingModelFlag.valueOf(flag.name())) // 枚举转换 - .setElec(flagPrice.getElec()) - .setServ(flagPrice.getServ()) + .setElec(flagPrice.getElec().toPlainString()) + .setServ(flagPrice.getServ().toPlainString()) .build(); builder.putFlagPrice(flag.ordinal(), flagPriceProto); // 按 ordinal 值作为 key 存入 diff --git a/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/model/PricingModel.java b/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/model/PricingModel.java index c80631f..1a2191a 100644 --- a/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/model/PricingModel.java +++ b/jcpp-infrastructure-proto/src/main/java/sanbing/jcpp/infrastructure/proto/model/PricingModel.java @@ -9,6 +9,7 @@ import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelFlag; import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelRule; import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelType; +import java.math.BigDecimal; import java.time.LocalTime; import java.util.List; import java.util.Map; @@ -29,14 +30,14 @@ public class PricingModel { private PricingModelRule rule; /** - * 标准电价(单位分) + * 标准电价(单位元) */ - private int standardElec; + private BigDecimal standardElec; /** - * 标准服务费(单位分) + * 标准服务费(单位元) */ - private int standardServ; + private BigDecimal standardServ; /** * 分时电价 @@ -68,11 +69,11 @@ public class PricingModel { @NoArgsConstructor public static class FlagPrice { - // 分时电价,单位分 - private int elec; + // 分时电价,单位元 + private BigDecimal elec; - // 分时服务费,单位分 - private int serv; + // 分时服务费,单位元 + private BigDecimal serv; } } \ No newline at end of file diff --git a/jcpp-infrastructure-proto/src/main/proto/protocol.proto b/jcpp-infrastructure-proto/src/main/proto/protocol.proto index bd3ee09..5834455 100644 --- a/jcpp-infrastructure-proto/src/main/proto/protocol.proto +++ b/jcpp-infrastructure-proto/src/main/proto/protocol.proto @@ -96,8 +96,8 @@ message QueryPricingResponse { message PricingModelProto { PricingModelType type = 3; PricingModelRule rule = 4; - int32 standardElec = 5; - int32 standardServ = 6; + string standardElec = 5; + string standardServ = 6; map flagPrice = 8; repeated PeriodProto period = 9; } @@ -111,8 +111,8 @@ message PeriodProto { message FlagPriceProto { PricingModelFlag flag = 1; - int32 elec = 2; - int32 serv = 3; + string elec = 2; + string serv = 3; } enum PricingModelType { @@ -160,12 +160,12 @@ message ChargingProgressProto { string pileCode = 4; string gunCode = 5; string tradeNo = 6; - float outputVoltage = 7; - float outputCurrent = 8; - float soc = 9; + string outputVoltage = 7; + string outputCurrent = 8; + int32 soc = 9; int32 totalChargingDurationMin = 10; - float totalChargingEnergyKWh = 11; - int64 totalChargingCostCent = 12; + string totalChargingEnergyKWh = 11; + string totalChargingCostYuan = 12; optional string additionalInfo = 20; } @@ -185,7 +185,7 @@ message RemoteStartChargingRequest { string pileCode = 4; string gunCode = 5; string tradeNo = 6; - int32 limitCent = 7; + int32 limitYuan = 7; optional string additionalInfo = 20; } @@ -219,18 +219,18 @@ message TransactionRecord { string tradeNo = 6; int64 startTs = 51; int64 endTs = 52; - float topEnergyKWh = 53; - int64 topAmountCent = 54; - float peakEnergyKWh = 55; - int64 peakAmountCent = 56; - float flatEnergyKWh = 57; - int64 flatAmountCent = 58; - float valleyEnergyKWh = 59; - int64 valleyAmountCent = 60; - float deepEnergyKWh = 61; - int64 deepAmountCent = 62; - float totalEnergyKWh = 63; - int64 totalAmountCent = 64; + string topEnergyKWh = 53; + string topAmountYuan = 54; + string peakEnergyKWh = 55; + string peakAmountYuan = 56; + string flatEnergyKWh = 57; + string flatAmountYuan = 58; + string valleyEnergyKWh = 59; + 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; diff --git a/jcpp-protocol-bootstrap/src/test/java/sanbing/jcpp/protocol/adapter/DownlinkControllerTest.java b/jcpp-protocol-bootstrap/src/test/java/sanbing/jcpp/protocol/adapter/DownlinkControllerTest.java index fb5c959..016175b 100644 --- a/jcpp-protocol-bootstrap/src/test/java/sanbing/jcpp/protocol/adapter/DownlinkControllerTest.java +++ b/jcpp-protocol-bootstrap/src/test/java/sanbing/jcpp/protocol/adapter/DownlinkControllerTest.java @@ -128,7 +128,7 @@ class DownlinkControllerTest extends AbstractProtocolTestBase { .setRemoteStartChargingRequest(ProtocolProto.RemoteStartChargingRequest.newBuilder() .setPileCode(pileCode) .setGunCode("01") - .setLimitCent(10000) + .setLimitYuan(100) .setTradeNo("12345678901234567890") .build()) .build(); diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RealTimeDataULCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RealTimeDataULCmd.java index 4b5db9e..0512ae6 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RealTimeDataULCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RealTimeDataULCmd.java @@ -122,7 +122,7 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe BigDecimal loseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4); // 17.已充金额 (电费+服务费)*计损充电度数 - BigDecimal chargeAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal chargeAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 18.硬件故障 测试发现需要使用小端计算bit, 然后对照故障表查询故障码 byte[] warnCodeBytes = new byte[2]; @@ -155,12 +155,12 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe .setPileCode(pileCode) .setGunCode(gunCode) .setTradeNo(tradeNo) - .setOutputVoltage(outputVoltage.floatValue()) - .setOutputCurrent(outputCurrent.floatValue()) + .setOutputVoltage(outputVoltage.toPlainString()) + .setOutputCurrent(outputCurrent.toPlainString()) .setSoc(soc) .setTotalChargingDurationMin(totalChargeTime) - .setTotalChargingEnergyKWh(loseEnergy.floatValue()) - .setTotalChargingCostCent(chargeAmount.longValue()) + .setTotalChargingEnergyKWh(loseEnergy.toPlainString()) + .setTotalChargingCostYuan(chargeAmount.toPlainString()) .setAdditionalInfo(additionalInfo.toString()); UplinkQueueMessage chargingProgressMessage = uplinkMessageBuilder(pileCode, tcpSession, yunKuaiChongUplinkMessage) @@ -169,7 +169,6 @@ public class YunKuaiChongV150RealTimeDataULCmd extends YunKuaiChongUplinkCmdExe tcpSession.getForwarder().sendMessage(chargingProgressMessage); } - } /** diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RemoteStartDLCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RemoteStartDLCmd.java index 27064f4..9846f10 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RemoteStartDLCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150RemoteStartDLCmd.java @@ -39,7 +39,7 @@ public class YunKuaiChongV150RemoteStartDLCmd extends YunKuaiChongDownlinkCmdExe String pileCode = remoteStartChargingRequest.getPileCode(); String gunCode = remoteStartChargingRequest.getGunCode(); String tradeNo = remoteStartChargingRequest.getTradeNo(); - int limitCent = remoteStartChargingRequest.getLimitCent(); + int limitYuan = remoteStartChargingRequest.getLimitYuan(); byte[] cardNo = encodeCardNo(tradeNo); @@ -55,7 +55,7 @@ public class YunKuaiChongV150RemoteStartDLCmd extends YunKuaiChongDownlinkCmdExe // 物理卡号 msgBody.writeBytes(cardNo); // 账户余额 - msgBody.writeIntLE(limitCent); + msgBody.writeIntLE(limitYuan); encodeAndWriteFlush(REMOTE_START_CHARGING, msgBody, diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150SetPricingModelDLCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150SetPricingModelDLCmd.java index bd94432..44b066e 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150SetPricingModelDLCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150SetPricingModelDLCmd.java @@ -59,7 +59,7 @@ public class YunKuaiChongV150SetPricingModelDLCmd extends YunKuaiChongDownlinkCm setPricingAckMsgBody.writeBytes(encodePricingId(pricingId)); // 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()).getServ()).multiply(accurate).intValue()); setPricingAckMsgBody.writeIntLE(new BigDecimal(flagPriceMap.get(PEAK.ordinal()).getElec()).multiply(accurate).intValue()); diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150TransactionRecordULCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150TransactionRecordULCmd.java index 931386b..8fbdf8b 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150TransactionRecordULCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150TransactionRecordULCmd.java @@ -63,7 +63,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm Instant endTime = CP56Time2aUtil.decode(endTimeBytes); // 6.尖单价 - BigDecimal topPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000); + BigDecimal topPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000); additionalInfo.put("尖单价", topPrice); // 7. 尖电量 BigDecimal topEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); @@ -71,10 +71,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm BigDecimal topLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); additionalInfo.put("计损尖电量", topLoseEnergy); // 9.尖金额 - BigDecimal topAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal topAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 10.峰单价 - BigDecimal peakPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000); + BigDecimal peakPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000); additionalInfo.put("峰单价", peakPrice); // 11. 峰电量 BigDecimal peakEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); @@ -82,10 +82,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm BigDecimal peakLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); additionalInfo.put("计损峰电量", peakLoseEnergy); // 13.峰金额 - BigDecimal peakAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal peakAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 14.平单价 - BigDecimal flatPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000); + BigDecimal flatPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000); additionalInfo.put("平单价", flatPrice); // 15. 平电量 BigDecimal flatEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); @@ -93,10 +93,10 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm BigDecimal flatLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); additionalInfo.put("计损平电量", flatLoseEnergy); // 17.平金额 - BigDecimal flatAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal flatAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 18.谷单价 - BigDecimal valleyPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 1000); + BigDecimal valleyPrice = reduceMagnification(byteBuf.readUnsignedIntLE(), 100000); additionalInfo.put("谷单价", valleyPrice); // 19. 谷电量 BigDecimal valleyEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); @@ -104,7 +104,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm BigDecimal valleyLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); additionalInfo.put("计损谷电量", valleyLoseEnergy); // 21.谷金额 - BigDecimal valleyAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal valleyAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 22.电表总起值 byte[] meterStartValueBytes = new byte[5]; @@ -124,7 +124,7 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm BigDecimal totalLoseEnergy = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000, 4); additionalInfo.put("计损总电量", totalLoseEnergy); // 26 .消费金额 - BigDecimal totalAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 100); + BigDecimal totalAmount = reduceMagnification(byteBuf.readUnsignedIntLE(), 10000); // 27.电动汽车唯一标识 byte[] carVINBytes = new byte[17]; @@ -157,16 +157,16 @@ public class YunKuaiChongV150TransactionRecordULCmd extends YunKuaiChongUplinkCm .setTradeNo(tradeNo) .setStartTs(startTime.toEpochMilli()) .setEndTs(endTime.toEpochMilli()) - .setTopEnergyKWh(topEnergy.floatValue()) - .setTopAmountCent(topAmount.longValue()) - .setPeakEnergyKWh(peakEnergy.floatValue()) - .setPeakAmountCent(peakAmount.longValue()) - .setFlatEnergyKWh(flatEnergy.floatValue()) - .setFlatAmountCent(flatAmount.longValue()) - .setValleyEnergyKWh(valleyEnergy.floatValue()) - .setValleyAmountCent(valleyAmount.longValue()) - .setTotalEnergyKWh(totalEnergy.floatValue()) - .setTotalAmountCent(totalAmount.longValue()) + .setTopEnergyKWh(topEnergy.toPlainString()) + .setTopAmountYuan(topAmount.toPlainString()) + .setPeakEnergyKWh(peakEnergy.toPlainString()) + .setPeakAmountYuan(peakAmount.toPlainString()) + .setFlatEnergyKWh(flatEnergy.toPlainString()) + .setFlatAmountYuan(flatAmount.toPlainString()) + .setValleyEnergyKWh(valleyEnergy.toPlainString()) + .setValleyAmountYuan(valleyAmount.toPlainString()) + .setTotalEnergyKWh(totalEnergy.toPlainString()) + .setTotalAmountYuan(totalAmount.toPlainString()) .setTradeTs(tradeTime.toEpochMilli()) .setStopReason(stopReason) .setAdditionalInfo(additionalInfo.toString())