订单支付 userId问题

This commit is contained in:
wangw 2025-03-17 17:01:09 +08:00
parent 7a5882ed38
commit fb9745e70e
1 changed files with 21 additions and 21 deletions

View File

@ -694,32 +694,32 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
updateChain.set(OrderInfo::getPayType, payType.getValue()); updateChain.set(OrderInfo::getPayType, payType.getValue());
} }
updateChain.update(); updateChain.update();
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId()); if (orderInfo.getUserId() != null) {
//积分使用 ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) { if (shopUser == null) {
pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo); if ((orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0)
} || (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList()))) {
//更新优惠券信息 log.error("订单积分使用或优惠券扣除失败订单id{}", orderInfo.getId());
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList())) { }
//券消耗 } else {
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class); //积分使用
if (CollUtil.isNotEmpty(coupons)) { if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
if (orderInfo.getUserId() == null) { pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo);
log.info("订单:{}优惠券使用失败用户Id为空", orderInfo.getId()); }
} else { //更新优惠券信息
if (shopUser == null) { if (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList())) {
log.info("订单:{}优惠券使用失败,店铺用户不存在", orderInfo.getId()); //券消耗
} else { List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
if (CollUtil.isNotEmpty(coupons)) {
couponService.use(coupons, shopUser.getId(), orderInfo.getId()); couponService.use(coupons, shopUser.getId(), orderInfo.getId());
} }
} }
if (!payType.equals(PayEnums.VIP_PAY)) {
//下单赠送积分
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
}
} }
} }
if (!payType.equals(PayEnums.VIP_PAY)) {
//下单赠送积分
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
}
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update(); orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
// if (!"after-pay".equals(orderInfo.getPayMode())) { // if (!"after-pay".equals(orderInfo.getPayMode())) {
//发送打票信息 //发送打票信息