mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-13 18:48:04 +08:00
update 绑定车辆优惠券
This commit is contained in:
@@ -217,6 +217,11 @@ public class CacheConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String AUTHORIZER_REFRESH_TOKEN = "authorizer_refresh_token:";
|
public static final String AUTHORIZER_REFRESH_TOKEN = "authorizer_refresh_token:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆绑定优惠券
|
||||||
|
*/
|
||||||
|
public static final String CAR_BIND_COUPON_BY_ORDER_CODE = "car_bind_coupon_by_order_code:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路通云停系统 通过appid获取的接口调用令牌
|
* 路通云停系统 通过appid获取的接口调用令牌
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.netty.handler.yunkuaichong;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
|
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.TransactionRecordsData;
|
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||||
@@ -645,14 +646,20 @@ public class TransactionRecordsRequestHandler extends AbstractYkcHandler {
|
|||||||
|
|
||||||
// 异步绑定第三方平台优惠券
|
// 异步绑定第三方平台优惠券
|
||||||
OrderBasicInfo finalOrderBasicInfo = orderBasicInfo;
|
OrderBasicInfo finalOrderBasicInfo = orderBasicInfo;
|
||||||
|
String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderBasicInfo.getOrderCode();
|
||||||
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||||
|
if (cacheObject == null) {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
String bindResult = commonService.bindCoupon(finalOrderBasicInfo);
|
String bindResult = commonService.bindCoupon(finalOrderBasicInfo);
|
||||||
log.info("绑定优惠券 订单信息:{}, result:{}", finalOrderBasicInfo, bindResult);
|
log.info("绑定优惠券 订单信息:{}, result:{}", finalOrderBasicInfo, bindResult);
|
||||||
|
// 删除绑定优惠券缓存
|
||||||
|
redisCache.deleteObject(redisKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("绑定优惠券 error,", e);
|
log.error("绑定优惠券 error,", e);
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
|
}
|
||||||
|
|
||||||
// // 给车辆绑定优惠券
|
// // 给车辆绑定优惠券
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
@@ -323,6 +323,21 @@ public class UploadRealTimeMonitorHandler extends AbstractYkcHandler {
|
|||||||
if (saveRedisFlag) {
|
if (saveRedisFlag) {
|
||||||
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
||||||
}
|
}
|
||||||
|
// 判断该订单是否需要下发优惠券
|
||||||
|
String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderInfo.getOrderCode();
|
||||||
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||||
|
if (cacheObject == null && sumChargingTime >= 10) {
|
||||||
|
// 异步绑定优惠券并设置缓存
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
commonService.bindCoupon(orderInfo);
|
||||||
|
redisCache.setCacheObject(redisKey, Boolean.TRUE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异步绑定车辆优惠券 error,", e);
|
||||||
|
}
|
||||||
|
}, executor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 异步推送第三方平台实时数据
|
// 异步推送第三方平台实时数据
|
||||||
|
|||||||
Reference in New Issue
Block a user