|
@@ -6,22 +6,24 @@ 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.education.base.PageResponse;
|
|
|
+import com.ym.mec.education.entity.ClassGroup;
|
|
|
import com.ym.mec.education.entity.ClassGroupStudentMapper;
|
|
|
-import com.ym.mec.education.entity.StudentAttendance;
|
|
|
+import com.ym.mec.education.entity.MusicGroupStudentFee;
|
|
|
import com.ym.mec.education.entity.SysUser;
|
|
|
-import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
|
|
|
import com.ym.mec.education.mapper.ClassGroupStudentMapperMapper;
|
|
|
import com.ym.mec.education.req.ClassGroupReq;
|
|
|
import com.ym.mec.education.resp.ClassStudentResp;
|
|
|
import com.ym.mec.education.resp.StudentListResp;
|
|
|
+import com.ym.mec.education.service.IClassGroupService;
|
|
|
import com.ym.mec.education.service.IClassGroupStudentMapperService;
|
|
|
-import com.ym.mec.education.service.IStudentAttendanceService;
|
|
|
+import com.ym.mec.education.service.IMusicGroupStudentFeeService;
|
|
|
import com.ym.mec.education.service.ISysUserService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -35,9 +37,11 @@ import java.util.Objects;
|
|
|
public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupStudentMapperMapper, ClassGroupStudentMapper> implements IClassGroupStudentMapperService {
|
|
|
|
|
|
@Autowired
|
|
|
- private IStudentAttendanceService studentAttendanceService;
|
|
|
- @Autowired
|
|
|
private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private IClassGroupService classGroupService;
|
|
|
+ @Autowired
|
|
|
+ private IMusicGroupStudentFeeService musicGroupStudentFeeService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -45,6 +49,7 @@ public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupSt
|
|
|
if (Objects.isNull(classGroupReq.getGroupId())) {
|
|
|
return PageResponse.errorParam();
|
|
|
}
|
|
|
+ ClassGroup classGroup = classGroupService.getById(classGroupReq.getGroupId());
|
|
|
Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<ClassGroupStudentMapper>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
|
|
|
QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
|
|
|
classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroupReq.getGroupId());
|
|
@@ -53,15 +58,17 @@ public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupSt
|
|
|
BeanUtils.copyProperties(page, studentListRespPage);
|
|
|
List<StudentListResp> list = Lists.newArrayList();
|
|
|
page.getRecords().forEach(item -> {
|
|
|
- QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
|
|
|
- //请假 旷课正常上课次数
|
|
|
- queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
|
|
|
- .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
|
|
|
- StudentAttendanceStatusEnum.LEAVE.getCode());
|
|
|
- int count = studentAttendanceService.count(queryWrapper);
|
|
|
SysUser sysUser = sysUserService.getById(item.getUserId());
|
|
|
StudentListResp studentRegistrationResp = new StudentListResp()
|
|
|
- .setStudentName(sysUser.getRealName()).setStudentAttendance("连续缺到" + count + "次");
|
|
|
+ .setStudentName(sysUser.getRealName());
|
|
|
+ if (Objects.nonNull(classGroup) && Objects.nonNull(classGroup.getMusicGroupId())) {
|
|
|
+ QueryWrapper<MusicGroupStudentFee> musicGroupStudentFeeQueryWrapper = new QueryWrapper<MusicGroupStudentFee>();
|
|
|
+ musicGroupStudentFeeQueryWrapper.lambda().eq(true, MusicGroupStudentFee::getMusicGroupId, classGroup.getMusicGroupId())
|
|
|
+ .eq(true, MusicGroupStudentFee::getUserId, item.getUserId());
|
|
|
+ MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeService.getOne(musicGroupStudentFeeQueryWrapper);
|
|
|
+ Optional.of(musicGroupStudentFee).ifPresent(groupStudentFee -> studentRegistrationResp.
|
|
|
+ setStudentAttendance("连续缺到" + groupStudentFee.getContinuousAbsenteeismTimes() + "次"));
|
|
|
+ }
|
|
|
list.add(studentRegistrationResp);
|
|
|
});
|
|
|
studentListRespPage.setRecords(list);
|