修改VIP商品优惠

This commit is contained in:
wuchunlei
2025-04-01 13:37:46 +08:00
parent 62fdec7810
commit 23a1d0e88d
5 changed files with 51 additions and 32 deletions

View File

@@ -765,11 +765,11 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
goodsResponseVo.setProductName(shopProduct.getProductName());
goodsResponseVo.setProductImage(shopProduct.getProductImages());
goodsResponseVo.setProductPrice(shopProduct.getPrice());
// if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){
// goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct));
// }else {
if (userVipService.isVip(userId)&&shopProduct.getIsVipPrice()==1){
goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct));
}else {
goodsResponseVo.setVipPrice(BigDecimal.ZERO);
// }
}
goodsResponseVo.setQuantity(buyOrderProduct.getQuantity());
goodsResponseVo.setProductId(shopProduct.getProductId());
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();

View File

@@ -78,13 +78,14 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
}else if (userVipService.isVip()){
b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP);
}else {
BigDecimal activityPrice = shopProduct.getActivityPrice();
b = (activityPrice == null || activityPrice.equals(BigDecimal.ZERO)) ? shopProduct.getPrice() : activityPrice;
}
// else {
// BigDecimal activityPrice = shopProduct.getActivityPrice();
// b = (activityPrice == null || activityPrice.equals(BigDecimal.ZERO)) ? shopProduct.getPrice() : activityPrice;
// }
if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0
&&b.compareTo(shopProduct.getActivityPrice())>0){
b = shopProduct.getActivityPrice();
b = new BigDecimal(0);
}
return b;
}