Преглед на файлове

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

shangke преди 7 месеца
родител
ревизия
15669e4a41

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/LessonCoursewareService.java

@@ -27,5 +27,7 @@ public interface LessonCoursewareService extends IService<LessonCourseware> {
     List<LessonCoursewareWrapper.RefLevelDetailInfo> refLevel(LessonCoursewareWrapper.RefLevelQuery query);
 
     LessonCourseware getByLessonCoursewareId(Long lessonCoursewareId);
+
+    List<LessonCourseware> getByLessonCoursewareIds(List<Integer> categoryIds);
 }
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java

@@ -293,6 +293,16 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
         return list.get(0);
     }
 
+    @Override
+    public List<LessonCourseware> getByLessonCoursewareIds(List<Integer> categoryIds) {
+        if (CollectionUtils.isEmpty(categoryIds)) {
+            return new ArrayList<>();
+        }
+        return this.lambdaQuery()
+            .in(LessonCourseware::getId, categoryIds)
+            .list();
+    }
+
     private LessonCoursewareWrapper.RefLevelDetailInfo initRefLevelDetailInfo(CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail coursewareDetail,
                                                                               CbsLessonCoursewareWrapper.LessonCourseware lessonCourseware) {
         LessonCoursewareWrapper.RefLevelDetailInfo refLevelDetailInfo = new LessonCoursewareWrapper.RefLevelDetailInfo();

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

@@ -60,6 +60,9 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
     private MemberRankCategoryMapperService memberRankCategoryMapperService;
 
     @Autowired
+    private LessonCoursewareService lessonCoursewareService;
+
+    @Autowired
     private MemberRankCourseTypeMapperService memberRankCourseTypeMapperService;
     /**
      * 查询详情
@@ -310,7 +313,7 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
             }
         }
         // 判断课件
-        Map<Integer, List<Integer>> userVipMap = Maps.newConcurrentMap();
+        Map<Integer, List<Long>> userVipMap = Maps.newConcurrentMap();
         studentLessonTrainingDetails.parallelStream().forEach(o -> {
             if (o.getUserId() == null) {
                 return;
@@ -326,19 +329,21 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
             }
             List<Integer> categoryIds = courseTypeMapperList.stream().map(MemberRankCourseTypeMapper::getCourseType)
                 .distinct().map(Integer::parseInt).collect(Collectors.toList());
+            // 本地的课件ID 换远程ID
+            List<Long> lessonIds =  lessonCoursewareService.getByLessonCoursewareIds(categoryIds).stream().map(LessonCourseware::getLessonCourseId).distinct().collect(Collectors.toList());
             // 设置用户VIP可查看曲目分类
-            userVipMap.put(o.getUserId().intValue(), categoryIds);
+            userVipMap.put(o.getUserId().intValue(), lessonIds);
         });
         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());
+                List<Long> courseTypeIds = userVipMap.get(studentLessonTrainingDetail.getUserId().intValue());
                 if (CollectionUtils.isEmpty(courseTypeIds)) {
                     courseTypeIds = new ArrayList<>();
                 }
-                if (courseTypeIds.contains(Integer.parseInt(studentLessonTrainingDetail.getLessonCoursewareId()))) {
+                if (courseTypeIds.contains(Long.parseLong(studentLessonTrainingDetail.getLessonCoursewareId()))) {
                     studentLessonTrainingDetail.setUseStatus("UNLOCK");
                 } else {
                     studentLessonTrainingDetail.setUseStatus("LOCK");

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -651,6 +651,6 @@
     </select>
 
     <select id="getActivationVipIds" resultType="java.lang.Integer">
-        select distinct level_ from cloud_teacher_order where student_id_ = #{studentId}  and end_time_ &gt;=now() and status_ = 2
+        select distinct member_rank_id_ from student_member_time where student_id_ = #{studentId}  and end_time_ &gt;=now()
     </select>
 </mapper>