|  | @@ -1,10 +1,25 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.education.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  | +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.education.base.PageResponse;
 | 
	
		
			
				|  |  |  import com.ym.mec.education.entity.ClassGroupStudentMapper;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.entity.StudentAttendance;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.entity.StudentRegistration;
 | 
	
		
			
				|  |  | +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.StudentListResp;
 | 
	
		
			
				|  |  |  import com.ym.mec.education.service.IClassGroupStudentMapperService;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.service.IStudentAttendanceService;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.service.IStudentRegistrationService;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * <p>
 | 
	
	
		
			
				|  | @@ -17,4 +32,36 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupStudentMapperMapper, ClassGroupStudentMapper> implements IClassGroupStudentMapperService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IStudentAttendanceService studentAttendanceService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IStudentRegistrationService studentRegistrationService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public PageResponse getPage(ClassGroupReq classGroupReq) {
 | 
	
		
			
				|  |  | +        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
 | 
	
		
			
				|  |  | +        QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +        classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroupReq.getGroupId());
 | 
	
		
			
				|  |  | +        IPage<ClassGroupStudentMapper> page = page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
 | 
	
		
			
				|  |  | +        Page<StudentListResp> studentListRespPage = new Page<>();
 | 
	
		
			
				|  |  | +        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);
 | 
	
		
			
				|  |  | +            QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +            studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, item.getClassGroupId())
 | 
	
		
			
				|  |  | +                    .eq(true, StudentRegistration::getUserId, item.getUserId());
 | 
	
		
			
				|  |  | +            StudentRegistration studentRegistration = studentRegistrationService.getOne(studentRegistrationQueryWrapper);
 | 
	
		
			
				|  |  | +            StudentListResp studentRegistrationResp = new StudentListResp()
 | 
	
		
			
				|  |  | +                    .setStudentName(studentRegistration.getName()).setStudentAttendance("连续缺到" + count + "次");
 | 
	
		
			
				|  |  | +            list.add(studentRegistrationResp);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        studentListRespPage.setRecords(list);
 | 
	
		
			
				|  |  | +        return PageResponse.success(studentListRespPage);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |