课程目录迁移

充值记录列表添加vip详细信息
This commit is contained in:
wuchunlei
2024-06-11 16:44:33 +08:00
parent a4956714ab
commit 730693c654
6 changed files with 73 additions and 0 deletions

View File

@@ -1,11 +1,13 @@
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;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@TableName("course_catalogue_chapter")
@@ -31,4 +33,7 @@ public class CourseCatalogueChapterEntity {
@TableLogic
private Integer delFlag;
//视频列表
@TableField(exist = false)
private List<CourseCatalogueChapterVideoEntity> videoList;
}

View File

@@ -38,6 +38,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
private ExpressOrderDao expressOrderDao;
@Autowired
private BookBuyConfigDao bookBuyConfigDao;
@Autowired
private VipBuyConfigDao vipBuyConfigDao;
@Override
public Map<String, Object> initPrepareOrder(PrepareOrderDto prepareOrderDto) {
@@ -86,6 +88,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
if (b.getProductId()!=null){
b.setBookBuyConfigEntity(bookBuyConfigDao.selectById(b.getProductId()));
}
if (b.getVipBuyConfigId()!=0){
b.setVipBuyConfigEntity(vipBuyConfigDao.selectById(b.getVipBuyConfigId()));
}
//组装商品
List<BuyOrderProduct> buyOrderProducts = buyOrderProductDao.selectList(
new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, b.getOrderId()));

View File

@@ -155,6 +155,12 @@ public class CourseController {
return R.ok().put("result",sysCourseDirectEntity);
}
//课程目录迁移
@RequestMapping("/courseCatalogueTransfer")
public R courseCatalogueTransfer(@RequestBody Map<String,Object> param){
return courseService.courseCatalogueTransfer(param);
}
@@ -170,4 +176,6 @@ public class CourseController {
return R.ok();
}
}

View File

@@ -26,4 +26,6 @@ public interface CourseService extends IService<CourseEntity> {
void testCourse();
List<CourseEntity> courseAndChildrenList(Map<String, Object> params);
R courseCatalogueTransfer(Map<String,Object> param);
}

View File

@@ -29,6 +29,13 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
wrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,param.getId());
wrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
Page<CourseCatalogueChapterEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
if (page.getRecords() != null&&page.getRecords().size() > 0){
for (CourseCatalogueChapterEntity chapter:page.getRecords()){
LambdaQueryWrapper<CourseCatalogueChapterVideoEntity> videoWrapper = new LambdaQueryWrapper<>();
videoWrapper.eq(CourseCatalogueChapterVideoEntity::getChapterId,chapter.getId());
chapter.setVideoList(courseCatalogueChapterVideoDao.selectList(videoWrapper));
}
}
return page;
}

View File

@@ -37,9 +37,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
@Autowired
private CourseCatalogueDao courseCatalogueDao;
@Autowired
private CourseCatalogueChapterDao chapterDao;
@Autowired
private ShopProductDao shopProductDao;
@Autowired
private ShopProductCourseDao shopProductCourseDao;
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Override
public Page getCourseList(Map<String,Object> map) {
@@ -213,6 +217,48 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
return courseList;
}
@Override
public R courseCatalogueTransfer(Map<String, Object> param) {
String courseId = param.get("courseId").toString();
CourseCatalogueEntity catalogueEntity = courseCatalogueDao.selectById(param.get("catalogueId").toString());
if (catalogueEntity!=null){
//修改课程目录
catalogueEntity.setCourseId(Integer.parseInt(courseId));
courseCatalogueDao.updateById(catalogueEntity);
//修改目录下章节的课程字段
LambdaQueryWrapper<CourseCatalogueChapterEntity> chapterWrapper = new LambdaQueryWrapper<>();
chapterWrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,catalogueEntity.getId());
List<CourseCatalogueChapterEntity> chapterList = chapterDao.selectList(chapterWrapper);
if (chapterList != null && chapterList.size() > 0) {
for (CourseCatalogueChapterEntity chapterEntity : chapterList) {
chapterEntity.setCourseId(Integer.parseInt(courseId));
chapterDao.updateById(chapterEntity);
}
}
//修改商品课程下的课程字段
LambdaQueryWrapper<ShopProductCourseEntity> shopProductCourseWrapper = new LambdaQueryWrapper<>();
shopProductCourseWrapper.eq(ShopProductCourseEntity::getCatalogueId,catalogueEntity.getId());
List<ShopProductCourseEntity> shopProductCourseList = shopProductCourseDao.selectList(shopProductCourseWrapper);
if (shopProductCourseList != null && shopProductCourseList.size() > 0) {
for (ShopProductCourseEntity spc : shopProductCourseList) {
spc.setCourseId(Integer.parseInt(courseId));
shopProductCourseDao.updateById(spc);
}
}
//修改user_course_buy下的课程字段
LambdaQueryWrapper<UserCourseBuyEntity> userCourseBuyWrapper = new LambdaQueryWrapper<>();
userCourseBuyWrapper.eq(UserCourseBuyEntity::getCatalogueId,catalogueEntity.getId());
List<UserCourseBuyEntity> userCourseBuyList = userCourseBuyDao.selectList(userCourseBuyWrapper);
if (userCourseBuyList != null && userCourseBuyList.size() > 0) {
for (UserCourseBuyEntity buy : userCourseBuyList) {
buy.setCourseId(Integer.parseInt(courseId));
userCourseBuyDao.updateById(buy);
}
}
}
return R.ok();
}
private List<Integer> sociologyIds(Integer id){
ArrayList<Integer> integers = new ArrayList<>();