|
@@ -7,27 +7,24 @@ import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsMaterialRefWrapper;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.microsvc.toolkit.common.response.template.R;
|
|
|
+import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
|
|
|
import com.ym.mec.biz.dal.dao.SubjectDao;
|
|
|
import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
import com.ym.mec.biz.dal.dto.SimpleUserDto;
|
|
|
-import com.ym.mec.biz.dal.entity.LessonCourseware;
|
|
|
-import com.ym.mec.biz.dal.entity.LessonCoursewareUserMapper;
|
|
|
-import com.ym.mec.biz.dal.entity.SysMusicScore;
|
|
|
-import com.ym.mec.biz.dal.entity.Teacher;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.ClientEnum;
|
|
|
import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
|
|
|
import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
|
|
|
-import com.ym.mec.biz.service.LessonCoursewareService;
|
|
|
-import com.ym.mec.biz.service.LessonCoursewareUserMapperService;
|
|
|
-import com.ym.mec.biz.service.SysMusicScoreService;
|
|
|
-import com.ym.mec.biz.service.SysUserService;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -58,6 +55,12 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
@Resource
|
|
|
private SysMusicScoreService sysMusicScoreService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CloudTeacherOrderDao cloudTeacherOrderDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MemberRankCourseTypeMapperService memberRankCourseTypeMapperService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<LessonCoursewareWrapper.LessonCoursewareDto> selectPage(IPage<LessonCoursewareWrapper.LessonCoursewareDto> page, LessonCoursewareWrapper.LessonCoursewareQuery query) {
|
|
|
if(StringUtils.isNotEmpty(query.getSearch())){
|
|
@@ -275,6 +278,21 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail,lessonCourseware));
|
|
|
return result;
|
|
|
}
|
|
|
+ List<Long> lessonIds = new ArrayList<>();
|
|
|
+ if (query.getClient() == ClientEnum.STUDENT) {
|
|
|
+ List<Integer> activationVipIds = cloudTeacherOrderDao.getActivationVipIds(query.getTeacherId());
|
|
|
+
|
|
|
+ // 获取会员的曲目分类
|
|
|
+
|
|
|
+ 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());
|
|
|
+ // 本地的课件ID 换远程ID
|
|
|
+ lessonIds = getByLessonCoursewareIds(categoryIds).stream().map(LessonCourseware::getLessonCourseId).distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
for (CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail coursewareDetail : lessonCoursewareDetails) {
|
|
|
LessonCoursewareWrapper.RefLevelDetailInfo refLevelDetailInfo = new LessonCoursewareWrapper.RefLevelDetailInfo();
|
|
|
refLevelDetailInfo.setId(coursewareDetail.getId());
|
|
@@ -288,6 +306,9 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
refLevelDetailInfo.setLockFlag(false);
|
|
|
refLevelDetailInfo.setLessonCoursewareName(lessonCourseware1.getName());
|
|
|
refLevelDetailInfo.setUseFlag(coursewareDetail.getId().equals(query.getLessonCoursewareDetailId()));
|
|
|
+ if (lessonIds.contains(lessonCourseware1.getId()) || query.getClient() == ClientEnum.TEACHER) {
|
|
|
+ refLevelDetailInfo.setUseStatus("UNLOCK");
|
|
|
+ } else refLevelDetailInfo.setUseStatus("LOCK");
|
|
|
result.add(refLevelDetailInfo);
|
|
|
}
|
|
|
return result;
|