Procházet zdrojové kódy

Merge remote-tracking branch 'origin/feature/1022_vip' into feature/1022_vip

zouxuan před 7 měsíci
rodič
revize
41b198ae7e

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

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

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentLessonTrainingDetail.java

@@ -100,4 +100,8 @@ public class StudentLessonTrainingDetail implements Serializable {
 	@TableField(value = "update_time_")
     private Date updateTime;
 
+
+    @ApiModelProperty("课件ID 布置课件视频作业时")
+    @TableField(value = "lesson_courseware_id_")
+    private String lessonCoursewareId;
 }

+ 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;
     }
 
     /**

+ 43 - 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,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");
+            }
+        }
+
+
     }
 
 

+ 6 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -344,10 +344,10 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
 
             // 判断曲目是否在分类中
             for (SysMusicScore row : rows) {
-                if (categoryIds.contains(row.getCbsMusicCategoriesId())) {
-                    row.setUseStatus("UNLOCK");
-                } else if (StringUtils.isBlank(row.getRankIds())) {
+                if (StringUtils.isBlank(row.getRankIds())) {
                     row.setUseStatus("FREE");
+                } else if (categoryIds.contains(row.getCbsMusicCategoriesId())) {
+                    row.setUseStatus("UNLOCK");
                 } else {
                     row.setUseStatus("LOCK");
                 }
@@ -496,10 +496,10 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
             List<Integer> categoryIds = categoryMapperList.stream().map(MemberRankCategoryMapper::getCategoryId).distinct().collect(Collectors.toList());
 
             // 判断曲目是否在分类中
-                if (categoryIds.contains(sysMusicScore.getCbsMusicCategoriesId())) {
-                    clientMusicSheetInfo.setUseStatus("UNLOCK");
-                } else if (StringUtils.isBlank(sysMusicScore.getRankIds())) {
+                if (StringUtils.isBlank(sysMusicScore.getRankIds())) {
                     clientMusicSheetInfo.setUseStatus("FREE");
+                } else if (categoryIds.contains(sysMusicScore.getCbsMusicCategoriesId())) {
+                    clientMusicSheetInfo.setUseStatus("UNLOCK");
                 } else {
                     clientMusicSheetInfo.setUseStatus("LOCK");
                 }