刘俊驰 7 месяцев назад
Родитель
Сommit
0c52b87779

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentLessonTrainingDetailWrapper.java

@@ -73,6 +73,10 @@ public class StudentLessonTrainingDetailWrapper {
         @ApiModelProperty("曲目id")
         private Long musicScoreId;
 
+
+        @ApiModelProperty("课件ID 布置课件视频作业时")
+        private String lessonCoursewareId;
+
         @ApiModelProperty("曲目名称")
         private String  musicScoreName;
 

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -908,7 +908,9 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 
     @Override
     public List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> findStudentHomeworkCourseware(CourseHomeworkWrapper.StudentCourseHomeworkQuery query) {
-        return studentLessonTrainingDetailService.getBaseLessonTrainingDetail(query.getCourseScheduleId().longValue(), query.getType(), query.getUserId(),"VIDEO");
+        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> detailList = studentLessonTrainingDetailService.getBaseLessonTrainingDetail(query.getCourseScheduleId().longValue(), query.getType(), query.getUserId(), "VIDEO");
+        studentLessonTrainingDetailService.updateMusicScoreName(detailList);
+        return detailList;
     }
 
     /**

+ 42 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentLessonTrainingDetailServiceImpl.java

@@ -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,45 @@ 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.isNotEmpty(courseTypeIds)) {
+                    if (courseTypeIds.contains(Integer.parseInt(studentLessonTrainingDetail.getLessonCoursewareId()))) {
+                        studentLessonTrainingDetail.setUseStatus("UNLOCK");
+                    } else {
+                        studentLessonTrainingDetail.setUseStatus("LOCK");
+                    }
+                }
+            } else if ("VIDEO".equals(studentLessonTrainingDetail.getHomeworkType())){
+                studentLessonTrainingDetail.setUseStatus("UNLOCK");
+            }
+        }
+
+
     }