VIP改版
This commit is contained in:
@@ -15,8 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -27,10 +25,10 @@ public class PsycheCourseController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseCatalogueService coursecatalogueService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private CourseCatalogueService coursecatalogueService;
|
||||
@Autowired
|
||||
private UserCourseBuyService userCoursebuyService;
|
||||
@Autowired
|
||||
private UserCourseStudyingService userCourseStudyingService;
|
||||
@@ -55,24 +53,26 @@ public class PsycheCourseController {
|
||||
|
||||
//我的课程-过期课程
|
||||
@RequestMapping("/getCourseExpire")
|
||||
public R getCourseExpire(@RequestBody Map<String,Object> param){
|
||||
String vip = ShiroUtils.getUser().getVip();
|
||||
public R getCourseExpire(){
|
||||
List courseEntities = null;
|
||||
if (!"1".equals(vip)){
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.distinct();
|
||||
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId);
|
||||
//关掉本次查询del_flg = 0的条件,查询过期课程
|
||||
wrapper.disableSubLogicDel().rightJoin(UserCourseBuyEntity.class,UserCourseBuyEntity::getCatalogueId,CourseCatalogueEntity::getId);
|
||||
wrapper.rightJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
|
||||
wrapper.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId());
|
||||
wrapper.eq(UserCourseBuyEntity::getDelFlag,-1);
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getTitle,"catalogueTitle");
|
||||
wrapper.orderByAsc(CourseEntity::getSort);
|
||||
wrapper.orderByAsc(CourseCatalogueEntity::getSort);
|
||||
courseEntities = courseService.listMaps(wrapper);
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.distinct();
|
||||
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId);
|
||||
//关掉本次查询del_flg = 0的条件,查询过期课程
|
||||
wrapper.disableSubLogicDel().rightJoin(UserCourseBuyEntity.class,UserCourseBuyEntity::getCatalogueId,CourseCatalogueEntity::getId);
|
||||
wrapper.rightJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
|
||||
wrapper.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId());
|
||||
wrapper.eq(UserCourseBuyEntity::getDelFlag,-1);
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getTitle,"catalogueTitle");
|
||||
wrapper.orderByAsc(CourseEntity::getSort);
|
||||
wrapper.orderByAsc(CourseCatalogueEntity::getSort);
|
||||
List<Map<String,Object>> list = courseService.listMaps(wrapper);
|
||||
for (Map<String,Object> courseEntity : list) {
|
||||
if (!userVipService.isPsycheVip()){
|
||||
courseEntities.add(courseEntity);
|
||||
}
|
||||
}
|
||||
return R.ok().put("courseList",courseEntities);
|
||||
}
|
||||
@@ -95,17 +95,13 @@ public class PsycheCourseController {
|
||||
if (courseCatalogueEntities.size() > 0) {
|
||||
//查询目录添加,购买的课程目录详细信息
|
||||
for (CourseCatalogueEntity courseCatalogueEntity : courseCatalogueEntities) {
|
||||
List<UserVip> userVipList = userVipService.list(new LambdaQueryWrapper<UserVip>()
|
||||
.eq(UserVip::getUserId, user.getId()));
|
||||
List<UserCourseBuyEntity> userCourseBuyList = userCoursebuyService.list(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId, ShiroUtils.getUId()).eq(UserCourseBuyEntity::getCatalogueId, courseCatalogueEntity.getId()));
|
||||
//是否购买,生效时间
|
||||
if ("1".equals(user.getVip())){
|
||||
//是超级会员或者国学会员
|
||||
if (userVipList.size() > 0) {
|
||||
courseCatalogueEntity.setStartTime(userVipList.get(0).getStartTime());
|
||||
courseCatalogueEntity.setEndTime(userVipList.get(0).getEndTime());
|
||||
}
|
||||
UserVip userVip = userVipService.ownCourseCatalogueByVip(courseCatalogueEntity.getCourseId());
|
||||
if (userVip!=null){
|
||||
courseCatalogueEntity.setStartTime(userVip.getStartTime());
|
||||
courseCatalogueEntity.setEndTime(userVip.getEndTime());
|
||||
courseCatalogueEntity.setIsBuy(1);
|
||||
}else{
|
||||
//普通用户
|
||||
|
||||
Reference in New Issue
Block a user