|
@@ -20,6 +20,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -102,27 +103,31 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
|
|
|
if (Objects.isNull(classGroupReq.getGroupId())) {
|
|
|
return PageResponse.errorParam();
|
|
|
}
|
|
|
+ CourseSchedule courseSchedule = courseScheduleService.getLastCourseSchedule(classGroupReq.getGroupId());
|
|
|
Page<StudentAttendanceResp> pageResult = new Page<>();
|
|
|
- Page<StudentAttendance> studentAttendancePage = new Page<StudentAttendance>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
|
|
|
- QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(true, StudentAttendance::getClassGroupId, classGroupReq.getGroupId());
|
|
|
- IPage<StudentAttendance> page = page(studentAttendancePage, queryWrapper);
|
|
|
- if (!CollectionUtils.isEmpty(page.getRecords())) {
|
|
|
- List<StudentAttendanceResp> list = Lists.newArrayList();
|
|
|
- page.getRecords().forEach(item -> {
|
|
|
- StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
|
|
|
- if (Objects.nonNull(item.getUserId())) {
|
|
|
- SysUser user = userService.getById(item.getUserId());
|
|
|
- if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
|
|
|
- studentAttendanceResp.setStudentName(user.getRealName());
|
|
|
+ if (Objects.nonNull(courseSchedule)) {
|
|
|
+ Page<StudentAttendance> studentAttendancePage = new Page<StudentAttendance>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
|
|
|
+ QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(true, StudentAttendance::getClassGroupId, classGroupReq.getGroupId())
|
|
|
+ .eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId());
|
|
|
+ IPage<StudentAttendance> page = page(studentAttendancePage, queryWrapper);
|
|
|
+ if (!CollectionUtils.isEmpty(page.getRecords())) {
|
|
|
+ List<StudentAttendanceResp> list = Lists.newArrayList();
|
|
|
+ page.getRecords().forEach(item -> {
|
|
|
+ StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
|
|
|
+ if (Objects.nonNull(item.getUserId())) {
|
|
|
+ SysUser user = userService.getById(item.getUserId());
|
|
|
+ if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
|
|
|
+ studentAttendanceResp.setStudentName(user.getRealName());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(item.getStatus())) {
|
|
|
- studentAttendanceResp.setStatus(StudentAttendanceStatusEnum.getMsgByCode(item.getStatus()));
|
|
|
- }
|
|
|
- list.add(studentAttendanceResp);
|
|
|
- });
|
|
|
- pageResult.setRecords(list);
|
|
|
+ if (StringUtils.isNotBlank(item.getStatus())) {
|
|
|
+ studentAttendanceResp.setStatus(StudentAttendanceStatusEnum.getMsgByCode(item.getStatus()));
|
|
|
+ }
|
|
|
+ list.add(studentAttendanceResp);
|
|
|
+ });
|
|
|
+ pageResult.setRecords(list);
|
|
|
+ }
|
|
|
}
|
|
|
return PageResponse.success(pageResult);
|
|
|
}
|