复读剔除没有跟标签关联的课程
This commit is contained in:
@@ -129,37 +129,42 @@ public class CourseRelearnController {
|
|||||||
if (cc != null) {
|
if (cc != null) {
|
||||||
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
||||||
if (courseEntity != null){
|
if (courseEntity != null){
|
||||||
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
|
int mCount = courseToMedicalService.count(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId,courseEntity.getId()));
|
||||||
wrapper.leftJoin(ShopProductCourseEntity.class,ShopProductCourseEntity::getProductId,ShopProduct::getProductId);
|
int sCount = courseToSociologyService.count(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId,courseEntity.getId()));
|
||||||
wrapper.selectAll(ShopProduct.class);
|
int pCount = courseToPsycheService.count(new LambdaQueryWrapper<CourseToPsyche>().eq(CourseToPsyche::getCourseId,courseEntity.getId()));
|
||||||
wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId"));
|
if (mCount>0||sCount > 0||pCount > 0){
|
||||||
wrapper.eq(ShopProductCourseEntity::getDays,365);
|
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.orderByAsc(ShopProduct::getPrice);
|
wrapper.leftJoin(ShopProductCourseEntity.class,ShopProductCourseEntity::getProductId,ShopProduct::getProductId);
|
||||||
List<ShopProduct> shopProducts = shopProductService.list(wrapper);
|
wrapper.selectAll(ShopProduct.class);
|
||||||
if (shopProducts.size()>0) {
|
wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId"));
|
||||||
ShopProduct shopProduct = shopProducts.get(0);
|
wrapper.eq(ShopProductCourseEntity::getDays,365);
|
||||||
ShopProduct sp1 = new ShopProduct();
|
wrapper.orderByAsc(ShopProduct::getPrice);
|
||||||
sp1.setProductId(shopProduct.getProductId());
|
List<ShopProduct> shopProducts = shopProductService.list(wrapper);
|
||||||
sp1.setProductName(shopProduct.getProductName().replace("一年","一月"));
|
if (shopProducts.size()>0) {
|
||||||
sp1.setProductImages(shopProduct.getProductImages());
|
ShopProduct shopProduct = shopProducts.get(0);
|
||||||
BigDecimal sp1Price = shopProduct.getPrice().divide(new BigDecimal(12),0, RoundingMode.DOWN);
|
ShopProduct sp1 = new ShopProduct();
|
||||||
sp1.setPrice(sp1Price);
|
sp1.setProductId(shopProduct.getProductId());
|
||||||
|
sp1.setProductName(shopProduct.getProductName().replace("一年","一月"));
|
||||||
|
sp1.setProductImages(shopProduct.getProductImages());
|
||||||
|
BigDecimal sp1Price = shopProduct.getPrice().divide(new BigDecimal(12),0, RoundingMode.DOWN);
|
||||||
|
sp1.setPrice(sp1Price);
|
||||||
|
|
||||||
ShopProduct sp2 = new ShopProduct();
|
ShopProduct sp2 = new ShopProduct();
|
||||||
sp2.setProductId(shopProduct.getProductId());
|
sp2.setProductId(shopProduct.getProductId());
|
||||||
sp2.setProductName(shopProduct.getProductName().replace("一年","三月"));
|
sp2.setProductName(shopProduct.getProductName().replace("一年","三月"));
|
||||||
sp2.setProductImages(shopProduct.getProductImages());
|
sp2.setProductImages(shopProduct.getProductImages());
|
||||||
BigDecimal sp2Price = shopProduct.getPrice().divide(new BigDecimal(4),0, RoundingMode.DOWN);
|
BigDecimal sp2Price = shopProduct.getPrice().divide(new BigDecimal(4),0, RoundingMode.DOWN);
|
||||||
sp2Price = sp2Price.multiply(new BigDecimal(0.6));
|
sp2Price = sp2Price.multiply(new BigDecimal(0.6));
|
||||||
sp2Price = sp2Price.setScale(0, RoundingMode.DOWN);
|
sp2Price = sp2Price.setScale(0, RoundingMode.DOWN);
|
||||||
sp2.setPrice(sp2Price);
|
sp2.setPrice(sp2Price);
|
||||||
|
|
||||||
List<ShopProduct> res = new ArrayList<>();
|
List<ShopProduct> res = new ArrayList<>();
|
||||||
res.add(sp1);
|
res.add(sp1);
|
||||||
res.add(sp2);
|
res.add(sp2);
|
||||||
return R.ok().put("productList",res);
|
return R.ok().put("productList",res);
|
||||||
}else {
|
}else {
|
||||||
return R.error("未找到一年期商品");
|
return R.error("未找到一年期商品");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user