|
@@ -6,12 +6,18 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.xjrsoft.common.enums.EnrollTypeEnum;
|
|
|
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
+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.base.entity.BaseGrade;
|
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
+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.student.dto.AddStudentReportRecordDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
|
|
@@ -19,6 +25,7 @@ import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportRecordService;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordVo;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -36,8 +43,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.validation.Valid;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @title: 学生报到记录表
|
|
@@ -54,6 +64,7 @@ public class StudentReportRecordController {
|
|
|
|
|
|
private final IStudentReportRecordService studentReportRecordService;
|
|
|
private final IBaseSemesterService semesterService;
|
|
|
+ private final IBaseGradeService gradeService;
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value="学生报到记录表列表(分页)")
|
|
@@ -163,6 +174,10 @@ public class StudentReportRecordController {
|
|
|
}
|
|
|
}
|
|
|
StudentReportRecordStatisticsVo statisticsVo = studentReportRecordService.getClassStatistics(dto);
|
|
|
+ if(statisticsVo == null){
|
|
|
+ statisticsVo = new StudentReportRecordStatisticsVo();
|
|
|
+ return RT.ok(statisticsVo);
|
|
|
+ }
|
|
|
long notArrivedCount = statisticsVo.getAllCount() - statisticsVo.getArrivedCount();
|
|
|
statisticsVo.setNotArrivedCount(notArrivedCount);
|
|
|
BigDecimal divide = BigDecimal.ZERO;
|
|
@@ -177,27 +192,43 @@ public class StudentReportRecordController {
|
|
|
@ApiOperation(value="领导统计")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
public RT<StudentReportRecordStatisticsVo> statistics(@Valid StudentReportRecordStatisticsDto dto){
|
|
|
- if(dto.getTeacherId() == null){
|
|
|
- dto.setTeacherId(StpUtil.getLoginIdAsLong());
|
|
|
- }
|
|
|
- if(dto.getBaseSemesterId() == null){
|
|
|
- LambdaQueryWrapper<BaseSemester> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(dto.getGradeId() == null){
|
|
|
+ LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper
|
|
|
- .orderByDesc(BaseSemester::getStartDate)
|
|
|
- .select(BaseSemester.class,x -> VoToColumnUtil.fieldsToColumns(BaseSemester.class).contains(x.getProperty()));
|
|
|
- List<BaseSemester> semesterList = semesterService.list(queryWrapper);
|
|
|
- if(!semesterList.isEmpty()){
|
|
|
- dto.setBaseSemesterId(semesterList.get(0).getId());
|
|
|
+ .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());
|
|
|
}
|
|
|
}
|
|
|
- StudentReportRecordStatisticsVo statisticsVo = studentReportRecordService.getClassStatistics(dto);
|
|
|
- long notArrivedCount = statisticsVo.getAllCount() - statisticsVo.getArrivedCount();
|
|
|
- statisticsVo.setNotArrivedCount(notArrivedCount);
|
|
|
- BigDecimal divide = BigDecimal.ZERO;
|
|
|
- if( statisticsVo.getAllCount() != 0){
|
|
|
- divide = BigDecimal.valueOf(statisticsVo.getArrivedCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
|
|
|
+ if(dto.getEnrollType() == null || dto.getEnrollType().isEmpty()){
|
|
|
+ dto.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
|
|
|
}
|
|
|
- statisticsVo.setReportRate(divide.doubleValue());
|
|
|
+ List<StudentReportRecordStatisticsListVo> dataList = studentReportRecordService.getStatisticsDataList(dto);
|
|
|
+ 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.getCode().equals(x.getGender())).count());
|
|
|
+ statisticsVo.setArrivedFemaleCount(dataList.stream().filter(x -> x.getReportTime() != null && GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender())).count());
|
|
|
+
|
|
|
+ statisticsVo.setStayMaleCount(dataList.stream().filter(x -> GenderDictionaryEnum.MALE.getCode().equals(x.getGender()) && StudyStatusEnum.InResidence.getCode().equals(x.getStduyStatus())).count());
|
|
|
+ statisticsVo.setStayFemaleCount(dataList.stream().filter(x -> GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender()) && StudyStatusEnum.InResidence.getCode().equals(x.getStduyStatus())).count());
|
|
|
+ statisticsVo.setNotStayMaleCount(dataList.stream().filter(x -> GenderDictionaryEnum.MALE.getCode().equals(x.getGender()) && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatus())).count());
|
|
|
+ statisticsVo.setNotStayFemaleCount(dataList.stream().filter(x -> GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender()) && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatus())).count());
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getGraduatedUniversity));
|
|
|
+ List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
|
|
|
+ for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
|
|
|
+ graduatedUniversityList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(graduatedUniversity);
|
|
|
+ setCount(graduatedUniversityMap.get(graduatedUniversity).size());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
|
|
|
return RT.ok(statisticsVo);
|
|
|
}
|
|
|
|