mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
【代码评审】商城:纯积分兑换时,直接设置为待发货
This commit is contained in:
parent
e604cba3bf
commit
2c4d8298cf
@ -245,7 +245,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
}
|
||||
|
||||
// 3. 生成预支付
|
||||
createPayOrder(order, orderItems);
|
||||
// 特殊情况:积分兑换时,可能支付金额为零
|
||||
if (order.getPayPrice() > 0) {
|
||||
createPayOrder(order, orderItems);
|
||||
}
|
||||
|
||||
// 4. 插入订单日志
|
||||
TradeOrderLogUtils.setOrderInfo(order.getId(), null, order.getStatus());
|
||||
|
@ -5,11 +5,13 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.iocoder.yudao.module.promotion.api.point.PointActivityApi;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 积分商城活动订单的 {@link TradeOrderHandler} 实现类
|
||||
@ -33,6 +35,11 @@ public class TradePointOrderHandler implements TradeOrderHandler {
|
||||
// 扣减积分商城活动的库存
|
||||
pointActivityApi.updatePointStockDecr(order.getPointActivityId(),
|
||||
orderItems.get(0).getSkuId(), orderItems.get(0).getCount());
|
||||
|
||||
// 如果支付金额为 0,则直接设置为已支付
|
||||
if (Objects.equals(order.getPayPrice(), 0)) {
|
||||
order.setPayStatus(true).setStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user