Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -371,6 +371,12 @@
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -31,4 +32,10 @@ public class CourseCatalogueEntity{
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 是否同步创建商品
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer needCreate;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class ShopProduct implements Serializable {
|
||||
*/
|
||||
private Integer sumSales;
|
||||
/**
|
||||
* 商品类型 01: 画册 02:书 04:仪器,03:预售书
|
||||
* 商品类型01挂图02书籍03预售书04仪器05课程06小店商品
|
||||
*/
|
||||
private String goodsType;
|
||||
private String goodsTypeCode;
|
||||
|
||||
@@ -14,6 +14,8 @@ public class ShopProductCourseEntity {
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer courseId;
|
||||
|
||||
private Integer catalogueId;
|
||||
|
||||
@@ -2,9 +2,14 @@ package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
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.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterService;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterVideoService;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,6 +30,10 @@ public class CourseController {
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
@Autowired
|
||||
private CourseCatalogueChapterService courseCatalogueChapterService;
|
||||
@Autowired
|
||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||
|
||||
|
||||
@RequestMapping("/getCourseList")
|
||||
@@ -56,12 +65,9 @@ public class CourseController {
|
||||
return R.ok().put("catalogues",courseCatalogues);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/addCourseCatalogue")
|
||||
public R addCourseCatalogue(@RequestBody CourseCatalogueEntity courseCatalogue){
|
||||
|
||||
//课程这里增加对应商品的还没有做
|
||||
courseCatalogueService.save(courseCatalogue);
|
||||
courseCatalogueService.addCourseCatalogue(courseCatalogue);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -70,4 +76,57 @@ public class CourseController {
|
||||
return courseCatalogueService.delCourseCatalogue(param.getId());
|
||||
}
|
||||
|
||||
@RequestMapping("/editCourseCatalogue")
|
||||
public R editCourseCatalogue(@RequestBody CourseCatalogueEntity c){
|
||||
courseCatalogueService.updateById(c);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseCatalogueChapterList")
|
||||
public R getCourseCatalogueChapterList(@RequestBody ParamTo param){
|
||||
Page courseCatalogueChapterList = courseCatalogueChapterService.getCourseCatalogueChapterList(param);
|
||||
return R.ok().put("page",courseCatalogueChapterList);
|
||||
}
|
||||
|
||||
@RequestMapping("/addCourseCatalogueChapter")
|
||||
public R addCourseCatalogueChapter(@RequestBody CourseCatalogueChapterEntity courseCatalogueChapterEntity){
|
||||
courseCatalogueChapterService.save(courseCatalogueChapterEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/delCourseCatalogueChapter")
|
||||
public R delCourseCatalogueChapter(@RequestBody ParamTo param){
|
||||
return courseCatalogueChapterService.delCourseCatalogueChapter(param.getId());
|
||||
}
|
||||
|
||||
@RequestMapping("/editCourseCatalogueChapter")
|
||||
public R editCourseCatalogueChapter(@RequestBody CourseCatalogueChapterEntity courseCatalogueChapterEntity){
|
||||
courseCatalogueChapterService.updateById(courseCatalogueChapterEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseCatalogueChapterVideoList")
|
||||
public R getCourseCatalogueChapterVideoList(@RequestBody ParamTo param){
|
||||
courseCatalogueChapterVideoService.getCourseCatalogueChapterVideoList(param);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/addCourseCatalogueChapterVideo")
|
||||
public R addCourseCatalogueChapterVideo(@RequestBody CourseCatalogueChapterVideoEntity courseCatalogueChapterVideoEntity){
|
||||
courseCatalogueChapterVideoService.save(courseCatalogueChapterVideoEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/delCourseCatalogueChapterVideo")
|
||||
public R delCourseCatalogueChapterVideo(@RequestBody ParamTo param){
|
||||
courseCatalogueChapterVideoService.removeById(param.getId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/editCourseCatalogueChapterVideo")
|
||||
public R editCourseCatalogueChapterVideo(@RequestBody CourseCatalogueChapterVideoEntity courseCatalogueChapterVideoEntity){
|
||||
courseCatalogueChapterVideoService.updateById(courseCatalogueChapterVideoEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CourseCatalogueChapterService extends IService<CourseCatalogueChapterEntity> {
|
||||
|
||||
Page getCourseCatalogueChapterList(ParamTo param);
|
||||
|
||||
R delCourseCatalogueChapter(int id);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
|
||||
public interface CourseCatalogueChapterVideoService extends IService<CourseCatalogueChapterVideoEntity> {
|
||||
Page getCourseCatalogueChapterVideoList(ParamTo param);
|
||||
}
|
||||
@@ -11,4 +11,6 @@ public interface CourseCatalogueService extends IService<CourseCatalogueEntity>
|
||||
List<CourseCatalogueEntity> getCourseCatalogues(int id);
|
||||
|
||||
R delCourseCatalogue(int id);
|
||||
|
||||
void addCourseCatalogue(CourseCatalogueEntity courseCatalogue);
|
||||
}
|
||||
|
||||
@@ -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