diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java index 1540aca9f..efcfb2001 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java @@ -320,6 +320,11 @@ public class CacheConstants { */ public static final String HUA_WEI_ORDER_INFO_BY_ORDER_CODE = "HUA_WEI_ORDER_INFO_BY_ORDER_CODE:"; + /** + * 联联平台推送枪口充电状态缓存key + */ + public static final String LIANLIAN_NOTIFICATION_CONNECTOR_CHARGE_STATUS = "LIANLIAN_NOTIFICATION_CONNECTOR_CHARGE_STATUS_"; + /** * 桩硬件故障 根据枪口号查询故障原因 */ diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java index 8527d1f6e..a4c291725 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java @@ -677,6 +677,12 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public String notificationConnectorChargeStatus(String orderCode) { + // 设置2分钟缓存,2分钟只推送一次 + String redisKey = CacheConstants.LIANLIAN_NOTIFICATION_CONNECTOR_CHARGE_STATUS + orderCode; + Object cacheObject = redisCache.getCacheObject(redisKey); + if (cacheObject != null) { + return "Success"; + } // 通过订单号查询信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); // 根据枪口号查询充电实时状态 @@ -720,6 +726,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { String jsonString = JSON.toJSONString(json); // 发送请求 String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + // 将信息存入缓存,时间设置2分钟 + redisCache.setCacheObject(redisKey, result, 2, TimeUnit.MINUTES); return result; }