fix NPE
This commit is contained in:
parent
d14d77fc61
commit
53dd34c3e7
@ -54,43 +54,45 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
|||||||
for (String gunkey : gunkeys) {
|
for (String gunkey : gunkeys) {
|
||||||
if (!gunkey.endsWith(".seqdec") && !gunkey.endsWith(".seqhex") && !gunkey.endsWith(".hori")) {
|
if (!gunkey.endsWith(".seqdec") && !gunkey.endsWith(".seqhex") && !gunkey.endsWith(".hori")) {
|
||||||
final Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
final Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
final String status = cacheGun.get("status").toString();
|
final String status = (String) cacheGun.get("status");
|
||||||
if (isInteger(status)) {
|
if (status != null) {
|
||||||
String orderkey = (String) cacheGun.get("orderkey");
|
if (isInteger(status)) {
|
||||||
if (orderkey == null) continue;
|
String orderkey = (String) cacheGun.get("orderkey");
|
||||||
EquipChargeStatus equipChargeStatus = new EquipChargeStatus();
|
if (orderkey == null) continue;
|
||||||
final String internetSerialNumber = REDIS.getCacheMapValue(orderkey.replace("order:", "pushOrder:"),
|
EquipChargeStatus equipChargeStatus = new EquipChargeStatus();
|
||||||
"internetSerialNumber");
|
final String internetSerialNumber = REDIS.getCacheMapValue(orderkey.replace("order:", "pushOrder:"),
|
||||||
if (internetSerialNumber == null || !internetSerialNumber.startsWith(authSecretToken.getOperatorId3irdpty())) {
|
"internetSerialNumber");
|
||||||
continue;
|
if (internetSerialNumber == null || !internetSerialNumber.startsWith(authSecretToken.getOperatorId3irdpty())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
equipChargeStatus.setStartChargeSeq(internetSerialNumber);
|
||||||
|
equipChargeStatus.setStartChargeSeqStat(2);
|
||||||
|
equipChargeStatus.setConnectorID(orderkey.substring(6, 22));
|
||||||
|
equipChargeStatus.setConnectorStatus(3);
|
||||||
|
String current = REDIS.getCacheMapValue(gunkey, "current");
|
||||||
|
equipChargeStatus.setCurrentA(HexUtils.reverseHexInt(current == null ? "9600" : current) / 10.0);
|
||||||
|
String voltage = REDIS.getCacheMapValue(gunkey, "voltage");
|
||||||
|
equipChargeStatus.setVoltageA(HexUtils.reverseHexInt(voltage == null ? "D80E" : voltage) / 10.0);
|
||||||
|
Integer soc = REDIS.getCacheMapValue(orderkey, "endSoc");
|
||||||
|
equipChargeStatus.setSoc(soc == null ? 0.0 : Double.valueOf(soc.toString()));
|
||||||
|
CacheRealtimeData lord = REDIS.getCacheObject(orderkey.concat(".lord"));
|
||||||
|
String lordTime;
|
||||||
|
if (lord != null) {
|
||||||
|
lordTime = lord.getCreateTime();
|
||||||
|
} else {
|
||||||
|
lordTime = DateUtil.date2String(Calendar.getInstance().getTime(), DATE_FORMAT_DATE_TIME);
|
||||||
|
}
|
||||||
|
equipChargeStatus.setStartTime(REDIS.getCacheMapValue(orderkey, "startTime"));
|
||||||
|
equipChargeStatus.setEndTime(lordTime);
|
||||||
|
equipChargeStatus.setChargeModel(3);
|
||||||
|
equipChargeStatus.setTotalPower(REDIS.getCacheMapValue(orderkey, "totalPower"));
|
||||||
|
equipChargeStatus.setTotalMoney(REDIS.getCacheMapValue(orderkey, "totalMoney"));
|
||||||
|
final Long rateModelId = REDIS.getCacheMapValue(gunkey.replace("gun", "pile").substring(0, 19),
|
||||||
|
"rateModelId");
|
||||||
|
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||||
|
calculateEm(equipChargeStatus, cacheRateModel);
|
||||||
|
notify(equipChargeStatus, authSecretToken);
|
||||||
}
|
}
|
||||||
equipChargeStatus.setStartChargeSeq(internetSerialNumber);
|
|
||||||
equipChargeStatus.setStartChargeSeqStat(2);
|
|
||||||
equipChargeStatus.setConnectorID(orderkey.substring(6, 22));
|
|
||||||
equipChargeStatus.setConnectorStatus(3);
|
|
||||||
String current = REDIS.getCacheMapValue(gunkey, "current");
|
|
||||||
equipChargeStatus.setCurrentA(HexUtils.reverseHexInt(current == null ? "9600" : current) / 10.0);
|
|
||||||
String voltage = REDIS.getCacheMapValue(gunkey, "voltage");
|
|
||||||
equipChargeStatus.setVoltageA(HexUtils.reverseHexInt(voltage == null ? "D80E" : voltage) / 10.0);
|
|
||||||
Integer soc = REDIS.getCacheMapValue(orderkey, "endSoc");
|
|
||||||
equipChargeStatus.setSoc(soc == null ? 0.0 : Double.valueOf(soc.toString()));
|
|
||||||
CacheRealtimeData lord = REDIS.getCacheObject(orderkey.concat(".lord"));
|
|
||||||
String lordTime;
|
|
||||||
if (lord != null) {
|
|
||||||
lordTime = lord.getCreateTime();
|
|
||||||
} else {
|
|
||||||
lordTime = DateUtil.date2String(Calendar.getInstance().getTime(), DATE_FORMAT_DATE_TIME);
|
|
||||||
}
|
|
||||||
equipChargeStatus.setStartTime(REDIS.getCacheMapValue(orderkey, "startTime"));
|
|
||||||
equipChargeStatus.setEndTime(lordTime);
|
|
||||||
equipChargeStatus.setChargeModel(3);
|
|
||||||
equipChargeStatus.setTotalPower(REDIS.getCacheMapValue(orderkey, "totalPower"));
|
|
||||||
equipChargeStatus.setTotalMoney(REDIS.getCacheMapValue(orderkey, "totalMoney"));
|
|
||||||
final Long rateModelId = REDIS.getCacheMapValue(gunkey.replace("gun", "pile").substring(0, 19),
|
|
||||||
"rateModelId");
|
|
||||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
|
||||||
calculateEm(equipChargeStatus, cacheRateModel);
|
|
||||||
notify(equipChargeStatus, authSecretToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user