From 8bf1f6ac60d472aee64de009afbd0e3e664623ab Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 28 Feb 2022 16:37:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E8=B4=B9=E7=8E=87=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java index df136235..5bb47302 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java @@ -135,7 +135,7 @@ public class RealtimeDataLogic implements ServiceLogic { if (socInt != 0) cacheOrder.put("endSoc", socInt); if (cachePile.get("version").equals("0B")) { final String hex = realtimeData.getHex(); - String cdhex = hex.substring(0x40 * 2 + 3, hex.length() - 4); + String cdhex = hex.substring(0x40 * 2 + 4, hex.length() - 4); if (cdhex.length() > 0) { cacheOrder.put("em1", calcem(cdhex)); } @@ -264,9 +264,9 @@ public class RealtimeDataLogic implements ServiceLogic { public static List calcem(String hex) { - int sumPeriod = Integer.parseInt(hex.substring(30, 32), 16); + int sumPeriod = Integer.parseInt(hex.substring(28, 30), 16); List cds = new ArrayList<>(); - for (int i = 32; i <= sumPeriod * 16 + 32; i = i + 16) { // todo + for (int i = 38; i < 38 + sumPeriod * 16; i = i + 16) { // todo ChargeDetails cd = new ChargeDetails(); cd.setDetailPower(HexUtils.reverseHexInt(hex.substring(i, i + 8)) / 100000.0); cd.setDetailElecMoney(HexUtils.reverseHexInt(hex.substring(i + 8, i + 16)) / 100000.0);