修改vip价格

This commit is contained in:
wuchunlei
2025-03-05 09:17:41 +08:00
parent 3cfcfee825
commit efc893767d
3 changed files with 54 additions and 1 deletions

View File

@@ -280,7 +280,7 @@ public class ShopProductController {
}
for (ShopProductBookEntity spbe : ss) {
ShopProduct ca_sp = shopProductService.getById(spbe.getProductId());
if (ca_sp.getIsVipPrice()==1){
if (!userVipService.noVip()&&ca_sp.getIsVipPrice()==1){
ca_sp.setVipPrice(shopProductService.getVipPrice(ca_sp));
}
frag.add(ca_sp);

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.UserVipService;
import com.peanut.modules.medical.service.ShopProductMedicineLabelService;
import com.peanut.modules.medical.service.ShopProductMedicineMarketService;
import com.peanut.modules.medical.service.ShopProductService;
@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@@ -29,6 +32,8 @@ public class MedicalLabelAndMarketController {
private ShopProductMedicineMarketService marketService;
@Autowired
private ShopProductService productService;
@Autowired
private UserVipService userVipService;
/**
* 分类标签树
@@ -62,6 +67,22 @@ public class MedicalLabelAndMarketController {
wrapper.orderByAsc(ShopProductToMedicineMarket::getSort);
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);
}
}
return R.ok().put("result", page);
}

View File

@@ -349,4 +349,36 @@ public class VisitorController {
Long.parseLong(params.get("page").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("courseList",courseEntityPage);
}
//获取标签下课程
@RequestMapping("/getCourseByPsycheId")
public R getCourseByPsycheId(@RequestBody Map params){
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToPsyche::getPsycheId,params.get("psycheId"));
List<CourseEntity> courseList = courseService.list(wrapper);
return R.ok().put("courseList",courseList);
}
//课程详情
@RequestMapping("/getPsycheCourseInfo")
public R getPsycheCourseInfo(@RequestBody Map params){
Map<String, Object> courseDetail = new HashMap<>();
//基础信息
CourseEntity course = courseService.getById(params.get("courseId").toString());
courseDetail.put("course",course);
//目录信息
List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
.eq(CourseCatalogueEntity::getCourseId, course.getId()).orderByAsc(CourseCatalogueEntity::getSort));
courseDetail.put("catalogues",courseCatalogueEntities);
return R.ok().put("data",courseDetail);
}
//课程章节
@RequestMapping("/getPsycheCourseCatalogueInfo")
public R getPsycheCourseCatalogueInfo(@RequestBody Map params){
LambdaQueryWrapper<CourseCatalogueChapterEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,params.get("catalogueId"));
wrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
List<CourseCatalogueChapterEntity> list = courseCatalogueChapterService.list(wrapper);
return R.ok().put("list",list);
}
}