| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
- package com.xjrsoft.module.student.controller;
- import cn.dev33.satoken.annotation.SaCheckPermission;
- import cn.dev33.satoken.stp.StpUtil;
- import cn.hutool.core.bean.BeanUtil;
- import com.alibaba.excel.EasyExcel;
- import com.alibaba.excel.support.ExcelTypeEnum;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.xjrsoft.common.annotation.XjrLog;
- import com.xjrsoft.common.enums.DeleteMark;
- import com.xjrsoft.common.enums.EnabledMark;
- import com.xjrsoft.common.enums.EnrollTypeEnum;
- import com.xjrsoft.common.enums.GenderDictionaryEnum;
- import com.xjrsoft.common.enums.RoleCodeEnum;
- import com.xjrsoft.common.enums.StudyStatusEnum;
- import com.xjrsoft.common.model.result.RT;
- import com.xjrsoft.common.page.ConventPage;
- import com.xjrsoft.common.page.PageOutput;
- import com.xjrsoft.common.utils.VoToColumnUtil;
- import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
- import com.xjrsoft.module.banding.entity.BandingTask;
- import com.xjrsoft.module.banding.service.IBandingTaskClassService;
- import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
- import com.xjrsoft.module.banding.service.IBandingTaskService;
- import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
- import com.xjrsoft.module.banding.vo.BandingTaskClassReportStatisticsVo;
- import com.xjrsoft.module.base.entity.BaseGrade;
- import com.xjrsoft.module.base.service.IBaseGradeService;
- import com.xjrsoft.module.base.service.IBaseSemesterService;
- import com.xjrsoft.module.databoard.vo.ItemCountVo;
- import com.xjrsoft.module.organization.dto.GetUserByParamDto;
- import com.xjrsoft.module.organization.entity.User;
- import com.xjrsoft.module.organization.service.IUserService;
- import com.xjrsoft.module.student.dto.ChangeBandingStatusDto;
- import com.xjrsoft.module.student.dto.StudentReportChangeClassBatchDto;
- import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
- import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
- import com.xjrsoft.module.student.dto.StudentReportSignDto;
- import com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto;
- import com.xjrsoft.module.student.entity.BaseNewStudent;
- import com.xjrsoft.module.student.entity.EnrollmentPlan;
- import com.xjrsoft.module.student.entity.StudentReportPlan;
- import com.xjrsoft.module.student.entity.StudentReportRecord;
- import com.xjrsoft.module.student.service.IBaseNewStudentService;
- import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
- import com.xjrsoft.module.student.service.IEnrollmentPlanService;
- import com.xjrsoft.module.student.service.IStudentReportPlanService;
- import com.xjrsoft.module.student.service.IStudentReportRecordService;
- import com.xjrsoft.module.student.vo.StudentReportRecordExcelVo;
- import com.xjrsoft.module.student.vo.StudentReportRecordItemVo;
- import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
- import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.AllArgsConstructor;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import javax.validation.Valid;
- import java.io.ByteArrayOutputStream;
- import java.math.BigDecimal;
- import java.math.RoundingMode;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Comparator;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
- /**
- * @title: 新生维护信息
- * @Author dzx
- * @Date: 2024-06-27
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/student" + "/tryReadingReport")
- @Api(value = "/student" + "/tryReadingReport",tags = "试读报到模块代码")
- @AllArgsConstructor
- public class StudentTryReadingReportController {
- private final IStudentReportRecordService recordService;
- private final IBandingTaskClassStudentService classStudentService;
- private final IStudentReportPlanService reportPlanService;
- private final IBandingTaskClassService bandingTaskClassService;
- private final IBaseSemesterService semesterService;
- private final IBaseGradeService gradeService;
- private final IEnrollmentPlanService enrollmentPlanService;
- private final IBandingTaskService bandingTaskService;
- private final IUserService userService;
- private final IBaseStudentSchoolRollService rollService;
- private final IBaseNewStudentService newStudentService;
- @GetMapping(value = "/page")
- @ApiOperation(value="试读报到(分页)")
- @SaCheckPermission("tryreadingreport:detail")
- @XjrLog(value="试读报到(分页)")
- public RT<PageOutput<StudentReportRecordPlanPageVo>> page(@Valid StudentTryReadingReportPageDto dto){
- List<String> roleList = StpUtil.getRoleList();
- if(roleList.contains("CLASSTE") && roleList.contains("TEACHER")){
- dto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- if(dto.getIsMoible() != null && dto.getIsMoible() == 1){
- StudentReportPlan plan = reportPlanService.getLastTryReadingPlan();
- BandingTask bandingTask = bandingTaskService.getById(plan.getBandingTaskId());
- List<EnrollmentPlan> enrollmentPlans = enrollmentPlanService.list(
- new QueryWrapper<EnrollmentPlan>().lambda()
- .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
- .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
- .eq(EnrollmentPlan::getEnrollType, bandingTask.getEnrollType())
- .eq(EnrollmentPlan::getGradeId, bandingTask.getGradeId())
- .orderByDesc(EnrollmentPlan::getId)
- );
- if(!enrollmentPlans.isEmpty()){
- dto.setEnrollmentPlanId(enrollmentPlans.get(0).getId());
- }
- }
- Page<StudentReportRecordPlanPageVo> page = recordService.getTryReadingPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- PageOutput<StudentReportRecordPlanPageVo> pageOutput = ConventPage.getPageOutput(page, StudentReportRecordPlanPageVo.class);
- return RT.ok(pageOutput);
- }
- @PostMapping("/clear-class")
- @ApiOperation(value = "非本班学生")
- @SaCheckPermission("tryreadingreport:add")
- @XjrLog(value="非本班学生")
- public RT<Boolean> clearClass(@Valid @RequestBody ChangeBandingStatusDto dto){
- StudentReportRecord record = recordService.getById(dto.getId());
- StudentReportPlan reportPlan = reportPlanService.getById(record.getStudentReportPlanId());
- List<Long> list = new ArrayList<>();
- list.add(record.getUserId());
- classStudentService.removeStudent(list, reportPlan.getBandingTaskId());
- BaseNewStudent newStudent = newStudentService.getById(record.getUserId());
- if(newStudent != null){
- User user = userService.getUserByParam(new GetUserByParamDto() {{
- setCredentialNumber(newStudent.getCredentialNumber());
- }});
- if(user != null){
- rollService.disableStudent(user.getId());
- }
- }
- return RT.ok(true);
- }
- @PostMapping(value = "/sign")
- @ApiOperation(value="试读报到")
- @SaCheckPermission("tryreadingreport:detail")
- @XjrLog(value="试读报到")
- public RT<Boolean> sign(@Valid @RequestBody StudentReportSignDto dto){
- return RT.ok(recordService.tryReadingSign(dto));
- }
- @PostMapping(value = "/all-sign")
- @ApiOperation(value="变更为已报到")
- @SaCheckPermission("tryreadingreport:detail")
- @XjrLog(value="试读报到")
- public RT<Boolean> sign(@Valid @RequestBody List<Long> ids){
- for (Long id : ids) {
- recordService.tryReadingSign(new StudentReportSignDto(){{
- setId(id);
- }});
- }
- return RT.ok(true);
- }
- @PostMapping("/change-class")
- @ApiOperation(value = "调整班级")
- @SaCheckPermission("tryreadingreport:change-class")
- @XjrLog(value = "调整班级")
- public RT<Boolean> changeClass(@Valid @RequestBody StudentReportSignDto dto){
- boolean isSuccess = recordService.changeClass(dto);
- return RT.ok(isSuccess);
- }
- @PostMapping("/change-class-batch")
- @ApiOperation(value = "批量调整班级")
- @SaCheckPermission("tryreadingreport:change-class")
- @XjrLog(value = "批量调整班级")
- public RT<Boolean> changeClassBatch(@Valid @RequestBody StudentReportChangeClassBatchDto dto){
- boolean isSuccess = recordService.changeClassBatch(dto);
- return RT.ok(isSuccess);
- }
- @PostMapping(value = "/update-stduyStatus")
- @ApiOperation(value="切换就读方式")
- @SaCheckPermission("tryreadingreport:update-stduyStatus")
- @XjrLog(value = "切换就读方式")
- public RT<Boolean> updateStduyStatus(@Valid @RequestBody StudentReportSignDto dto){
- boolean isSuccess = recordService.updateStduyStatusByTryReading(dto);
- return RT.ok(isSuccess);
- }
- @PostMapping(value = "/export-query")
- @ApiOperation(value="导出")
- @SaCheckPermission("studentreportrecord:detail")
- @XjrLog(value = "导出")
- public ResponseEntity<byte[]> exportQuerty(@Valid @RequestBody StudentTryReadingReportPageDto dto){
- List<StudentReportRecordExcelVo> dataList = new ArrayList<>();
- List<String> roleList = StpUtil.getRoleList();
- if(roleList.contains(RoleCodeEnum.TEACHER.getCode()) && roleList.contains(RoleCodeEnum.CLASSTE.getCode())){
- if(dto.getClassId() == null){
- dto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- }
- List<StudentReportRecordPlanPageVo> planPageList = recordService.getTryReadingList(dto);
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- for (StudentReportRecordPlanPageVo pageVo : planPageList) {
- StudentReportRecordExcelVo excelVo = BeanUtil.toBean(pageVo, StudentReportRecordExcelVo.class);
- if(pageVo.getReportTime() != null){
- excelVo.setReportTime(sdf.format(pageVo.getReportTime()));
- }
- excelVo.setIsReport("否");
- if(pageVo.getIsReport() != null && pageVo.getIsReport() == 1){
- excelVo.setIsReport("是");
- }
- dataList.add(excelVo);
- }
- ByteArrayOutputStream bot = new ByteArrayOutputStream();
- EasyExcel.write(bot, StudentReportRecordExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
- String fileName = "exportQuerty" + ExcelTypeEnum.XLSX.getValue();
- return RT.fileStream(bot.toByteArray(), fileName);
- }
- @GetMapping(value = "/class-list")
- @ApiOperation(value="查询班级信息")
- @SaCheckPermission("studentreportrecord:detail")
- @XjrLog(value = "查询班级信息")
- public RT<List<BandingTaskClassPageVo>> classList(@Valid StudentReportRecordPageDto dto){
- BandingTaskClassPageDto classDto = new BandingTaskClassPageDto();
- if(dto.getEnrollmentPlanId() == null){
- if(dto.getTeacherId() != null){
- classDto.setTeacherId(dto.getTeacherId());
- }else{
- classDto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- StudentReportPlan plan = reportPlanService.getLastTryReadingPlan();
- if(plan == null){
- return RT.ok(new ArrayList<>());
- }
- classDto.setBandingTaskId(plan.getBandingTaskId());
- }else{
- EnrollmentPlan enrollmentPlan = enrollmentPlanService.getById(dto.getEnrollmentPlanId());
- if(enrollmentPlan != null){
- List<BandingTask> list = bandingTaskService.list(
- new QueryWrapper<BandingTask>().lambda()
- .eq(BandingTask::getEnrollType, enrollmentPlan.getEnrollType())
- .eq(BandingTask::getGradeId, enrollmentPlan.getGradeId())
- .eq(BandingTask::getDeleteMark, DeleteMark.NODELETE.getCode())
- .eq(BandingTask::getEnabledMark, EnabledMark.ENABLED.getCode())
- .orderByDesc(BandingTask::getId)
- );
- if(!list.isEmpty()){
- classDto.setBandingTaskId(list.get(0).getId());
- }
- }
- List<String> roleList = StpUtil.getRoleList();
- if(roleList.contains("CLASSTE") && roleList.contains("TEACHER")){
- classDto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- }
- List<BandingTaskClassPageVo> list = bandingTaskClassService.getList(classDto);
- return RT.ok(list);
- }
- @GetMapping(value = "/class-statistics")
- @ApiOperation(value="班级数据统计")
- @SaCheckPermission("studentreportrecord:detail")
- @XjrLog(value = "班级数据统计")
- public RT<BandingTaskClassReportStatisticsVo> classStatistics(@RequestParam Long classId){
- return RT.ok(bandingTaskClassService.getTryReadingReportClassStatistics(classId));
- }
- @GetMapping(value = "/statistics")
- @ApiOperation(value="领导统计")
- @SaCheckPermission("studentreportrecord:detail")
- @XjrLog(value = "领导统计")
- public RT<StudentReportRecordStatisticsVo> statistics(@Valid StudentReportRecordStatisticsDto dto){
- if(dto.getGradeId() == null && (dto.getCategory() == null || dto.getCategory() == 1)){
- LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper
- .orderByDesc(BaseGrade::getTitle)
- .select(BaseGrade.class,x -> VoToColumnUtil.fieldsToColumns(BaseGrade.class).contains(x.getProperty()));
- List<BaseGrade> gradeList = gradeService.list(queryWrapper);
- if(!gradeList.isEmpty()){
- dto.setGradeId(gradeList.get(0).getId());
- }
- }
- if(dto.getEnrollType() == null || dto.getEnrollType().isEmpty()){
- dto.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
- }
- if(dto.getCategory() != null && dto.getCategory() == 2 && dto.getBaseSemesterId() == null){
- dto.setBaseSemesterId(semesterService.getLastSemester());
- }
- List<EnrollmentPlan> enrollmentPlanList = enrollmentPlanService.list(
- new QueryWrapper<EnrollmentPlan>().lambda()
- .eq(EnrollmentPlan::getEnrollType, dto.getEnrollType())
- .eq(EnrollmentPlan::getGradeId, dto.getGradeId())
- .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
- .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
- .orderByDesc(EnrollmentPlan::getId)
- );
- if(enrollmentPlanList.isEmpty()){
- return RT.ok(new StudentReportRecordStatisticsVo());
- }
- StudentTryReadingReportPageDto recordPageDto = new StudentTryReadingReportPageDto();
- recordPageDto.setEnrollmentPlanId(enrollmentPlanList.get(0).getId());
- List<StudentReportRecordPlanPageVo> dataList = recordService.getTryReadingList(recordPageDto);
- StudentReportRecordStatisticsVo statisticsVo = new StudentReportRecordStatisticsVo();
- statisticsVo.setAllCount(dataList.stream().count());
- statisticsVo.setArrivedCount(dataList.stream().filter(x -> x.getReportTime() != null).count());
- statisticsVo.setNotArrivedCount(dataList.stream().filter(x -> x.getReportTime() == null).count());
- statisticsVo.setArrivedMaleCount(dataList.stream().filter(x -> x.getReportTime() != null && GenderDictionaryEnum.MALE.getValue().equals(x.getGender())).count());
- statisticsVo.setArrivedFemaleCount(dataList.stream().filter(x -> x.getReportTime() != null && GenderDictionaryEnum.FEMALE.getValue().equals(x.getGender())).count());
- statisticsVo.setStayMaleCount(dataList.stream().filter(
- x -> GenderDictionaryEnum.MALE.getValue().equals(x.getGender())
- && StudyStatusEnum.InResidence.getCode().equals(x.getStduyStatusCn())
- && x.getReportTime() != null
- ).count());
- statisticsVo.setStayFemaleCount(dataList.stream().filter(
- x -> GenderDictionaryEnum.FEMALE.getValue().equals(x.getGender())
- && StudyStatusEnum.InResidence.getCode().equals(x.getStduyStatusCn())
- && x.getReportTime() != null
- ).count());
- statisticsVo.setNotStayMaleCount(dataList.stream().filter(
- x -> GenderDictionaryEnum.MALE.getValue().equals(x.getGender())
- && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatusCn())
- && x.getReportTime() != null
- ).count());
- statisticsVo.setNotStayFemaleCount(dataList.stream().filter(
- x -> GenderDictionaryEnum.FEMALE.getValue().equals(x.getGender())
- && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatusCn())
- && x.getReportTime() != null
- ).count());
- if(dto.getCategory() != null && dto.getCategory() == 3){
- Map<String, List<StudentReportRecordPlanPageVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getGraduateSchool() != null)
- .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getGraduateSchool));
- List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
- for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
- graduatedUniversityList.add(
- new ItemCountVo(){{
- setItem(graduatedUniversity);
- setCount(graduatedUniversityMap.get(graduatedUniversity).size());
- }}
- );
- }
- statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
- }
- Map<String, List<StudentReportRecordPlanPageVo>> classMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getClassName() != null)
- .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassName));
- Map<String, List<StudentReportRecordPlanPageVo>> classNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getClassName() != null)
- .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassName));
- List<StudentReportRecordItemVo> classList = new ArrayList<>();
- for (String className : classMap.keySet()) {
- classList.add(
- new StudentReportRecordItemVo(){{
- setItem(className);
- setCount(classMap.get(className).size());
- if(classNotMap.get(className) != null && !(classNotMap.get(className).isEmpty())){
- setCount2(classNotMap.get(className).size());
- }
- }}
- );
- }
- statisticsVo.setClassList(classList);
- Map<String, List<StudentReportRecordPlanPageVo>> classTypeMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getClassType() != null)
- .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassType));
- Map<String, List<StudentReportRecordPlanPageVo>> classTypeNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getClassType() != null)
- .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassType));
- List<StudentReportRecordItemVo> classTypeList = new ArrayList<>();
- for (String classType : classTypeMap.keySet()) {
- classTypeList.add(
- new StudentReportRecordItemVo(){{
- setItem(classType);
- setCount(classTypeMap.get(classType).size());
- if(classTypeNotMap.get(classType) != null && !(classTypeNotMap.get(classType).isEmpty())){
- setCount2(classTypeNotMap.get(classType).size());
- }
- }}
- );
- }
- statisticsVo.setClassTypeList(classTypeList);
- Map<String, List<StudentReportRecordPlanPageVo>> majorMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getMajorName));
- Map<String, List<StudentReportRecordPlanPageVo>> majorNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getMajorName));
- List<StudentReportRecordItemVo> majorList = new ArrayList<>();
- for (String majorName : majorMap.keySet()) {
- majorList.add(
- new StudentReportRecordItemVo(){{
- setItem(majorName);
- setCount(majorMap.get(majorName).size());
- if(majorNotMap.get(majorName) != null && !(majorNotMap.get(majorName).isEmpty())){
- setCount2(majorNotMap.get(majorName).size());
- }
- }}
- );
- }
- statisticsVo.setMajorList(majorList);
- Map<String, List<StudentReportRecordPlanPageVo>> deptMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getDeptName() != null).collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getDeptName));
- List<ItemCountVo> deptList = new ArrayList<>();
- for (String deptName : deptMap.keySet()) {
- deptList.add(
- new ItemCountVo(){{
- setItem(deptName);
- setCount(deptMap.get(deptName).size());
- }}
- );
- }
- statisticsVo.setDeptList(deptList);
- BigDecimal divide = BigDecimal.ZERO;
- if( statisticsVo.getAllCount() != 0){
- divide = BigDecimal.valueOf(statisticsVo.getArrivedCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
- }
- statisticsVo.setReportRate(divide.doubleValue());
- //查询年级趋势
- List<BaseGrade> gradeList = gradeService.list(
- new QueryWrapper<BaseGrade>().lambda()
- .eq(BaseGrade::getDeleteMark, DeleteMark.NODELETE.getCode())
- .eq(BaseGrade::getEnabledMark, EnabledMark.ENABLED.getCode())
- .eq(BaseGrade::getStatus, 1)
- .orderByDesc(BaseGrade::getTitle)
- );
- List<ItemCountVo> gradeDataList = new ArrayList<>();
- for (int i = 0; i < 3; i ++){
- BaseGrade baseGrade = gradeList.get(i);
- List<EnrollmentPlan> enrollmentPlans = enrollmentPlanService.list(
- new QueryWrapper<EnrollmentPlan>().lambda()
- .eq(EnrollmentPlan::getGradeId, baseGrade.getId())
- .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
- .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
- .orderByDesc(EnrollmentPlan::getId)
- );
- int gradeCount = 0;
- for (EnrollmentPlan enrollmentPlan : enrollmentPlans) {
- StudentTryReadingReportPageDto gradeRecordPageDto = new StudentTryReadingReportPageDto();
- gradeRecordPageDto.setEnrollmentPlanId(enrollmentPlan.getId());
- gradeRecordPageDto.setIsReport(1);
- gradeCount += recordService.getTryReadingList(gradeRecordPageDto).size();
- }
- ItemCountVo itemCountVo = new ItemCountVo();
- itemCountVo.setItem(baseGrade.getName());
- itemCountVo.setCount(gradeCount);
- gradeDataList.add(itemCountVo);
- }
- Collections.sort(gradeDataList, Comparator.comparing(ItemCountVo::getItem));
- statisticsVo.setGradeList(gradeDataList);
- return RT.ok(statisticsVo);
- }
- }
|