Merge remote-tracking branch 'origin/zcc'

This commit is contained in:
wangjinlei
2024-05-24 16:37:07 +08:00
11 changed files with 313 additions and 53 deletions

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.UserContribution;
public interface UserContributionService extends IService<UserContribution> {
}

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);
}
}
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.UserContributionDao;
import com.peanut.modules.common.entity.UserContribution;
import com.peanut.modules.master.service.UserContributionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterUserContributionService")
public class UserContributionServiceImpl extends ServiceImpl<UserContributionDao, UserContribution> implements UserContributionService {
}