This commit is contained in:
wangjinlei
2024-04-30 17:05:28 +08:00
parent 871fc79cca
commit 55b733c693
3 changed files with 42 additions and 14 deletions

View File

@@ -34,4 +34,6 @@ public class CourseCatalogueChapterVideoEntity {
private String playAuth;
@TableField(exist = false)
private UserCourseVideoPositionEntity userCourseVideoPositionEntity;
@TableField(exist = false)
private String videoUrl;
}

View File

@@ -35,6 +35,21 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
HashMap<String, Object> flag = new HashMap<>();
flag.put("detail",byId);
List<CourseCatalogueChapterVideoEntity> courseCatalogueChapterVideoEntities = courseCatalogueChapterVideoDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterVideoEntity>().eq(CourseCatalogueChapterVideoEntity::getChapterId, chapterId));
for(CourseCatalogueChapterVideoEntity c : courseCatalogueChapterVideoEntities){
if(c.getType()==1){
continue;
}
String s_str = "";
if(c.getVideo().startsWith("common/")){
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/";
} else if (c.getVideo().startsWith("article/")) {
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/";
}else{
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/";
}
c.setVideoUrl(s_str+c.getVideo());
}
flag.put("videos",courseCatalogueChapterVideoEntities);
return flag;
}

View File

@@ -14,10 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@@ -39,6 +36,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
private CourseCatalogueChapterVideoDao courseCatalogueChapterVideoDao;
@Autowired
private UserCourseVideoPositionDao userCourseVideoPositionDao;
@Autowired
private CourseSociologyDao courseSociologyDao;
//根据标签获取课程列表
@@ -104,18 +103,30 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
@Override
public List getMyCourse(int type) {
Integer uId = ShiroUtils.getUId();
//获取所有国学标签
List<CourseSociologyEntity> courseSociologyEntities = courseSociologyDao.selectList(null);
MyUserEntity userEntity = userService.getById(uId);
if(userEntity.getVip()!="0"){
List<Integer> collect = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getUserId, userEntity.getId())).stream().map(UserCourseBuyEntity::getCourseId).collect(Collectors.toList());
if(userEntity.getVip().equals("0")&&collect.size()==0){
return new ArrayList<>();
}
MPJLambdaWrapper<UserCourseBuyEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.select(UserCourseBuyEntity::getEndTime);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,UserCourseBuyEntity::getCourseId);
wrapper.eq(UserCourseBuyEntity::getUserId,uId);
wrapper.gt(UserCourseBuyEntity::getEndTime,new Date());
List<CourseEntity> courseEntities = userCourseBuyDao.selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
ArrayList<Map> flag = new ArrayList<>();
for (CourseSociologyEntity c : courseSociologyEntities){
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
MPJLambdaWrapper<CourseToSociologyEntity> courseToSociologyEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
courseToSociologyEntityMPJLambdaWrapper.selectAll(CourseEntity.class);
courseToSociologyEntityMPJLambdaWrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyEntity::getCourseId);
courseToSociologyEntityMPJLambdaWrapper.eq(CourseToSociologyEntity::getSociologyId,c.getId());
courseToSociologyEntityMPJLambdaWrapper.in(userEntity.getVip().equals("0"),CourseToSociologyEntity::getCourseId,collect);
List<CourseEntity> courseEntities = courseToSociologyDao.selectJoinList(CourseEntity.class, courseToSociologyEntityMPJLambdaWrapper);
if(courseEntities.size()==0){
continue;
}
stringObjectHashMap.put("sociology",c);
stringObjectHashMap.put("courseList",courseEntities);
flag.add(stringObjectHashMap);
}
return flag;
}
private Integer catalogueCompletion(CourseCatalogueEntity c){