mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
bugfix 修复推送江苏省平台推送频率
This commit is contained in:
@@ -374,12 +374,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||
|
||||
// 江苏省平台(充电状态至少一分钟推送一次)
|
||||
if (!StringUtils.equals(realTimeMonitorData.getConnectorStatus(), "03")) {
|
||||
// 如果不是充电状态,直接推送就可以
|
||||
log.info("推送江苏省平台 非充电状态 params:{}", realTimeMonitorData);
|
||||
String result = nrService.pushPileStatus(realTimeMonitorData);
|
||||
log.info("推送江苏省平台 非充电状态 result:{}", result);
|
||||
}else {
|
||||
if (StringUtils.equals(connectorStatus, "03")) {
|
||||
// 充电状态
|
||||
// 如果缓存有数据,证明上次推送未超过一分钟,不予推送,若缓存中无数据,说明需要推送
|
||||
if (cacheObject == null) {
|
||||
@@ -388,6 +383,11 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
redisCache.setCacheObject(redisKey, realTimeMonitorData, 1, TimeUnit.MINUTES);
|
||||
log.info("推送江苏省平台 充电状态 result:{}", result);
|
||||
}
|
||||
} else {
|
||||
// 如果不是充电状态,直接推送就可以
|
||||
log.info("推送江苏省平台 非充电状态 params:{}", realTimeMonitorData);
|
||||
String result = nrService.pushPileStatus(realTimeMonitorData);
|
||||
log.info("推送江苏省平台 非充电状态 result:{}", result);
|
||||
}
|
||||
|
||||
// log.info("推送江苏省平台实时数据 result:{}", result);
|
||||
|
||||
@@ -433,15 +433,13 @@ public class NRServiceImpl implements NRService {
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
// 根据交易流水号查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
log.info("江苏省平台查询订单信息: {}", orderBasicInfo);
|
||||
if (orderBasicInfo == null) {
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.isBlank(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime()))) {
|
||||
log.error("江苏省平台查询订单信息, 充电开始时间为空: {}", orderBasicInfo);
|
||||
return null;
|
||||
Date chargeStartTime = new Date();
|
||||
if (StringUtils.equals(connectorStatus, "03")) {
|
||||
// 根据交易流水号查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (orderBasicInfo != null) {
|
||||
chargeStartTime = orderBasicInfo.getChargeStartTime();
|
||||
}
|
||||
}
|
||||
// 封装对象
|
||||
NRConnectorStatusInfo nrConnectorStatusInfo = NRConnectorStatusInfo.builder()
|
||||
@@ -450,7 +448,7 @@ public class NRServiceImpl implements NRService {
|
||||
.currentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()).intValue())
|
||||
.voltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()).intValue())
|
||||
.soc(BigDecimal.ZERO)
|
||||
.beginTime(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime()))
|
||||
.beginTime(DateUtils.formatDateTime(chargeStartTime))
|
||||
.currentKwh(new BigDecimal(realTimeMonitorData.getChargingDegree()).setScale(3, BigDecimal.ROUND_HALF_UP))
|
||||
.timeStamp((int) (System.currentTimeMillis() / 1000))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user