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