|
|
@ -12,6 +12,7 @@ import com.teaching.backend.common.ErrorCode; |
|
|
|
import com.teaching.backend.exception.BusinessException; |
|
|
|
import com.teaching.backend.exception.BusinessException; |
|
|
|
import com.teaching.backend.mapper.chapter.ChapterMapper; |
|
|
|
import com.teaching.backend.mapper.chapter.ChapterMapper; |
|
|
|
import com.teaching.backend.mapper.courses.*; |
|
|
|
import com.teaching.backend.mapper.courses.*; |
|
|
|
|
|
|
|
import com.teaching.backend.mapper.records.CourseLearningRecordMapper; |
|
|
|
import com.teaching.backend.mapper.records.LearningRecordsMapper; |
|
|
|
import com.teaching.backend.mapper.records.LearningRecordsMapper; |
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsStudentMapper; |
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsStudentMapper; |
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper; |
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper; |
|
|
@ -20,6 +21,7 @@ import com.teaching.backend.model.dto.courses.CoursesDTO; |
|
|
|
import com.teaching.backend.model.dto.courses.PageDTO; |
|
|
|
import com.teaching.backend.model.dto.courses.PageDTO; |
|
|
|
import com.teaching.backend.model.entity.chapter.Chapter; |
|
|
|
import com.teaching.backend.model.entity.chapter.Chapter; |
|
|
|
import com.teaching.backend.model.entity.courses.*; |
|
|
|
import com.teaching.backend.model.entity.courses.*; |
|
|
|
|
|
|
|
import com.teaching.backend.model.entity.records.CourseLearningRecord; |
|
|
|
import com.teaching.backend.model.entity.records.LearningRecords; |
|
|
|
import com.teaching.backend.model.entity.records.LearningRecords; |
|
|
|
import com.teaching.backend.model.entity.umsAdmin.UmsStudent; |
|
|
|
import com.teaching.backend.model.entity.umsAdmin.UmsStudent; |
|
|
|
import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; |
|
|
|
import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; |
|
|
@ -88,9 +90,10 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
ObjectiveContentKnowMapper objectiveContentKnowMapper; |
|
|
|
ObjectiveContentKnowMapper objectiveContentKnowMapper; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private LearningRecordsMapper learningRecordsMapper; |
|
|
|
private LearningRecordsMapper learningRecordsMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private AddNeoKnowByCourse addNeoKnowByCourse; |
|
|
|
private AddNeoKnowByCourse addNeoKnowByCourse; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
CourseLearningRecordMapper courseLearningRecordMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -339,19 +342,29 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public HashSet<UmsStudent> queryStudentList(CourseQuery courseQuery) { |
|
|
|
public LinkedHashSet<UmsStudent> queryStudentList(CourseQuery courseQuery) { |
|
|
|
PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery); |
|
|
|
String roleId = umsUserMapper.getbyIdRoleId(courseQuery.getUserId()); |
|
|
|
List<CoursesVO> coursesList = queryCourses.getList(); |
|
|
|
if (roleId.equals("1")){ |
|
|
|
List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList()); |
|
|
|
PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery); |
|
|
|
HashSet<UmsStudent> studentNameList = new HashSet<>(); |
|
|
|
List<CoursesVO> coursesList = queryCourses.getList(); |
|
|
|
for (String courseId : courseIds) { |
|
|
|
List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList()); |
|
|
|
List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId); |
|
|
|
LinkedHashSet<UmsStudent> studentNameList = new LinkedHashSet<>(); |
|
|
|
for (StudentCourses studentUsername : studentUsernames) { |
|
|
|
for (String courseId : courseIds) { |
|
|
|
UmsStudent umsStudent = umsStudentMapper.selectByUserId(Integer.valueOf(studentUsername.getStudent())); |
|
|
|
List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId); |
|
|
|
studentNameList.add(umsStudent); |
|
|
|
List<CourseLearningRecord> courseLearningRecordList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (StudentCourses studentUsername : studentUsernames) { |
|
|
|
|
|
|
|
CourseLearningRecord courseLearningRecord = courseLearningRecordMapper.selectNewRecord(studentUsername.getStudent()); |
|
|
|
|
|
|
|
courseLearningRecordList.add(courseLearningRecord); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
courseLearningRecordList = courseLearningRecordList.stream().sorted(Comparator.comparing(CourseLearningRecord::getTimes).reversed()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
for (CourseLearningRecord courseLearningRecord : courseLearningRecordList) { |
|
|
|
|
|
|
|
UmsStudent umsStudent = umsStudentMapper.selectByUserId(Integer.valueOf(courseLearningRecord.getUserId())); |
|
|
|
|
|
|
|
studentNameList.add(umsStudent); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return studentNameList; |
|
|
|
} |
|
|
|
} |
|
|
|
return studentNameList; |
|
|
|
throw new BusinessException(400,"只有老师才有此功能"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|