Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-03-19 14:43:56 +08:00
6 changed files with 228 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -690,14 +691,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.where(OrderInfo::getId).eq(orderInfo.getId());
if (payOrderId != null) {
updateChain.set(OrderInfo::getPayOrderId, payOrderId);
orderInfo.setPayOrderId(payOrderId);
}
if (orderInfo.getCreditBuyerId() != null) {
updateChain.set(OrderInfo::getCreditBuyerId, orderInfo.getCreditBuyerId());
}
if (ObjectUtil.isNotNull(payType)) {
updateChain.set(OrderInfo::getPayType, payType.getValue());
orderInfo.setPayType(payType.getValue());
}
boolean update = updateChain.update();
if (update) {
orderInfo.setPayAmount(payAmount);
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
orderInfo.setPaidTime(payTime);
}
updateChain.update();
if (orderInfo.getUserId() != null) {
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
if (shopUser == null) {
@@ -718,8 +726,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
}
}
if ((orderInfo.getPayType() != null && orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue()))
|| (payType != null && !payType.equals(PayEnums.VIP_PAY))) {
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
if ((orderInfo.getPayType() != null && !ArrayUtil.contains(payTypes, orderInfo.getPayType()))
|| (payType != null && !ArrayUtil.contains(payTypes, payType))) {
//下单赠送积分
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
}