Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueChapterDao;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterCourseCatalogueChapterService")
|
||||
public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalogueChapterDao, CourseCatalogueChapterEntity> implements CourseCatalogueChapterService {
|
||||
|
||||
@Autowired
|
||||
private CourseCatalogueChapterVideoDao courseCatalogueChapterVideoDao;
|
||||
|
||||
@Override
|
||||
public Page getCourseCatalogueChapterList(ParamTo param) {
|
||||
LambdaQueryWrapper<CourseCatalogueChapterEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,param.getId());
|
||||
wrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
|
||||
Page<CourseCatalogueChapterEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R delCourseCatalogueChapter(int id) {
|
||||
List<CourseCatalogueChapterVideoEntity> courseCatalogueChapterVideoEntities = courseCatalogueChapterVideoDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterVideoEntity>().eq(CourseCatalogueChapterVideoEntity::getChapterId, id));
|
||||
if(courseCatalogueChapterVideoEntities.size()>0){
|
||||
return R.error(501,"删除失败,请先删除视频文件");
|
||||
}
|
||||
this.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterVideoService;
|
||||
|
||||
public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCatalogueChapterVideoDao, CourseCatalogueChapterVideoEntity> implements CourseCatalogueChapterVideoService {
|
||||
|
||||
@Override
|
||||
public Page getCourseCatalogueChapterVideoList(ParamTo param) {
|
||||
LambdaQueryWrapper<CourseCatalogueChapterVideoEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseCatalogueChapterVideoEntity::getChapterId,param.getId());
|
||||
wrapper.orderByAsc(CourseCatalogueChapterVideoEntity::getSort);
|
||||
Page<CourseCatalogueChapterVideoEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,8 @@ package com.peanut.modules.master.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueChapterDao;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueDao;
|
||||
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
||||
import com.peanut.modules.common.dao.UserToCourseDao;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.ShopProductCourseEntity;
|
||||
import com.peanut.modules.common.entity.UserToCourseEntity;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,6 +22,11 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
||||
private UserToCourseDao userToCourseDao;
|
||||
@Autowired
|
||||
private ShopProductCourseDao shopProductCourseDao;
|
||||
@Autowired
|
||||
private ShopProductDao shopProductDao;
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CourseCatalogueEntity> getCourseCatalogues(int id) {
|
||||
@@ -59,4 +58,50 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
||||
this.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCourseCatalogue(CourseCatalogueEntity courseCatalogue) {
|
||||
this.save(courseCatalogue);
|
||||
if(courseCatalogue.getNeedCreate()==1){
|
||||
this.createProduct(courseCatalogue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void createProduct(CourseCatalogueEntity courseCatalogue){
|
||||
CourseEntity courseEntity = courseDao.selectById(courseCatalogue.getCourseId());
|
||||
|
||||
//添加半年期商品
|
||||
ShopProduct shopProduct = new ShopProduct();
|
||||
shopProduct.setProductName(courseEntity.getTitle()+"."+courseCatalogue.getTitle()+"(半年)");
|
||||
shopProduct.setPrice(courseCatalogue.getHalfFee());
|
||||
shopProduct.setGoodsType("05");
|
||||
shopProductDao.insert(shopProduct);
|
||||
//添加半年期的商品课程对应关系
|
||||
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
|
||||
shopProductCourseEntity.setProductId(shopProduct.getProductId());
|
||||
shopProductCourseEntity.setCourseId(courseCatalogue.getCourseId());
|
||||
shopProductCourseEntity.setCatalogueId(courseCatalogue.getId());
|
||||
shopProductCourseEntity.setDays(180);
|
||||
shopProductCourseDao.insert(shopProductCourseEntity);
|
||||
|
||||
//添加一年期商品
|
||||
ShopProduct shopProduct1 = new ShopProduct();
|
||||
shopProduct1.setProductName(courseEntity.getTitle()+"."+courseCatalogue.getTitle()+"(一年)");
|
||||
shopProduct1.setPrice(courseCatalogue.getFee());
|
||||
shopProduct1.setGoodsType("05");
|
||||
shopProductDao.insert(shopProduct1);
|
||||
//添加一年期的商品课程对应关系
|
||||
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
|
||||
shopProductCourseEntity1.setProductId(shopProduct1.getProductId());
|
||||
shopProductCourseEntity1.setCourseId(courseCatalogue.getCourseId());
|
||||
shopProductCourseEntity1.setCatalogueId(courseCatalogue.getId());
|
||||
shopProductCourseEntity1.setDays(365);
|
||||
shopProductCourseDao.insert(shopProductCourseEntity1);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.ObjectUtils;
|
||||
|
||||
Reference in New Issue
Block a user