课程标签列表添加课程下目录
This commit is contained in:
@@ -7,6 +7,7 @@ import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.*;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -29,17 +30,15 @@ public class CourseController {
|
||||
@Autowired
|
||||
private CourseTaihumedService courseTaihumedService;
|
||||
@Autowired
|
||||
private CourseToTaihumedService courseToTaihumedService;
|
||||
@Autowired
|
||||
private CourseToTalentService courseToTalentService;
|
||||
@Autowired
|
||||
private TaihuTalentService taihuTalentService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private UserCourseBuyService userCourseBuyService;
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
|
||||
|
||||
//课程标签列表
|
||||
@@ -79,6 +78,9 @@ public class CourseController {
|
||||
course.setTaihuTalent(taihuTalent);
|
||||
}
|
||||
}
|
||||
course.setCourseCatalogueEntityList(courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
|
||||
.eq(CourseCatalogueEntity::getCourseId,course.getId())
|
||||
.orderByAsc(CourseCatalogueEntity::getSort)));
|
||||
}
|
||||
return R.ok().put("pageRes",pageRes);
|
||||
}
|
||||
@@ -86,67 +88,8 @@ public class CourseController {
|
||||
//当前课程是否可看
|
||||
@RequestMapping("/checkPermission")
|
||||
public R checkPermission(@RequestBody Map<String,Object> params){
|
||||
boolean flag = false;
|
||||
String endTime = "";
|
||||
//查询当前课程绑定的标签
|
||||
List<CourseToTaihumed> courseToTaihumeds = courseToTaihumedService.list(new LambdaQueryWrapper<CourseToTaihumed>()
|
||||
.eq(CourseToTaihumed::getCourseId,params.get("courseId")));
|
||||
List<Integer> taihumedLabelIds = new ArrayList<>();
|
||||
//当前课程的顶级标签
|
||||
for (CourseToTaihumed ctt:courseToTaihumeds){
|
||||
topLael(taihumedLabelIds,ctt.getTaihumedId());
|
||||
}
|
||||
//超级vip可看当前板块所有课程
|
||||
for (int i:taihumedLabelIds){
|
||||
if (i==99&&userVipService.is4569SVip(ShiroUtils.getUId())){
|
||||
flag = true;
|
||||
}
|
||||
if (i==100&&userVipService.is78SVip(ShiroUtils.getUId())){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag){
|
||||
//太湖英才可看自己和当前板块的所有课程
|
||||
TaihuTalent taihuTalent = taihuTalentService.getOne(new LambdaQueryWrapper<TaihuTalent>()
|
||||
.eq(TaihuTalent::getUserId,ShiroUtils.getUId()));
|
||||
if (taihuTalent != null){
|
||||
List<CourseToTalent> courseToTalents = courseToTalentService.list(new LambdaQueryWrapper<CourseToTalent>()
|
||||
.eq(CourseToTalent::getTalentId,taihuTalent.getId()));
|
||||
List<Integer> collect = courseToTalents.stream().map(CourseToTalent::getCourseId).collect(Collectors.toList());
|
||||
List<CourseToTaihumed> cTTs = courseToTaihumedService.list(new LambdaQueryWrapper<CourseToTaihumed>()
|
||||
.in(CourseToTaihumed::getCourseId,collect)
|
||||
.ne(CourseToTaihumed::getTaihumedId,101));
|
||||
List<Integer> tls = new ArrayList<>();
|
||||
for (CourseToTaihumed ctt:cTTs){
|
||||
topLael(tls,ctt.getTaihumedId());
|
||||
}
|
||||
for (int i:tls){
|
||||
for (int j:taihumedLabelIds){
|
||||
if (i==j){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag){
|
||||
//会议论坛
|
||||
if (collect.contains(params.get("courseId"))){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!flag){
|
||||
// //不是太湖英才,不是vip,查询买课
|
||||
// List<UserCourseBuyEntity> ucbs = userCourseBuyService.list(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
// .eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId())
|
||||
// .eq(UserCourseBuyEntity::getCatalogueId,params.get("catalogueId"))
|
||||
// .orderByDesc(UserCourseBuyEntity::getEndTime));
|
||||
// if (ucbs.size() > 0){
|
||||
// flag = true;
|
||||
// endTime = ucbs.get(0).getEndTime()==null?"":ucbs.get(0).getEndTime().toString();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return R.ok().put("flag",flag);
|
||||
Map<String,Object> result = courseTaihumedService.checkPermission(params);
|
||||
return R.ok().put("flag",result.get("flag")).put("endTime",result.get("msg"));
|
||||
}
|
||||
|
||||
//我的课程
|
||||
@@ -195,17 +138,4 @@ public class CourseController {
|
||||
|
||||
|
||||
|
||||
public void topLael(List<Integer> list, int courseTaihumedId){
|
||||
CourseTaihumed courseTaihumed = courseTaihumedService.getById(courseTaihumedId);
|
||||
if (courseTaihumed.getPid()==0){
|
||||
list.add(courseTaihumed.getId());
|
||||
}else {
|
||||
CourseTaihumed pCourseTaihumed = courseTaihumedService.getOne(new LambdaQueryWrapper<CourseTaihumed>()
|
||||
.eq(CourseTaihumed::getId,courseTaihumed.getPid()));
|
||||
topLael(list,pCourseTaihumed.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user