实时费率解析修复

This commit is contained in:
ZZ 2022-02-28 16:37:33 +08:00
parent 55da2824d3
commit 8bf1f6ac60

View File

@ -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<ChargeDetails> calcem(String hex) {
int sumPeriod = Integer.parseInt(hex.substring(30, 32), 16);
int sumPeriod = Integer.parseInt(hex.substring(28, 30), 16);
List<ChargeDetails> 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);