|
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
|
import com.ym.mec.education.base.PageResponse;
|
|
|
import com.ym.mec.education.entity.*;
|
|
|
import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
|
|
@@ -21,8 +20,10 @@ 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;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -91,7 +92,7 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
|
|
|
}
|
|
|
ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
|
|
|
if (Objects.nonNull(classGroup)) {
|
|
|
- studentAttendanceResp.setSubjectName(subjectService.getSubjectNameList(classGroup.getSubjectIdList()));
|
|
|
+ studentAttendanceResp.setSubjectName(subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList()));
|
|
|
list.add(studentAttendanceResp);
|
|
|
}
|
|
|
});
|
|
@@ -138,26 +139,27 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
|
|
|
if (Objects.isNull(classGroupReq.getGroupId())) {
|
|
|
PageResponse.errorParam();
|
|
|
}
|
|
|
- Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<ClassGroupStudentMapper>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
|
|
|
Page<StudentAttendanceStatisticsResp> pageResult = new Page();
|
|
|
ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
|
|
|
if (Objects.nonNull(classGroup)) {
|
|
|
- List<String> subjectNameList = subjectService.getSubjectNameList(classGroup.getSubjectIdList());
|
|
|
- QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
|
|
|
- classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroup.getId())
|
|
|
- .in(true, ClassGroupStudentMapper::getStatus,
|
|
|
- ClassGroupStudentStatusEnum.NORMAL.getCode(), ClassGroupStudentStatusEnum.LEAVE.getCode());
|
|
|
- IPage<ClassGroupStudentMapper> studentMapperPage = classGroupStudentMapperService.page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
|
|
|
+ List<String> subjectNameList = Lists.newArrayList();
|
|
|
+ if (Objects.nonNull(classGroupReq.getSubjectId())) {
|
|
|
+ subjectNameList = Lists.newArrayList(subjectService.getById(classGroupReq.getSubjectId()).getName());
|
|
|
+ } else {
|
|
|
+ subjectNameList = subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ Page<ClassGroupStudentMapper> studentMapperPage = classGroupStudentMapperService.selectPageByCondition(classGroupReq);
|
|
|
if (!CollectionUtils.isEmpty(studentMapperPage.getRecords())) {
|
|
|
List<StudentAttendanceStatisticsResp> studentAttendanceStatisticsRespList = Lists.newArrayList();
|
|
|
BeanUtils.copyProperties(studentMapperPage, pageResult);
|
|
|
+ List<String> finalSubjectNameList = subjectNameList;
|
|
|
studentMapperPage.getRecords().forEach(item -> {
|
|
|
StudentAttendanceStatisticsResp resp = new StudentAttendanceStatisticsResp();
|
|
|
SysUser user = userService.getById(item.getUserId());
|
|
|
if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
|
|
|
resp.setStudentName(user.getRealName());
|
|
|
}
|
|
|
- resp.setSubjectName(subjectNameList);
|
|
|
+ resp.setSubjectName(finalSubjectNameList);
|
|
|
//是否连续旷课
|
|
|
QueryWrapper<MusicGroupStudentFee> musicGroupStudentFeeQueryWrapper = new QueryWrapper<MusicGroupStudentFee>();
|
|
|
musicGroupStudentFeeQueryWrapper.lambda().eq(true, MusicGroupStudentFee::getMusicGroupId, classGroup.getMusicGroupId())
|