刷卡启动订单号缓存信息;费率模型id解析修复

This commit is contained in:
ZZ 2022-02-28 18:35:39 +08:00
parent f4b015b0b0
commit 9dd98bc332
4 changed files with 23 additions and 6 deletions

View File

@ -169,7 +169,7 @@ public class Constants
//你有申请退款订单在审核中,需要充电请取消申请退款
public static final String REFUND_ORDER = "14";
//车辆正在充电,请查询车辆充电信息
//账号正在充电,请查询车辆充电信息
public static final String CHARGE_ORDER = "15";
//未注册的终端,请选择其他终端充电

View File

@ -22,7 +22,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.pp.logic.RealtimeDataLogic.calcem;
import static com.xhpc.pp.logic.RealtimeDataLogic.calcem2;
import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate;
@Lazy
@ -63,7 +63,7 @@ public class OrderDataLogic implements ServiceLogic {
final String hex = orderData.getHex();
String cdhex = hex.substring(0xA2 * 2 + 4, hex.length() - 4);
if (cdhex.length() > 0) {
cacheOrder.put("em2", calcem(cdhex));
cacheOrder.put("em2", calcem2(cdhex));
REDIS.setCacheMap(orderkey, cacheOrder);
}
}

View File

@ -72,7 +72,7 @@ public class PileStartChargingDataLogic implements ServiceLogic {
} else {
// 调用订单接口
cardNo = iccardInfo.getCardno();
Integer rateModelId = HexUtils.reverseHexInt(pileStartChargingData.getRateModelId().toString());
Integer rateModelId = pileStartChargingData.getRateModelId();
R r = cardService.cardStartup(cardNo, connectorId, rateModelId.toString());
if (r.getCode() == 200) {
result = ServiceResult.HEX_01;

View File

@ -137,7 +137,7 @@ public class RealtimeDataLogic implements ServiceLogic {
final String hex = realtimeData.getHex();
String cdhex = hex.substring(0x40 * 2 + 4, hex.length() - 4);
if (cdhex.length() > 0) {
cacheOrder.put("em1", calcem(cdhex));
cacheOrder.put("em1", calcem1(cdhex));
}
}
cacheOrder.put("rbalance", balance);
@ -192,6 +192,9 @@ public class RealtimeDataLogic implements ServiceLogic {
}
}
} else {
if (cacheGun.get("orderkey") == null) {
cacheGun.put("orderkey", orderkey);
}
Integer errorfreecnt = (Integer) cacheOrder.get("errorfreecnt");
errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt;
if (errorfreecnt == 2) {
@ -262,7 +265,21 @@ public class RealtimeDataLogic implements ServiceLogic {
return new ServiceResult(false);
}
public static List<ChargeDetails> calcem(String hex) {
public static List<ChargeDetails> calcem2(String hex) {
int sumPeriod = Integer.parseInt(hex.substring(0, 2), 16);
List<ChargeDetails> cds = new ArrayList<>();
for (int i = 2; i < 2 + 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);
// cd.setDetailSeviceMoney(HexUtils.reverseHexInt(hex.substring(i + 60, i + 68)) / 10000.0);
cds.add(cd);
}
return cds;
}
public static List<ChargeDetails> calcem1(String hex) {
int sumPeriod = Integer.parseInt(hex.substring(28, 30), 16);
List<ChargeDetails> cds = new ArrayList<>();