|
@@ -34,6 +34,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -72,8 +73,11 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
@Autowired
|
|
|
private StudentDao studentDao;
|
|
|
@Autowired
|
|
|
+ private TeacherDao teacherDao;
|
|
|
+ @Autowired
|
|
|
+ private SubjectDao subjectDao;
|
|
|
+ @Autowired
|
|
|
private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SchoolStaffService schoolStaffService;
|
|
|
|
|
@@ -681,7 +685,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<StudentAttendance> findStudentAttendance(QueryInfo queryInfo) {
|
|
|
+ public PageInfo<StudentAttendance> findStudentAttendance(StudentAttendanceQueryInfo queryInfo) {
|
|
|
PageInfo<StudentAttendance> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
@@ -696,12 +700,46 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
dataList = new ArrayList<>();
|
|
|
}
|
|
|
if(dataList.size() > 0){
|
|
|
+ //获取乐团编号
|
|
|
+ Set<String> musicGroupIds = dataList.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
|
|
|
+ //只有后台列表需要乐团名称
|
|
|
+ Map<String,String> musicGroupMap = new HashMap<>();
|
|
|
+ if(StringUtils.equals(queryInfo.getGroupType(),"MUSIC")){
|
|
|
+ musicGroupMap = MapUtil.convertIntegerMap(musicGroupDao.queryMusicGroupNameMap(musicGroupIds));
|
|
|
+ }
|
|
|
+ //获取学员编号
|
|
|
+ List<Integer> userIds = dataList.stream().map(e -> e.getUserId()).distinct().collect(Collectors.toList());
|
|
|
+ Map<Integer,SimpleUserDto> studentMap = teacherDao.getUsersSimpleInfo(userIds).stream().collect(Collectors.toMap(SimpleUserDto::getUserId, Function.identity()));
|
|
|
+ Map<Integer,StudentSubjectDto> subjectMap = subjectDao.getSubjectByStudentId(new HashSet(userIds)).stream().collect(Collectors.toMap(StudentSubjectDto::getStudentId, Function.identity()));
|
|
|
+ //获取老师编号
|
|
|
+ List<Integer> teacherIds = dataList.stream().map(e -> e.getTeacherId()).distinct().collect(Collectors.toList());
|
|
|
+ Map<Integer,SimpleUserDto> teacherMap = teacherDao.getUsersSimpleInfo(teacherIds).stream().collect(Collectors.toMap(SimpleUserDto::getUserId, Function.identity()));
|
|
|
+
|
|
|
for(StudentAttendance sa : dataList){
|
|
|
+ SimpleUserDto simpleUserDto = studentMap.get(sa.getUserId());
|
|
|
+ if(simpleUserDto != null){
|
|
|
+ sa.setUsername(simpleUserDto.getNickName());
|
|
|
+ sa.setPhone(simpleUserDto.getPhone());
|
|
|
+ sa.setAvatar(simpleUserDto.getAvatar());
|
|
|
+ }
|
|
|
+ StudentSubjectDto studentSubjectDto = subjectMap.get(sa.getUserId());
|
|
|
+ if(studentSubjectDto != null){
|
|
|
+ sa.setSubjectName(studentSubjectDto.getSubjectName());
|
|
|
+ }
|
|
|
+ SimpleUserDto teacher = teacherMap.get(sa.getTeacherId());
|
|
|
+ if(teacher != null){
|
|
|
+ CourseSchedule courseSchedule = sa.getCourseSchedule();
|
|
|
+ courseSchedule.setTeacherName(teacher.getUserName());
|
|
|
+ sa.setTeacherAvatar(teacher.getAvatar());
|
|
|
+ }
|
|
|
if(sa.getGroupType() == GroupType.MUSIC){
|
|
|
- Set<Integer> userId = new HashSet<Integer>();
|
|
|
- userId.add(sa.getUserId());
|
|
|
- Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(userId,sa.getMusicGroupId()));
|
|
|
- sa.setPaymentStatus(paymentStatusMap.get(sa.getUserId()));
|
|
|
+ sa.setMusicGroupName(musicGroupMap.get(sa.getMusicGroupId()));
|
|
|
+ if(dataList.size() <= 50){
|
|
|
+ Set<Integer> userId = new HashSet<Integer>();
|
|
|
+ userId.add(sa.getUserId());
|
|
|
+ Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(userId,sa.getMusicGroupId()));
|
|
|
+ sa.setPaymentStatus(paymentStatusMap.get(sa.getUserId()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|