过滤价格为0,添加图片

This commit is contained in:
wuchunlei
2024-05-24 09:33:14 +08:00
parent cda8e4c422
commit 6e45137037

View File

@@ -15,7 +15,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -126,11 +128,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
continue; continue;
} }
CourseEntity one = this.getOne(new LambdaQueryWrapper<CourseEntity>().eq(CourseEntity::getId, c.getCourseId())); CourseEntity one = this.getOne(new LambdaQueryWrapper<CourseEntity>().eq(CourseEntity::getId, c.getCourseId()));
if (c.getHalfFee().compareTo(new BigDecimal(0))==1) {
ShopProduct shopProduct = new ShopProduct(); ShopProduct shopProduct = new ShopProduct();
shopProduct.setProductName(one.getTitle() + "." + c.getTitle() + "(半年)"); shopProduct.setProductName(one.getTitle() + "." + c.getTitle() + "(半年)");
shopProduct.setPrice(c.getHalfFee()); shopProduct.setPrice(c.getHalfFee());
shopProduct.setGoodsType("05"); shopProduct.setGoodsType("05");
shopProduct.setProductStock(2000); shopProduct.setProductStock(2000);
shopProduct.setCreateTime(new Date());
shopProduct.setProductImages(one.getImage());
shopProductDao.insert(shopProduct); shopProductDao.insert(shopProduct);
//添加半年期的商品课程对应关系 //添加半年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity(); ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
@@ -139,13 +144,16 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
shopProductCourseEntity.setCatalogueId(c.getId()); shopProductCourseEntity.setCatalogueId(c.getId());
shopProductCourseEntity.setDays(180); shopProductCourseEntity.setDays(180);
shopProductCourseDao.insert(shopProductCourseEntity); shopProductCourseDao.insert(shopProductCourseEntity);
}
if (c.getFee().compareTo(new BigDecimal(0))==1){
//添加一年期商品 //添加一年期商品
ShopProduct shopProduct1 = new ShopProduct(); ShopProduct shopProduct1 = new ShopProduct();
shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)"); shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)");
shopProduct1.setPrice(c.getFee()); shopProduct1.setPrice(c.getFee());
shopProduct1.setGoodsType("05"); shopProduct1.setGoodsType("05");
shopProduct1.setProductStock(2000); shopProduct1.setProductStock(2000);
shopProduct1.setCreateTime(new Date());
shopProduct1.setProductImages(one.getImage());
shopProductDao.insert(shopProduct1); shopProductDao.insert(shopProduct1);
//添加一年期的商品课程对应关系 //添加一年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity(); ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
@@ -156,6 +164,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
shopProductCourseDao.insert(shopProductCourseEntity1); shopProductCourseDao.insert(shopProductCourseEntity1);
} }
} }
}