修改vipprice,用户会员类型修改

This commit is contained in:
wuchunlei
2025-03-06 11:13:26 +08:00
parent 7921c8bfa9
commit 1fcde7e350
12 changed files with 148 additions and 86 deletions

View File

@@ -33,7 +33,7 @@ public class MedicalLabelAndMarketController {
@Autowired
private ShopProductService productService;
@Autowired
private UserVipService userVipService;
private com.peanut.modules.book.service.ShopProductService shopProductService;
/**
* 分类标签树
@@ -68,19 +68,8 @@ public class MedicalLabelAndMarketController {
Page<ShopProduct> page = productService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
for (ShopProduct shopProduct:page.getRecords()){
//vip价格,不是vip或者活动价更低返回0
if (shopProduct.getIsVipPrice()==1){
BigDecimal b = new BigDecimal(0);
if (userVipService.is456SVip()||userVipService.is78SVip()){
b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
}else if (!userVipService.noVip()){
b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP);
}
if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0
&&b.compareTo(shopProduct.getActivityPrice())>0){
b = new BigDecimal(0);
}
shopProduct.setVipPrice(b);
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
}
}
return R.ok().put("result", page);