update 联联平台推送接口设置缓存

This commit is contained in:
Lemon
2025-04-03 09:38:40 +08:00
parent fffe2a47bc
commit 1fd45e6794
2 changed files with 13 additions and 0 deletions

View File

@@ -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;
}