mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-20 21:21:58 +08:00
暂存调整 Price 接口
This commit is contained in:
@@ -19,8 +19,8 @@ public interface PriceConvert {
|
||||
default PriceCalculateRespDTO convert(PriceCalculateReqDTO calculateReqDTO, List<ProductSkuRespDTO> skuList) {
|
||||
// 创建 PriceCalculateRespDTO 对象
|
||||
PriceCalculateRespDTO priceCalculate = new PriceCalculateRespDTO();
|
||||
priceCalculate.setOrder(new PriceCalculateRespDTO.Order().setSkuOriginalPrice(0).setSkuPromotionPrice(0)
|
||||
.setOrderPromotionPrice(0).setDeliveryPrice(0).setPayPrice(0).setItems(new ArrayList<>())
|
||||
priceCalculate.setOrder(new PriceCalculateRespDTO.Order().setOriginalPrice(0).setActivityPrice(0)
|
||||
.setDeliveryPrice(0).setPayPrice(0).setItems(new ArrayList<>())
|
||||
.setCouponId(calculateReqDTO.getCouponId()));
|
||||
priceCalculate.setPromotions(new ArrayList<>());
|
||||
// 创建它的 OrderItem 属性
|
||||
@@ -29,9 +29,9 @@ public interface PriceConvert {
|
||||
skuList.forEach(sku -> {
|
||||
Integer count = skuIdCountMap.get(sku.getId());
|
||||
PriceCalculateRespDTO.OrderItem orderItem = new PriceCalculateRespDTO.OrderItem().setCount(count)
|
||||
.setOriginalPrice(sku.getPrice()).setTotalOriginalPrice(sku.getPrice() * count).setTotalPromotionPrice(0);
|
||||
orderItem.setTotalPresentPrice(orderItem.getTotalPresentPrice()).setPresentPrice(orderItem.getOriginalPrice())
|
||||
.setTotalPayPrice(orderItem.getTotalPayPrice());
|
||||
.setOriginalUnitPrice(sku.getPrice()).setOriginalPrice(sku.getPrice() * count).setActivityPrice(0);
|
||||
orderItem.setPayPrice(orderItem.getPayPrice()).setPayUnitPrice(orderItem.getOriginalUnitPrice())
|
||||
.setPayPrice(orderItem.getPayPrice());
|
||||
priceCalculate.getOrder().getItems().add(orderItem);
|
||||
});
|
||||
return priceCalculate;
|
||||
|
@@ -15,7 +15,6 @@ import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_STOCK_NOT_ENOUGH;
|
||||
|
||||
/**
|
||||
* 价格计算 Service 实现类
|
||||
@@ -54,9 +53,7 @@ public class PriceServiceImpl implements PriceService {
|
||||
if (count == null) {
|
||||
throw exception(SKU_NOT_EXISTS);
|
||||
}
|
||||
if (count > sku.getStock()) {
|
||||
throw exception(SKU_STOCK_NOT_ENOUGH);
|
||||
}
|
||||
// 不校验库存不足,避免购物车场景,商品无货的情况
|
||||
});
|
||||
return skus;
|
||||
}
|
||||
|
Reference in New Issue
Block a user