过滤价格为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.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -126,34 +128,41 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
continue;
}
CourseEntity one = this.getOne(new LambdaQueryWrapper<CourseEntity>().eq(CourseEntity::getId, c.getCourseId()));
ShopProduct shopProduct = new ShopProduct();
shopProduct.setProductName(one.getTitle()+"."+c.getTitle()+"(半年)");
shopProduct.setPrice(c.getHalfFee());
shopProduct.setGoodsType("05");
shopProduct.setProductStock(2000);
shopProductDao.insert(shopProduct);
//添加半年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
shopProductCourseEntity.setProductId(shopProduct.getProductId());
shopProductCourseEntity.setCourseId(c.getCourseId());
shopProductCourseEntity.setCatalogueId(c.getId());
shopProductCourseEntity.setDays(180);
shopProductCourseDao.insert(shopProductCourseEntity);
//添加一年期商品
ShopProduct shopProduct1 = new ShopProduct();
shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)");
shopProduct1.setPrice(c.getFee());
shopProduct1.setGoodsType("05");
shopProduct1.setProductStock(2000);
shopProductDao.insert(shopProduct1);
//添加一年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
shopProductCourseEntity1.setProductId(shopProduct1.getProductId());
shopProductCourseEntity1.setCourseId(c.getCourseId());
shopProductCourseEntity1.setCatalogueId(c.getId());
shopProductCourseEntity1.setDays(365);
shopProductCourseDao.insert(shopProductCourseEntity1);
if (c.getHalfFee().compareTo(new BigDecimal(0))==1) {
ShopProduct shopProduct = new ShopProduct();
shopProduct.setProductName(one.getTitle() + "." + c.getTitle() + "(半年)");
shopProduct.setPrice(c.getHalfFee());
shopProduct.setGoodsType("05");
shopProduct.setProductStock(2000);
shopProduct.setCreateTime(new Date());
shopProduct.setProductImages(one.getImage());
shopProductDao.insert(shopProduct);
//添加半年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
shopProductCourseEntity.setProductId(shopProduct.getProductId());
shopProductCourseEntity.setCourseId(c.getCourseId());
shopProductCourseEntity.setCatalogueId(c.getId());
shopProductCourseEntity.setDays(180);
shopProductCourseDao.insert(shopProductCourseEntity);
}
if (c.getFee().compareTo(new BigDecimal(0))==1){
//添加一年期商品
ShopProduct shopProduct1 = new ShopProduct();
shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)");
shopProduct1.setPrice(c.getFee());
shopProduct1.setGoodsType("05");
shopProduct1.setProductStock(2000);
shopProduct1.setCreateTime(new Date());
shopProduct1.setProductImages(one.getImage());
shopProductDao.insert(shopProduct1);
//添加一年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
shopProductCourseEntity1.setProductId(shopProduct1.getProductId());
shopProductCourseEntity1.setCourseId(c.getCourseId());
shopProductCourseEntity1.setCatalogueId(c.getId());
shopProductCourseEntity1.setDays(365);
shopProductCourseDao.insert(shopProductCourseEntity1);
}
}
}