0元付款 积分消耗 优惠券消耗
This commit is contained in:
@@ -863,6 +863,28 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
|
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
|
||||||
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
|
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
|
||||||
orderInfo.setPaidTime(LocalDateTime.now());
|
orderInfo.setPaidTime(LocalDateTime.now());
|
||||||
|
if (orderInfo.getUserId() != null) {
|
||||||
|
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
|
||||||
|
if (shopUser == null) {
|
||||||
|
if ((orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0)
|
||||||
|
|| (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList()))) {
|
||||||
|
log.error("订单积分使用或优惠券扣除失败,订单id:{}", orderInfo.getId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//积分使用
|
||||||
|
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
|
||||||
|
pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo);
|
||||||
|
}
|
||||||
|
//更新优惠券信息
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList())) {
|
||||||
|
//券消耗
|
||||||
|
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
|
||||||
|
if (CollUtil.isNotEmpty(coupons)) {
|
||||||
|
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
saveOrUpdate(orderInfo);
|
saveOrUpdate(orderInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user