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);