perfecting
This commit is contained in:
parent
5ad4b29795
commit
d9a51e8342
@ -24,6 +24,7 @@ public class GlobalExceptionController extends ResponseEntityExceptionHandler {
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet(EvcsConst.RET_FAIL);
|
||||
commonResponse.setMsg(e.getMessage());
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage());
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
@ -50,7 +50,9 @@ public class QueryEquipChargeStatusController {
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
String orderStatus = (String) order.get("status");
|
||||
int startChargeSeqStat = 0;
|
||||
switch (orderStatus) {
|
||||
if (orderStatus == null) {
|
||||
startChargeSeqStat = 5;
|
||||
} else switch (orderStatus) {
|
||||
case "启动中":
|
||||
startChargeSeqStat = 1;
|
||||
break;
|
||||
@ -107,14 +109,17 @@ public class QueryEquipChargeStatusController {
|
||||
equipChargeStatus.setStartTime(startTime);
|
||||
//本次采样时间 直接new一个当前时间的Date就可以了
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:" + internalOrderNum + ".lord");
|
||||
equipChargeStatus.setEndTime(lord.getCreateTime());
|
||||
if (lord != null) {
|
||||
equipChargeStatus.setEndTime(lord.getCreateTime());
|
||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() / 10000.0);
|
||||
equipChargeStatus.setTotalPower(lord.getChargingDegree() / 10000.0);
|
||||
} else {
|
||||
equipChargeStatus.setEndTime(equipChargeStatus.getStartTime());
|
||||
equipChargeStatus.setTotalMoney(0.0);
|
||||
equipChargeStatus.setTotalPower(0.0);
|
||||
}
|
||||
Integer chargeModel = (Integer) order.get("chargeModel");
|
||||
equipChargeStatus.setChargeModel(chargeModel == null ? 0 : chargeModel);
|
||||
//累计充电量
|
||||
Double chargingDegree = Double.valueOf(lord.getChargingDegree() == null ? 0 : lord.getChargingDegree());
|
||||
equipChargeStatus.setTotalPower(chargingDegree / 10000);
|
||||
//总金额
|
||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() == null ? 0 : lord.getAmountCharged() / 10000.0);
|
||||
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
calculateEm(equipChargeStatus, cacheRateModel);
|
||||
|
||||
@ -109,13 +109,13 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
(now.before(authSecretTokenIn.getTokenExpiry())
|
||||
&& authorization != null && authorization.substring(7).equals(authSecretTokenIn.getToken()))) {
|
||||
try {
|
||||
if (authSecretTokenIn.isEncrypt() && !"false".equals(encin)) {
|
||||
decryptedReq = decrypt(request, authSecretTokenIn, commonRequest, bodyString);
|
||||
} else {
|
||||
String data = commonRequest.getData();
|
||||
if (data == null) data = bodyString;
|
||||
decryptedReq = data.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
// if (authSecretTokenIn.isEncrypt() && !"false".equals(encin)) { // test code
|
||||
decryptedReq = decrypt(request, authSecretTokenIn, commonRequest, bodyString);
|
||||
// } else {
|
||||
// String data = commonRequest.getData();
|
||||
// if (data == null) data = bodyString;
|
||||
// decryptedReq = data.getBytes(StandardCharsets.UTF_8);
|
||||
// }
|
||||
commonRequest.setData(new String(decryptedReq));
|
||||
log.debug("in.dec: {}", commonRequest);
|
||||
} catch (BadPaddingException | InvalidAlgorithmParameterException | NoSuchAlgorithmException | IllegalBlockSizeException | NoSuchPaddingException | InvalidKeyException e) {
|
||||
|
||||
@ -165,9 +165,11 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
final BigDecimal oddm =
|
||||
BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNElecMoney)).subtract(BigDecimal.valueOf(firstNSeviceMony));
|
||||
final BigDecimal oddp = BigDecimal.valueOf(totalPower).subtract(BigDecimal.valueOf(firstNPower));
|
||||
ChargeDetails peek = chargeDetailsStack.peek();
|
||||
peek.setDetailElecMoney(BigDecimal.valueOf(peek.getDetailElecMoney()).add(oddm).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
peek.setDetailPower(BigDecimal.valueOf(peek.getDetailPower()).add(oddp).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
if (!chargeDetailsStack.isEmpty()) {
|
||||
ChargeDetails peek = chargeDetailsStack.peek();
|
||||
peek.setDetailElecMoney(BigDecimal.valueOf(peek.getDetailElecMoney()).add(oddm).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
peek.setDetailPower(BigDecimal.valueOf(peek.getDetailPower()).add(oddp).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
private static void calculateCD(CacheRateModel cacheRateModel, String rtf,
|
||||
|
||||
@ -58,7 +58,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
if (isStopNotified == null || !isStopNotified) {
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
if (internetSerialNumber == null) {
|
||||
log.error("null isn: {}", pushOrderKey);
|
||||
continue;
|
||||
}
|
||||
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
|
||||
@ -49,6 +49,7 @@ public class OrderDataLogic implements ServiceLogic {
|
||||
cacheOrderData.setStatus(1);
|
||||
cacheOrderData.setCreateTime(DateUtil.now());
|
||||
cacheOrder.put("orderData", cacheOrderData);
|
||||
cacheOrder.put("status", "已结束");
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
String gunkey = "gun:".concat(orderData.getPileNo()).concat(orderData.getGunId());
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||
|
||||
@ -200,6 +200,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
cacheOrder.put("abnormal", "1.2");//lord as orderData
|
||||
log.error("abnormal.1.2 order[{}]", orderNo);
|
||||
cacheOrder.put("status", "已结束");
|
||||
}
|
||||
if (r == null || r.getCode() != 200) {
|
||||
log.error("errorfreecnt r{}", JSONUtil.toJsonStr(r));
|
||||
@ -227,6 +228,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
startSoc == null ? 0 : startSoc, endSoc == null ? 0 : endSoc));
|
||||
log.error("abnormal.2.1 order[{}]", orderNo);
|
||||
cacheOrder.put("abnormal", "2.1");
|
||||
cacheOrder.put("status", "已结束");
|
||||
} else {
|
||||
log.error("abnormal.2.2 order[{}]", orderNo);
|
||||
cacheOrder.put("abnormal", "2.2");//not respond
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user