0元付款 积分消耗 优惠券消耗
This commit is contained in:
parent
9d969c60f0
commit
b617806c80
|
|
@ -466,7 +466,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
Long key = entry.getKey();
|
||||
List<OrderDetail> value = entry.getValue();
|
||||
BigDecimal couponNum = BigDecimal.ZERO;
|
||||
if (CollUtil.isNotEmpty(prodCouponMap) && prodCouponMap.containsKey(key)){
|
||||
if (CollUtil.isNotEmpty(prodCouponMap) && prodCouponMap.containsKey(key)) {
|
||||
couponNum = new BigDecimal(prodCouponMap.get(key));
|
||||
if (value.size() > 1) {
|
||||
value.sort(Comparator.comparing(OrderDetail::getPrice));
|
||||
|
|
@ -863,6 +863,28 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
|
||||
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue