|
@@ -49,6 +49,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
private TeacherDao teacherDao;
|
|
|
@Autowired
|
|
|
private StudentDao studentDao;
|
|
|
+ @Autowired
|
|
|
+ private SubjectDao subjectDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
|
|
@@ -296,11 +298,38 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseId(queryInfo.getCourseScheduleId().longValue());
|
|
|
List<SimpleUserDto> usersSimpleInfo = teacherDao.getUsersSimpleInfo(new ArrayList<>(studentIds));
|
|
|
List<Student> students = studentDao.findByStudentIds(new ArrayList<>(studentIds));
|
|
|
+ Set<Integer> subjectIds = new HashSet<>();
|
|
|
for (Student student : students) {
|
|
|
if(StringUtils.isBlank(student.getSubjectIdList())){
|
|
|
continue;
|
|
|
}
|
|
|
- List<Integer> collect = Arrays.stream(student.getSubjectIdList().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
|
|
|
+ Set<Integer> studentSubjectIds = Arrays.stream(student.getSubjectIdList().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toSet());
|
|
|
+ subjectIds.addAll(studentSubjectIds);
|
|
|
+ }
|
|
|
+ List<Subject> subjects = new ArrayList<>();
|
|
|
+ if(!CollectionUtils.isEmpty(subjectIds)){
|
|
|
+ subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
|
|
|
+ }
|
|
|
+ Map<Integer, StudentAttendance> studentAttendanceMap = studentAttendances.stream().collect(Collectors.toMap(StudentAttendance::getUserId, s -> s, (s1, s2) -> s1));
|
|
|
+ Map<Integer, SimpleUserDto> studentInfoMap = usersSimpleInfo.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s -> s, (s1, s2) -> s1));
|
|
|
+ Map<Integer, Student> studentMap = students.stream().collect(Collectors.toMap(Student::getUserId, s -> s, (s1, s2) -> s1));
|
|
|
+ for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
|
|
|
+ CourseScheduleStudentListDto cssld=new CourseScheduleStudentListDto();
|
|
|
+ cssld.setStudentId(courseScheduleStudentPayment.getUserId());
|
|
|
+ cssld.setPhone(studentInfoMap.containsKey(cssld.getStudentId())?studentInfoMap.get(cssld.getStudentId()).getPhone():"");
|
|
|
+ cssld.setSubjectIds(studentMap.containsKey(cssld.getStudentId())?studentMap.get(cssld.getStudentId()).getSubjectIdList():"");
|
|
|
+ if(StringUtils.isNotBlank(cssld.getSubjectIds())){
|
|
|
+ Set<Integer> studentSubjectIds = Arrays.stream(cssld.getSubjectIds().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toSet());
|
|
|
+ List<String> subjectNames = subjects.stream().filter(s -> studentSubjectIds.contains(s.getId())).map(Subject::getName).collect(Collectors.toList());
|
|
|
+ cssld.setSubjectNames(StringUtils.join(subjectNames, ","));
|
|
|
+ }
|
|
|
+ if(studentAttendanceMap.containsKey(cssld.getStudentId())){
|
|
|
+ StudentAttendance studentAttendance = studentAttendanceMap.get(cssld.getStudentId());
|
|
|
+ cssld.setSignInTime(studentAttendance.getSignInTime());
|
|
|
+ cssld.setSignOutTime(studentAttendance.getSignOutTime());
|
|
|
+ cssld.setStatus(studentAttendance.getStatus());
|
|
|
+ }
|
|
|
+ dataList.add(cssld);
|
|
|
}
|
|
|
}
|
|
|
pageInfo.setRows(dataList);
|