|
@@ -19,10 +19,7 @@ import com.ym.mec.biz.dal.dto.StudentSubjectDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.ELessonTrainingType;
|
|
|
import com.ym.mec.biz.dal.enums.StandardEnum;
|
|
|
-import com.ym.mec.biz.service.ExtracurricularExercisesService;
|
|
|
-import com.ym.mec.biz.service.MemberRankCategoryMapperService;
|
|
|
-import com.ym.mec.biz.service.StudentLessonTrainingDetailService;
|
|
|
-import com.ym.mec.biz.service.SubjectService;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -62,6 +59,8 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
|
|
|
@Autowired
|
|
|
private MemberRankCategoryMapperService memberRankCategoryMapperService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MemberRankCourseTypeMapperService memberRankCourseTypeMapperService;
|
|
|
/**
|
|
|
* 查询详情
|
|
|
* @param id 详情ID
|
|
@@ -310,6 +309,46 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 判断课件
|
|
|
+ Map<Integer, List<Integer>> userVipMap = Maps.newConcurrentMap();
|
|
|
+ studentLessonTrainingDetails.parallelStream().forEach(o -> {
|
|
|
+ if (o.getUserId() == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 查询有效的会员
|
|
|
+ List<Integer> activationVipIds = cloudTeacherOrderDao.getActivationVipIds(o.getUserId().intValue());
|
|
|
+
|
|
|
+ // 获取会员的曲目分类
|
|
|
+
|
|
|
+ List<MemberRankCourseTypeMapper> courseTypeMapperList = memberRankCourseTypeMapperService.getByMemberRankId(activationVipIds);
|
|
|
+ if (CollectionUtils.isEmpty(courseTypeMapperList)) {
|
|
|
+ courseTypeMapperList = Lists.newArrayList();
|
|
|
+ }
|
|
|
+ List<Integer> categoryIds = courseTypeMapperList.stream().map(MemberRankCourseTypeMapper::getCourseType)
|
|
|
+ .distinct().map(Integer::parseInt).collect(Collectors.toList());
|
|
|
+ // 设置用户VIP可查看曲目分类
|
|
|
+ userVipMap.put(o.getUserId().intValue(), categoryIds);
|
|
|
+ });
|
|
|
+ for (StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail studentLessonTrainingDetail : studentLessonTrainingDetails) {
|
|
|
+ if (studentLessonTrainingDetail.getUserId() == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ("VIDEO".equals(studentLessonTrainingDetail.getHomeworkType()) && StringUtils.isNotBlank(studentLessonTrainingDetail.getLessonCoursewareId())) {
|
|
|
+ List<Integer> courseTypeIds = userVipMap.get(studentLessonTrainingDetail.getUserId().intValue());
|
|
|
+ if (CollectionUtils.isEmpty(courseTypeIds)) {
|
|
|
+ courseTypeIds = new ArrayList<>();
|
|
|
+ }
|
|
|
+ if (courseTypeIds.contains(Integer.parseInt(studentLessonTrainingDetail.getLessonCoursewareId()))) {
|
|
|
+ studentLessonTrainingDetail.setUseStatus("UNLOCK");
|
|
|
+ } else {
|
|
|
+ studentLessonTrainingDetail.setUseStatus("LOCK");
|
|
|
+ }
|
|
|
+ } else if ("VIDEO".equals(studentLessonTrainingDetail.getHomeworkType())){
|
|
|
+ studentLessonTrainingDetail.setUseStatus("UNLOCK");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|