mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 广西平台推送设备充电状态改为5分钟传一次
This commit is contained in:
@@ -195,6 +195,11 @@ public class CacheConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String THIRD_PARTY_TOKEN_BY_OPERATOR_SECRET = "third_party_token_by_operator_secret:";
|
public static final String THIRD_PARTY_TOKEN_BY_OPERATOR_SECRET = "third_party_token_by_operator_secret:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送设备充电状态信息数据缓存
|
||||||
|
*/
|
||||||
|
public static final String NOTIFICATION_EQUIP_CHARGE_STATUS_BY_ORDER_CODE = "notification_equip_charge_status_by_order_code:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电桩状态前缀
|
* 充电桩状态前缀
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
@@ -604,8 +605,12 @@ public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String notificationEquipChargeStatus(String orderCode) {
|
public String notificationEquipChargeStatus(String orderCode) {
|
||||||
// 根据订单号查询订单信息
|
// 先查缓存中是否有数据
|
||||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
String redisKey = CacheConstants.NOTIFICATION_EQUIP_CHARGE_STATUS_BY_ORDER_CODE + orderCode;
|
||||||
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||||
|
if (cacheObject != null) {
|
||||||
|
return "距上次推送未超过5分钟,本次不予推送";
|
||||||
|
}
|
||||||
// 查询相关配置信息
|
// 查询相关配置信息
|
||||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
|
||||||
@@ -616,6 +621,8 @@ public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 根据订单号查询订单信息
|
||||||
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
// 查询枪口实时状态
|
// 查询枪口实时状态
|
||||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||||
RealTimeMonitorData realTimeMonitorData;
|
RealTimeMonitorData realTimeMonitorData;
|
||||||
@@ -653,20 +660,14 @@ public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
|
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
|
||||||
.startChargeSeq(startChargeSeq)
|
.startChargeSeq(startChargeSeq)
|
||||||
.startChargeSeqStat(Integer.parseInt(orderStatus))
|
.startChargeSeqStat(Integer.parseInt(orderStatus))
|
||||||
// .startChargeSeqStat(2)
|
|
||||||
.connectorID(orderInfo.getPileConnectorCode())
|
.connectorID(orderInfo.getPileConnectorCode())
|
||||||
.connectorStatus(Integer.parseInt(realTimeMonitorData.getConnectorStatus())) // 3-充电中
|
.connectorStatus(Integer.parseInt(realTimeMonitorData.getConnectorStatus())) // 3-充电中
|
||||||
// .connectorStatus(3) // 3-充电中
|
|
||||||
.currentA(current.setScale(1, RoundingMode.HALF_UP))
|
.currentA(current.setScale(1, RoundingMode.HALF_UP))
|
||||||
// .currentA(new BigDecimal("20.3"))
|
|
||||||
.voltageA(voltage.setScale(1, RoundingMode.HALF_UP))
|
.voltageA(voltage.setScale(1, RoundingMode.HALF_UP))
|
||||||
// .voltageA(new BigDecimal("260.7"))
|
|
||||||
.soc(new BigDecimal(soc))
|
.soc(new BigDecimal(soc))
|
||||||
// .soc(new BigDecimal("79"))
|
|
||||||
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
|
||||||
.endTime(dateTime)
|
.endTime(dateTime)
|
||||||
.totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree()))
|
.totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree()))
|
||||||
// .totalPower(new BigDecimal("5292.21"))
|
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -677,6 +678,10 @@ public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
if (StringUtils.equals("成功", result)) {
|
||||||
|
// 将数据存入缓存,5分钟失效
|
||||||
|
redisCache.setCacheObject(redisKey, result, 5, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user