parent
972cc64b7e
commit
7f77a3187d
|
|
@ -716,8 +716,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
}
|
||||
}
|
||||
//下单赠送积分
|
||||
pointsService.consumeAwardPoints(orderInfo.getUserId(), orderInfo);
|
||||
if (!payType.equals(PayEnums.VIP_PAY)) {
|
||||
//下单赠送积分
|
||||
pointsService.consumeAwardPoints(orderInfo.getUserId(), orderInfo);
|
||||
}
|
||||
|
||||
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
|
||||
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||
|
|
@ -848,6 +850,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
|
||||
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
|
||||
orderInfo.setPaidTime(LocalDateTime.now());
|
||||
|
||||
}
|
||||
saveOrUpdate(orderInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
|||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.entity.*;
|
||||
|
|
@ -104,8 +105,31 @@ public class PayServiceImpl implements PayService {
|
|||
private OrderInfo checkPay(CheckOrderPay checkOrderPay) {
|
||||
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
||||
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
|
||||
//积分使用
|
||||
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
|
||||
pointsService.deductPoints(orderInfo.getUserId(), 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)) {
|
||||
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 {
|
||||
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
|
||||
//发送打票信息
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString(), true);
|
||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||
throw new PaySuccessException();
|
||||
}
|
||||
return orderInfo;
|
||||
|
|
|
|||
Loading…
Reference in New Issue