实时费率解析修复

This commit is contained in:
ZZ 2022-02-28 16:10:19 +08:00
parent 72c6222eb5
commit 55da2824d3
2 changed files with 4 additions and 4 deletions

View File

@ -135,7 +135,7 @@ public class RealtimeDataLogic implements ServiceLogic {
if (socInt != 0) cacheOrder.put("endSoc", socInt); if (socInt != 0) cacheOrder.put("endSoc", socInt);
if (cachePile.get("version").equals("0B")) { if (cachePile.get("version").equals("0B")) {
final String hex = realtimeData.getHex(); final String hex = realtimeData.getHex();
String cdhex = hex.substring(0x40 * 2 + 4, hex.length() - 4); String cdhex = hex.substring(0x40 * 2 + 3, hex.length() - 4);
if (cdhex.length() > 0) { if (cdhex.length() > 0) {
cacheOrder.put("em1", calcem(cdhex)); cacheOrder.put("em1", calcem(cdhex));
} }
@ -264,9 +264,9 @@ public class RealtimeDataLogic implements ServiceLogic {
public static List<ChargeDetails> calcem(String hex) { public static List<ChargeDetails> calcem(String hex) {
int sumPeriod = Integer.parseInt(hex.substring(0, 2), 16); int sumPeriod = Integer.parseInt(hex.substring(30, 32), 16);
List<ChargeDetails> cds = new ArrayList<>(); List<ChargeDetails> cds = new ArrayList<>();
for (int i = 10; i < sumPeriod * 16 + 10; i = i + 16) { // todo for (int i = 32; i <= sumPeriod * 16 + 32; i = i + 16) { // todo
ChargeDetails cd = new ChargeDetails(); ChargeDetails cd = new ChargeDetails();
cd.setDetailPower(HexUtils.reverseHexInt(hex.substring(i, i + 8)) / 100000.0); cd.setDetailPower(HexUtils.reverseHexInt(hex.substring(i, i + 8)) / 100000.0);
cd.setDetailElecMoney(HexUtils.reverseHexInt(hex.substring(i + 8, i + 16)) / 100000.0); cd.setDetailElecMoney(HexUtils.reverseHexInt(hex.substring(i + 8, i + 16)) / 100000.0);

View File

@ -131,7 +131,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
} }
if (SERVICE_HB.equals(serviceName) && OK.equals(resultCode)) { if (SERVICE_HB.equals(serviceName) && OK.equals(resultCode)) {
Boolean tcfg = (Boolean) cachePile.get("tcfg"); Boolean tcfg = (Boolean) cachePile.get("tcfg");
if (!tcfg) { if (tcfg == null || !tcfg) {
String skey = pilekey.concat(".seqhex"); String skey = pilekey.concat(".seqhex");
Thread.sleep(500); Thread.sleep(500);
Date date = Calendar.getInstance().getTime(); Date date = Calendar.getInstance().getTime();