会员积分问题修复

This commit is contained in:
Tankaikai
2025-03-17 16:41:50 +08:00
parent 972cc64b7e
commit aa71de3aa3
11 changed files with 67 additions and 72 deletions

View File

@@ -1,7 +1,6 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.thread.ThreadUtil;
@@ -695,9 +694,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
updateChain.set(OrderInfo::getPayType, payType.getValue());
}
updateChain.update();
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
//积分使用
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
pointsService.deductPoints(orderInfo.getUserId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo);
pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo);
}
//更新优惠券信息
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList())) {
@@ -707,7 +707,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
if (orderInfo.getUserId() == null) {
log.info("订单:{}优惠券使用失败用户Id为空", orderInfo.getId());
} else {
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
if (shopUser == null) {
log.info("订单:{}优惠券使用失败,店铺用户不存在", orderInfo.getId());
} else {
@@ -717,7 +716,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
}
}
//下单赠送积分
pointsService.consumeAwardPoints(orderInfo.getUserId(), orderInfo);
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
// if (!"after-pay".equals(orderInfo.getPayMode())) {