|
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
+import com.xjrsoft.common.enums.StudyStatusEnum;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
@@ -14,8 +15,13 @@ import com.xjrsoft.module.databoard.vo.DurationVo;
|
|
|
import com.xjrsoft.module.databoard.vo.HealthItemCountVo;
|
|
|
import com.xjrsoft.module.databoard.vo.HealthStatisticsDetailVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ItemCountVo;
|
|
|
+import com.xjrsoft.module.databoard.vo.PersonStatisticsVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ProcessStatisticsDetailVo;
|
|
|
+import com.xjrsoft.module.databoard.vo.StudnetStatisticsDetailVo;
|
|
|
import com.xjrsoft.module.databoard.vo.TeacherStatisticsDetailVo;
|
|
|
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
|
|
|
+import com.xjrsoft.module.student.service.IBaseStudentService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
|
|
|
import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
@@ -43,6 +49,7 @@ import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.Period;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
@@ -64,6 +71,8 @@ public class DatadetailController {
|
|
|
private final HistoryService historyService;
|
|
|
private final IWorkflowExtraService extraService;
|
|
|
private final ITeacherbaseManagerService teacherService;
|
|
|
+ private final IBaseStudentService studentService;
|
|
|
+
|
|
|
@GetMapping(value = "/process-statistics")
|
|
|
@ApiOperation(value="流程统计详情")
|
|
|
@SaCheckPermission("datadetail:detail")
|
|
@@ -427,4 +436,105 @@ public class DatadetailController {
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/student-statistics")
|
|
|
+ @ApiOperation(value="学生详情数据统计")
|
|
|
+ @SaCheckPermission("datadetail:detail")
|
|
|
+ public RT<StudnetStatisticsDetailVo> studentStatistics(@Valid StatisticsDetailDto dto) throws ParseException {
|
|
|
+ StudnetStatisticsDetailVo result = new StudnetStatisticsDetailVo();
|
|
|
+
|
|
|
+ String sql = "SELECT IFNULL(t3.name,'未填写') AS item ,COUNT(*) AS a_count FROM xjr_user t1" +
|
|
|
+ " INNER JOIN base_student t2 ON t1.id = t2.user_id" +
|
|
|
+ " LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code AND t3.item_id = 2023000000000000004" +
|
|
|
+ " WHERE t1.delete_mark = 0 GROUP BY t3.name";
|
|
|
+ List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
+ List<ItemCountVo> genderList = new ArrayList<>();
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ genderList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(objectMap.get("item").toString());
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ result.setGenderList(genderList);
|
|
|
+
|
|
|
+ sql = "SELECT IFNULL(t3.name,'未填写') AS item ,COUNT(*) AS a_count FROM xjr_user t1" +
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id" +
|
|
|
+ " LEFT JOIN xjr_dictionary_detail t3 ON t2.student_type = t3.code AND t3.item_id = 2023000000000000028" +
|
|
|
+ " WHERE t1.delete_mark = 0 GROUP BY t3.name";
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
+ List<ItemCountVo> studentTypeList = new ArrayList<>();
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ studentTypeList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(objectMap.get("item").toString());
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ result.setStudentTypeList(studentTypeList);
|
|
|
+
|
|
|
+
|
|
|
+ List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto());
|
|
|
+ Set<String> studentStayMaleSet = studentList.stream()
|
|
|
+ .filter(x -> (
|
|
|
+ x.getGenderCn() != null
|
|
|
+ && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
|
|
|
+ && x.getStduyStatusCn() != null
|
|
|
+ && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
|
|
|
+ ))
|
|
|
+ .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
+ result.setStudentStayMaleCount(studentStayMaleSet.size());
|
|
|
+
|
|
|
+ Set<String> studentNotStayMaleSet = studentList.stream()
|
|
|
+ .filter(x -> (
|
|
|
+ x.getGenderCn() != null
|
|
|
+ && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
|
|
|
+ && x.getStduyStatusCn() != null
|
|
|
+ && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
|
|
|
+ ))
|
|
|
+ .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
+ result.setStudentNotStayMaleCount(studentNotStayMaleSet.size());
|
|
|
+
|
|
|
+ Set<String> studentStayFemaleSet = studentList.stream()
|
|
|
+ .filter(x -> (
|
|
|
+ x.getGenderCn() != null
|
|
|
+ && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
|
|
|
+ && x.getStduyStatusCn() != null
|
|
|
+ && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
|
|
|
+ ))
|
|
|
+ .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
+ result.setStudentStayFemaleCount(studentStayFemaleSet.size());
|
|
|
+
|
|
|
+ Set<String> studentNotStayFemaleSet = studentList.stream()
|
|
|
+ .filter(x -> (
|
|
|
+ x.getGenderCn() != null
|
|
|
+ && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
|
|
|
+ && x.getStduyStatusCn() != null
|
|
|
+ && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
|
|
|
+ ))
|
|
|
+ .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
+ result.setStudentNotStayFemaleCount(studentNotStayFemaleSet.size());
|
|
|
+
|
|
|
+ sql = "SELECT name AS item,(" +
|
|
|
+ " SELECT COUNT(*) FROM xjr_user t1" +
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id" +
|
|
|
+ " WHERE t1.delete_mark = 0 AND t2.grade_id = base_grade.id" +
|
|
|
+ " ) AS a_count FROM base_grade" +
|
|
|
+ " WHERE delete_mark = 0 AND status = 1 ORDER BY name DESC LIMIT 3";
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
+ Collections.reverse(list);
|
|
|
+ List<ItemCountVo> gradeList = new ArrayList<>();
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ gradeList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(objectMap.get("item").toString());
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ result.setGradeList(gradeList);
|
|
|
+ return RT.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|