mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -2,7 +2,6 @@ package com.jsowell.netty.strategy.ykc;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
@@ -33,7 +32,6 @@ import org.springframework.stereotype.Component;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 交易记录确认
|
||||
@@ -647,41 +645,41 @@ public class TransactionRecordsStrategy implements AbstractYkcStrategy {
|
||||
}
|
||||
|
||||
// 异步绑定第三方平台优惠券
|
||||
OrderBasicInfo finalOrderBasicInfo = orderBasicInfo;
|
||||
String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderBasicInfo.getOrderCode();
|
||||
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||
if (cacheObject == null) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
String bindResult = commonService.bindCoupon(finalOrderBasicInfo);
|
||||
log.info("绑定优惠券 订单信息:{}, result:{}", finalOrderBasicInfo, bindResult);
|
||||
// 删除绑定优惠券缓存
|
||||
redisCache.deleteObject(redisKey);
|
||||
} catch (Exception e) {
|
||||
log.error("绑定优惠券 error,", e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// OrderBasicInfo finalOrderBasicInfo = orderBasicInfo;
|
||||
// String redisKey = CacheConstants.CAR_BIND_COUPON_BY_ORDER_CODE + orderBasicInfo.getOrderCode();
|
||||
// Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||
// if (cacheObject == null) {
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
// try {
|
||||
// String bindResult = commonService.bindCoupon(finalOrderBasicInfo);
|
||||
// log.info("绑定优惠券 订单信息:{}, result:{}", finalOrderBasicInfo, bindResult);
|
||||
// // 删除绑定优惠券缓存
|
||||
// redisCache.deleteObject(redisKey);
|
||||
// } catch (Exception e) {
|
||||
// log.error("绑定优惠券 error,", e);
|
||||
// }
|
||||
// }, executor);
|
||||
// }
|
||||
|
||||
// 异步推送第三方平台订单信息
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.commonPushOrderInfo(finalOrderBasicInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("推送第三方平台订单信息error, ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, executor);
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
// try {
|
||||
// commonService.commonPushOrderInfo(finalOrderBasicInfo);
|
||||
// } catch (Exception e) {
|
||||
// log.error("推送第三方平台订单信息error, ", e);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }, executor);
|
||||
|
||||
// 异步推送第三方平台订单信息V2
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.commonPushOrderInfoV2(finalOrderBasicInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("推送第三方平台订单信息error, ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, executor);
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
// try {
|
||||
// commonService.commonPushOrderInfoV2(finalOrderBasicInfo);
|
||||
// } catch (Exception e) {
|
||||
// log.error("推送第三方平台订单信息error, ", e);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }, executor);
|
||||
} else {
|
||||
// 平台没有查到订单
|
||||
orderBasicInfoService.saveAbnormalOrder(data);
|
||||
|
||||
@@ -325,19 +325,19 @@ public class UploadRealTimeMonitorStrategy implements AbstractYkcStrategy {
|
||||
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, 24, TimeUnit.HOURS);
|
||||
} catch (Exception e) {
|
||||
log.error("异步绑定车辆优惠券 error,", e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// 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, 24, TimeUnit.HOURS);
|
||||
// } catch (Exception e) {
|
||||
// log.error("异步绑定车辆优惠券 error,", e);
|
||||
// }
|
||||
// }, executor);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user