Merge remote-tracking branch 'origin/master'
# Conflicts: # cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoServiceImpl.java
This commit is contained in:
@@ -715,8 +715,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//下单赠送积分
|
if (!payType.equals(PayEnums.VIP_PAY)) {
|
||||||
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
|
//下单赠送积分
|
||||||
|
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())) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
|||||||
import cn.hutool.core.exceptions.ValidateException;
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
@@ -104,8 +105,31 @@ public class PayServiceImpl implements PayService {
|
|||||||
private OrderInfo checkPay(CheckOrderPay checkOrderPay) {
|
private OrderInfo checkPay(CheckOrderPay checkOrderPay) {
|
||||||
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
||||||
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
|
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);
|
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString(), true);
|
||||||
|
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||||
throw new PaySuccessException();
|
throw new PaySuccessException();
|
||||||
}
|
}
|
||||||
return orderInfo;
|
return orderInfo;
|
||||||
@@ -166,8 +190,6 @@ public class PayServiceImpl implements PayService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||||
public CzgResult<Object> vipPayOrder(OrderPayParamDTO payParam) {
|
public CzgResult<Object> vipPayOrder(OrderPayParamDTO payParam) {
|
||||||
AssertUtil.isNull(payParam.getCheckOrderPay().getUserId(), "会员支付,订单用户不能为空");
|
|
||||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
|
||||||
ShopUser shopUser = new ShopUser();
|
ShopUser shopUser = new ShopUser();
|
||||||
if ("scanCode".equals(payParam.getPayType())) {
|
if ("scanCode".equals(payParam.getPayType())) {
|
||||||
AssertUtil.isBlank(payParam.getAuthCode(), "会员码不能为空");
|
AssertUtil.isBlank(payParam.getAuthCode(), "会员码不能为空");
|
||||||
@@ -197,6 +219,8 @@ public class PayServiceImpl implements PayService {
|
|||||||
if (shopUser == null || shopUser.getId() == null) {
|
if (shopUser == null || shopUser.getId() == null) {
|
||||||
AssertUtil.isNull(shopUser, "会员不存在");
|
AssertUtil.isNull(shopUser, "会员不存在");
|
||||||
}
|
}
|
||||||
|
payParam.getCheckOrderPay().setUserId(shopUser.getUserId());
|
||||||
|
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||||
if (!shopUser.getShopId().equals(orderInfo.getShopId())) {
|
if (!shopUser.getShopId().equals(orderInfo.getShopId())) {
|
||||||
return CzgResult.failure("违规操作,请确认店铺后重试");
|
return CzgResult.failure("违规操作,请确认店铺后重试");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user