diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java index bcff2d6..0b3b996 100644 --- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -6,6 +6,7 @@ import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.vo.administer.MemberStudyLogVO; import com.subsidy.vo.member.ContentVodNewVO; import com.subsidy.vo.sign.ClassSignInfoVO; +import com.subsidy.vo.vod.ClassMemberPlayLengthVO; import com.subsidy.vo.vod.GetMemberStudyInfoVO; import com.subsidy.vo.vod.StudyHistoryVO; import org.springframework.stereotype.Repository; @@ -84,7 +85,7 @@ public interface VodPlayHistoryMapper extends BaseMapper { /** * 以班级、人的维度查询某个人的视频观看时长 */ - List classMemberPlayLength(Long classId); + List classMemberPlayLength(Long classId); } diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 073e41d..b924955 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -68,6 +68,7 @@ import com.subsidy.vo.done.GetMaxScoreVO; import com.subsidy.vo.done.TestScoreInfoVO; import com.subsidy.vo.member.ClassSignVO; import com.subsidy.vo.sign.AnswerRecordVO; +import com.subsidy.vo.vod.ClassMemberPlayLengthVO; import com.subsidy.vo.vod.ClassVodCompleteInfoVO; import com.subsidy.vo.vod.DayInfoItemVO; import com.subsidy.vo.vod.GetMemberStudyInfoVO; @@ -927,16 +928,22 @@ public class AdministerServiceImpl extends ServiceImpl vodDictDOS = vodDictMapper.getCourseVods(classVodDailyInfoDTO.getClassId(),null); + List vodDictDOS = vodDictMapper.getCourseVods(classDictDO.getCourseId(), null); + + HashMap vodHashmap = new HashMap<>(); + for (VodDictDO vodDictDO : vodDictDOS) { + vodHashmap.put(vodDictDO.getVodName(), vodDictDO.getVodLength()); + } // 表头 List title = new ArrayList<>(); title.add("姓名"); title.add("合计完成率"); - for (VodDictDO vodDictDO : vodDictDOS){ + for (VodDictDO vodDictDO : vodDictDOS) { title.add(vodDictDO.getVodName()); } @@ -946,15 +953,16 @@ public class AdministerServiceImpl extends ServiceImpl classDailyInfoVOS = classDailyInfoVOIPage.getRecords(); //获取班级、每个学员维度的视频播放总时长 - List vodPlayHistoryDOS = vodPlayHistoryMapper.classMemberPlayLength(classVodDailyInfoDTO.getClassId()); + List classMemberPlayLengthVOS = vodPlayHistoryMapper.classMemberPlayLength(classVodDailyInfoDTO.getClassId()); HashMap hashMap = new HashMap<>(); //存在一个map里 - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - hashMap.put(vodPlayHistoryDO.getMemberId() + "-" + vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getPlayLength()); + for (ClassMemberPlayLengthVO classMemberPlayLengthVO : classMemberPlayLengthVOS) { + hashMap.put(classMemberPlayLengthVO.getMemberId() + "-" + classMemberPlayLengthVO.getVodName(), classMemberPlayLengthVO.getPlayLength()); } + writeVodExcel(classDailyInfoVOS, hashMap, title, vodHashmap); } diff --git a/src/main/java/com/subsidy/vo/vod/ClassMemberPlayLengthVO.java b/src/main/java/com/subsidy/vo/vod/ClassMemberPlayLengthVO.java new file mode 100644 index 0000000..a01105e --- /dev/null +++ b/src/main/java/com/subsidy/vo/vod/ClassMemberPlayLengthVO.java @@ -0,0 +1,32 @@ +package com.subsidy.vo.vod; + +import lombok.Data; + +@Data +public class ClassMemberPlayLengthVO { + + private Long id; + + /** + * 班级id + */ + private Long classId; + + /** + * 视频id + */ + private Long vodId; + + /** + * 学生id + */ + private Long memberId; + + /** + * 观看时长 + */ + private Integer playLength; + + private String vodName; + +} diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index 1d7f48a..99e489e 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -317,7 +317,7 @@ order by t.play_date desc - SELECT t.member_id, t.vod_id,