From 1fd45e6794e76ad371220243201b8721cb666f7e Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 3 Apr 2025 09:38:40 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=20=E8=81=94=E8=81=94=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=8E=A8=E9=80=81=E6=8E=A5=E5=8F=A3=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jsowell/common/constant/CacheConstants.java | 5 +++++ .../service/impl/LianLianPlatformServiceImpl.java | 8 ++++++++ 2 files changed, 13 insertions(+) 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; }