|
|
@@ -5,25 +5,42 @@ 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.service.IBandingTaskClassService;
|
|
|
import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
|
|
|
import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
|
|
|
+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.student.dto.ChangeBandingStatusDto;
|
|
|
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.entity.EnrollmentPlan;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportPlan;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
|
+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;
|
|
|
@@ -36,9 +53,13 @@ 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.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @title: 新生维护信息
|
|
|
@@ -56,6 +77,9 @@ public class StudentTryReadingReportController {
|
|
|
private final IBandingTaskClassStudentService classStudentService;
|
|
|
private final IStudentReportPlanService reportPlanService;
|
|
|
private final IBandingTaskClassService bandingTaskClassService;
|
|
|
+ private final IBaseSemesterService semesterService;
|
|
|
+ private final IBaseGradeService gradeService;
|
|
|
+ private final IEnrollmentPlanService enrollmentPlanService;
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
@@ -199,5 +223,156 @@ public class StudentTryReadingReportController {
|
|
|
return RT.ok(list);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/statistics")
|
|
|
+ @ApiOperation(value="领导统计")
|
|
|
+ @SaCheckPermission("studentreportrecord:detail")
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentReportRecordPageDto recordPageDto = new StudentReportRecordPageDto();
|
|
|
+ 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.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.getStduyStatusCn())
|
|
|
+ && x.getReportTime() != null
|
|
|
+ ).count());
|
|
|
+ statisticsVo.setStayFemaleCount(dataList.stream().filter(
|
|
|
+ x -> GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender())
|
|
|
+ && StudyStatusEnum.InResidence.getCode().equals(x.getStduyStatusCn())
|
|
|
+ && x.getReportTime() != null
|
|
|
+ ).count());
|
|
|
+ statisticsVo.setNotStayMaleCount(dataList.stream().filter(
|
|
|
+ x -> GenderDictionaryEnum.MALE.getCode().equals(x.getGender())
|
|
|
+ && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatusCn())
|
|
|
+ && x.getReportTime() != null
|
|
|
+ ).count());
|
|
|
+ statisticsVo.setNotStayFemaleCount(dataList.stream().filter(
|
|
|
+ x -> GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender())
|
|
|
+ && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatusCn())
|
|
|
+ && x.getReportTime() != null
|
|
|
+ ).count());
|
|
|
+
|
|
|
+ if(dto.getCategory() != null && dto.getCategory() == 1){
|
|
|
+ Map<String, List<StudentReportRecordPlanPageVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != 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)
|
|
|
+ .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassName));
|
|
|
+ Map<String, List<StudentReportRecordPlanPageVo>> classNotMap = dataList.stream().filter(x -> x.getReportTime() == 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).collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getClassType));
|
|
|
+ Map<String, List<StudentReportRecordPlanPageVo>> classTypeNotMap = dataList.stream().filter(x -> x.getReportTime() == 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());
|
|
|
+ return RT.ok(statisticsVo);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|