|
|
@ -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,20 +342,30 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public HashSet<UmsStudent> queryStudentList(CourseQuery courseQuery) { |
|
|
|
public LinkedHashSet<UmsStudent> queryStudentList(CourseQuery courseQuery) { |
|
|
|
|
|
|
|
String roleId = umsUserMapper.getbyIdRoleId(courseQuery.getUserId()); |
|
|
|
|
|
|
|
if (roleId.equals("1")){ |
|
|
|
PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery); |
|
|
|
PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery); |
|
|
|
List<CoursesVO> coursesList = queryCourses.getList(); |
|
|
|
List<CoursesVO> coursesList = queryCourses.getList(); |
|
|
|
List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList()); |
|
|
|
List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList()); |
|
|
|
HashSet<UmsStudent> studentNameList = new HashSet<>(); |
|
|
|
LinkedHashSet<UmsStudent> studentNameList = new LinkedHashSet<>(); |
|
|
|
for (String courseId : courseIds) { |
|
|
|
for (String courseId : courseIds) { |
|
|
|
List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId); |
|
|
|
List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId); |
|
|
|
|
|
|
|
List<CourseLearningRecord> courseLearningRecordList = new ArrayList<>(); |
|
|
|
for (StudentCourses studentUsername : studentUsernames) { |
|
|
|
for (StudentCourses studentUsername : studentUsernames) { |
|
|
|
UmsStudent umsStudent = umsStudentMapper.selectByUserId(Integer.valueOf(studentUsername.getStudent())); |
|
|
|
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); |
|
|
|
studentNameList.add(umsStudent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return studentNameList; |
|
|
|
return studentNameList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
throw new BusinessException(400,"只有老师才有此功能"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<CoursesVO> getPagePageSize(int page, int pageSize) { |
|
|
|
public List<CoursesVO> getPagePageSize(int page, int pageSize) { |
|
|
|