This commit is contained in:
Lemon
2025-04-03 09:38:49 +08:00
5 changed files with 49 additions and 18 deletions

View File

@@ -682,9 +682,14 @@ public class CommonService {
* @return
*/
public void bindParkingCoupon(RealTimeMonitorData realTimeMonitorData, OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException {
// 每15秒就会调用这个方法, 使用redis控制日志打印
String redisKey = CacheConstants.BIND_PARKING_COUPON + orderBasicInfo.getOrderCode();
Boolean setnx = redisCache.setnx(redisKey, Constants.ONE, 60 * 5);
// 是否绑定车牌
if (StringUtils.isBlank(orderBasicInfo.getPlateNumber())) {
log.info("订单{}未绑定车牌", orderBasicInfo.getOrderCode());
if (setnx) {
log.info("订单{}未绑定车牌", orderBasicInfo.getOrderCode());
}
return;
}
// 判断该订单的站点是否有停车优惠
@@ -706,7 +711,9 @@ public class CommonService {
if (!DateUtils.isInDiscountPeriod(startTime, endTime, createLocalTime)) {
// 不在优惠时间段内
log.info("{}该订单不在优惠时间段({}-{})内", orderBasicInfo.getOrderCode(), startTime, endTime);
if (setnx) {
log.info("{}该订单不在优惠时间段({}-{})内", orderBasicInfo.getOrderCode(), startTime, endTime);
}
return;
}
@@ -726,14 +733,18 @@ public class CommonService {
}
if (!flag) {
// 不满足发券条件
log.info("{}该订单不满足发券条件, 门槛类型(1电量,2时长):{}, 门槛值:{}, 充电度数:{}, 充电时长:{}",
orderBasicInfo.getOrderCode(), conditionType, chargeParkingDiscount.getConditionValue(), chargingDegree, sumChargingTime);
if (setnx) {
log.info("{}该订单不满足发券条件, 门槛类型(1电量,2时长):{}, 门槛值:{}, 充电度数:{}, 充电时长:{}",
orderBasicInfo.getOrderCode(), conditionType, chargeParkingDiscount.getConditionValue(), chargingDegree, sumChargingTime);
}
return;
}
// 是否已经发券
CarCouponRecord carCouponRecord = carCouponRecordService.selectCarCouponRecord(orderBasicInfo.getOrderCode());
if (carCouponRecord != null) {
log.info("{}该订单已经发券", orderBasicInfo.getOrderCode());
if (setnx) {
log.info("{}该订单已经发券", orderBasicInfo.getOrderCode());
}
return;
}
// 绑定停车券