|
@@ -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.CbsLessonCoursewareDetailWrapper;
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsMaterialRefWrapper;
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsMaterialRefWrapper;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import com.microsvc.toolkit.common.response.template.R;
|
|
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.SubjectDao;
|
|
import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
import com.ym.mec.biz.dal.dto.SimpleUserDto;
|
|
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.enums.ClientEnum;
|
|
import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
|
|
import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
|
|
import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
|
|
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.common.exception.BizException;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -58,6 +55,12 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
@Resource
|
|
@Resource
|
|
private SysMusicScoreService sysMusicScoreService;
|
|
private SysMusicScoreService sysMusicScoreService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CloudTeacherOrderDao cloudTeacherOrderDao;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private MemberRankCourseTypeMapperService memberRankCourseTypeMapperService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public IPage<LessonCoursewareWrapper.LessonCoursewareDto> selectPage(IPage<LessonCoursewareWrapper.LessonCoursewareDto> page, LessonCoursewareWrapper.LessonCoursewareQuery query) {
|
|
public IPage<LessonCoursewareWrapper.LessonCoursewareDto> selectPage(IPage<LessonCoursewareWrapper.LessonCoursewareDto> page, LessonCoursewareWrapper.LessonCoursewareQuery query) {
|
|
if(StringUtils.isNotEmpty(query.getSearch())){
|
|
if(StringUtils.isNotEmpty(query.getSearch())){
|
|
@@ -275,6 +278,21 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail,lessonCourseware));
|
|
result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail,lessonCourseware));
|
|
return result;
|
|
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) {
|
|
for (CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail coursewareDetail : lessonCoursewareDetails) {
|
|
LessonCoursewareWrapper.RefLevelDetailInfo refLevelDetailInfo = new LessonCoursewareWrapper.RefLevelDetailInfo();
|
|
LessonCoursewareWrapper.RefLevelDetailInfo refLevelDetailInfo = new LessonCoursewareWrapper.RefLevelDetailInfo();
|
|
refLevelDetailInfo.setId(coursewareDetail.getId());
|
|
refLevelDetailInfo.setId(coursewareDetail.getId());
|
|
@@ -288,6 +306,9 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
refLevelDetailInfo.setLockFlag(false);
|
|
refLevelDetailInfo.setLockFlag(false);
|
|
refLevelDetailInfo.setLessonCoursewareName(lessonCourseware1.getName());
|
|
refLevelDetailInfo.setLessonCoursewareName(lessonCourseware1.getName());
|
|
refLevelDetailInfo.setUseFlag(coursewareDetail.getId().equals(query.getLessonCoursewareDetailId()));
|
|
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);
|
|
result.add(refLevelDetailInfo);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|