|
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
@@ -15,6 +14,7 @@ import com.ym.mec.biz.dal.mapper.CourseSchedulePlusMapper;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.dal.school.dto.ClassesForDayDto;
|
|
|
import com.ym.mec.biz.dal.school.dto.CourseStudentDto;
|
|
|
+import com.ym.mec.biz.dal.vo.ImLiveRoomVideoVo;
|
|
|
import com.ym.mec.biz.dal.wrapper.DailySummaryOfClassesForTheCurrentSemesterWrapper;
|
|
|
import com.ym.mec.biz.dal.wrapper.TeachingPointWrapper;
|
|
|
import com.ym.mec.biz.event.source.CourseEventSource;
|
|
@@ -23,7 +23,6 @@ import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
-import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
@@ -42,7 +41,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.jetbrains.annotations.NotNull;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -56,13 +54,11 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType.MUSIC_NETWORK;
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.*;
|
|
@@ -189,6 +185,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
@Autowired
|
|
|
private LessonExaminationService lessonExaminationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ImLiveRoomVideoDao imLiveRoomVideoDao;
|
|
|
+
|
|
|
private final Logger businessLogger = LoggerFactory
|
|
|
.getLogger(this.getClass());
|
|
|
|
|
@@ -1081,10 +1080,35 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|| cs.getType().equals(CourseScheduleType.COMM))
|
|
|
.map(CourseScheduleDto::getId).collect(Collectors.toList());
|
|
|
|
|
|
- // 直播课设置直播间信息
|
|
|
- Map<String, ImLiveBroadcastRoomDto> liveRoomMap = getLiveRoomMap(studentCourseSchedulesWithDate);
|
|
|
+ courseDataFormat(user, now, studentCourseSchedulesWithDate, courseScheduleIds);
|
|
|
+ result.put("list", studentCourseSchedulesWithDate);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
- Map<Integer, String> subjectNameCourseMap = new HashMap<>();
|
|
|
+ private void courseDataFormat(SysUser user, Date now, List<CourseScheduleDto> studentCourseSchedulesWithDate, List<Long> courseScheduleIds) {
|
|
|
+ // 直播课设置直播间信息
|
|
|
+ Map<String, ImLiveBroadcastRoomDto> liveRoomMap = getLiveRoomMap(studentCourseSchedulesWithDate);
|
|
|
+
|
|
|
+ // 直播间记录回放记录
|
|
|
+
|
|
|
+ // 直播间房间号集合
|
|
|
+ List<String> roomIds = studentCourseSchedulesWithDate.stream()
|
|
|
+ .filter(cs -> cs.getType().equals(CourseSchedule.CourseScheduleType.LIVE))
|
|
|
+ .map(CourseScheduleDto::getLiveRoomId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, List<ImLiveRoomVideoVo>> imLiveRoomVideoVoMap = getLiveRecord(roomIds);
|
|
|
+
|
|
|
+ for (CourseScheduleDto courseScheduleDto : studentCourseSchedulesWithDate) {
|
|
|
+ if (StringUtils.isNotEmpty(courseScheduleDto.getLiveRoomId())) {
|
|
|
+ List<ImLiveRoomVideoVo> imLiveRoomVideoVoList = imLiveRoomVideoVoMap.get(courseScheduleDto.getLiveRoomId());
|
|
|
+ if (CollectionUtils.isNotEmpty(imLiveRoomVideoVoList)) {
|
|
|
+ courseScheduleDto.setHasVideoRecord(true);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ courseScheduleDto.setHasVideoRecord(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<Integer, String> subjectNameCourseMap = new HashMap<>();
|
|
|
Map<Integer, String> subjectIdCourseMap = new HashMap<>();
|
|
|
Map<Integer, Integer> reviewIdMap = new HashMap<>();
|
|
|
Map<Long, Long> StudentReviewIdMap = new HashMap<>();
|
|
@@ -1100,9 +1124,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
StudentReviewIdMap = studentReviews.stream().collect(Collectors.toMap(CourseScheduleComplaints::getCourseScheduleId, CourseScheduleComplaints::getId));
|
|
|
}
|
|
|
|
|
|
- Set<Long> practiceGroupIds = studentCourseSchedulesWithDate.stream().filter(cs -> CourseScheduleType.PRACTICE.equals(cs.getType())&&Objects.nonNull(cs.getMusicGroupId())).map(cs->Long.valueOf(cs.getMusicGroupId())).collect(Collectors.toSet());
|
|
|
+ Set<Long> practiceGroupIds = studentCourseSchedulesWithDate.stream().filter(cs -> CourseScheduleType.PRACTICE.equals(cs.getType())&&Objects.nonNull(cs.getMusicGroupId())).map(cs->Long.valueOf(cs.getMusicGroupId())).collect(Collectors.toSet());
|
|
|
|
|
|
- Map<Long, PracticeGroupType> practiceGroupTypeMap = new HashMap<>();
|
|
|
+ Map<Long, PracticeGroupType> practiceGroupTypeMap = new HashMap<>();
|
|
|
if(!CollectionUtils.isEmpty(practiceGroupIds)){
|
|
|
List<PracticeCourseDto> practiceGroups = practiceGroupDao.getPracticeGroupByIds(new ArrayList<>(practiceGroupIds));
|
|
|
practiceGroupTypeMap = practiceGroups.stream().collect(Collectors.toMap(PracticeCourseDto::getId, PracticeCourseDto::getType));
|
|
@@ -1130,11 +1154,22 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
courseScheduleDto.setOs(courseScheduleDto.getLiveBroadcastRoom().getOs());
|
|
|
}
|
|
|
}
|
|
|
- result.put("list", studentCourseSchedulesWithDate);
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ private Map<String, List<ImLiveRoomVideoVo>> getLiveRecord(List<String> roomIds) {
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(roomIds)) {
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ List<ImLiveRoomVideoVo> imLiveRoomVideoVos = imLiveRoomVideoDao.queryByRoomIds(roomIds);
|
|
|
+ if (CollectionUtils.isEmpty(imLiveRoomVideoVos)) {
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ return imLiveRoomVideoVos.stream().collect(Collectors.groupingBy(ImLiveRoomVideoVo::getRoomUid));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 直播课设置直播间信息
|
|
|
* @param studentCourseSchedulesWithDate List<CourseScheduleDto>
|
|
|
* @return Map<String, ImLiveBroadcastRoomDto>
|
|
@@ -3458,6 +3493,20 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
e.setRestOfClass(notStartRecords.size());
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ // 直播房间号ID
|
|
|
+ List<String> liveRoomIds = notStartRecords.stream().map(e -> e.getLiveRoomId()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, List<ImLiveRoomVideoVo>> imLiveRoomVideoVoMap = getLiveRecord(liveRoomIds);
|
|
|
+ notStartRecords.forEach(e -> {
|
|
|
+ if (imLiveRoomVideoVoMap != null && imLiveRoomVideoVoMap.containsKey(e.getLiveRoomId())) {
|
|
|
+ e.setHasVideoRecord(true);
|
|
|
+ } else {
|
|
|
+ e.setHasVideoRecord(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
pageInfo.setRows(notStartRecords);
|
|
|
return pageInfo;
|
|
|
}
|
|
@@ -3474,6 +3523,19 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
pageInfo.setTotal(count);
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = courseScheduleDao.findStudentCourseScheduleRecords(params);
|
|
|
+
|
|
|
+ // 直播房间号ID
|
|
|
+ List<String> liveRoomIds = dataList.stream().map(e -> e.getLiveRoomId()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, List<ImLiveRoomVideoVo>> imLiveRoomVideoVoMap = getLiveRecord(liveRoomIds);
|
|
|
+ dataList.forEach(e -> {
|
|
|
+ if (imLiveRoomVideoVoMap != null && imLiveRoomVideoVoMap.containsKey(e.getLiveRoomId())) {
|
|
|
+ e.setHasVideoRecord(true);
|
|
|
+ } else {
|
|
|
+ e.setHasVideoRecord(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
if (count == 0) {
|
|
|
dataList = new ArrayList<>();
|
|
@@ -5758,6 +5820,26 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<CourseScheduleStudentDto> queryDetailList(CourseDetailQueryInfo courseDetailQueryInfo) {
|
|
|
+ List<CourseScheduleStudentDto> courseScheduleStudentDtos = courseScheduleDao.queryDetailList(courseDetailQueryInfo);
|
|
|
+
|
|
|
+
|
|
|
+ // 直播房间号ID
|
|
|
+ List<String> liveRoomIds = courseScheduleStudentDtos.stream().map(e -> e.getLiveRoomId()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, List<ImLiveRoomVideoVo>> imLiveRoomVideoVoMap = getLiveRecord(liveRoomIds);
|
|
|
+ courseScheduleStudentDtos.forEach(e -> {
|
|
|
+ if (imLiveRoomVideoVoMap != null && imLiveRoomVideoVoMap.containsKey(e.getLiveRoomId())) {
|
|
|
+ e.setHasVideoRecord(true);
|
|
|
+ } else {
|
|
|
+ e.setHasVideoRecord(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return courseScheduleStudentDtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<CourseStudentDto> queryCourseStudentList(Long courseId) {
|
|
|
List<CourseStudentDto> courseStudentDtos = studentAttendanceDao.queryCourseStudentList(courseId);
|
|
|
if(CollectionUtils.isNotEmpty(courseStudentDtos)){
|