|
@@ -2,6 +2,7 @@ package com.xjrsoft.module.databoard.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
@@ -297,7 +298,7 @@ public class DatadetailController {
|
|
|
@ApiOperation(value="教职工详情数据统计")
|
|
|
@SaCheckPermission("datadetail:detail")
|
|
|
public RT<TeacherStatisticsDetailVo> teahcerStatistics(@Valid StatisticsDetailDto dto) throws ParseException {
|
|
|
- String sql = "SELECT IFNULL(t2.name,'未填写') AS item ,COUNT(*) AS count FROM base_teacher_education t1" +
|
|
|
+ String sql = "SELECT IFNULL(t2.name,'未填写') AS item ,ifnull(COUNT(*), 0) AS a_count FROM base_teacher_education t1" +
|
|
|
" LEFT JOIN xjr_dictionary_detail t2 ON t1.education = t2.code" +
|
|
|
" WHERE t1.delete_mark = 0 GROUP BY t2.name";
|
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
@@ -307,13 +308,13 @@ public class DatadetailController {
|
|
|
educationList.add(
|
|
|
new ItemCountVo(){{
|
|
|
setItem(objectMap.get("item").toString());
|
|
|
- setCount(Integer.parseInt(objectMap.get("count").toString()));
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
result.setEducationList(educationList);
|
|
|
|
|
|
- sql = "SELECT IFNULL(t3.name,'未填写') AS item ,COUNT(*) AS COUNT FROM xjr_user t1" +
|
|
|
+ sql = "SELECT IFNULL(t3.name,'未填写') AS item ,ifnull(COUNT(*), 0) AS a_count FROM xjr_user t1" +
|
|
|
" INNER JOIN base_teacher 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";
|
|
@@ -323,13 +324,13 @@ public class DatadetailController {
|
|
|
genderList.add(
|
|
|
new ItemCountVo(){{
|
|
|
setItem(objectMap.get("item").toString());
|
|
|
- setCount(Integer.parseInt(objectMap.get("count").toString()));
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
result.setGenderList(genderList);
|
|
|
|
|
|
- sql = "SELECT IFNULL(t3.name,'未填写') AS item ,COUNT(*) AS COUNT FROM xjr_user t1" +
|
|
|
+ sql = "SELECT IFNULL(t3.name,'未填写') AS item ,ifnull(COUNT(*), 0) AS a_count FROM xjr_user t1" +
|
|
|
" INNER JOIN base_teacher t2 ON t1.id = t2.user_id" +
|
|
|
" LEFT JOIN xjr_dictionary_detail t3 ON t2.employ_way = t3.code AND t3.item_id = 2023000000000000016" +
|
|
|
" WHERE t1.delete_mark = 0 GROUP BY t3.name";
|
|
@@ -339,13 +340,13 @@ public class DatadetailController {
|
|
|
genderList.add(
|
|
|
new ItemCountVo(){{
|
|
|
setItem(objectMap.get("item").toString());
|
|
|
- setCount(Integer.parseInt(objectMap.get("count").toString()));
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
result.setEmployList(employList);
|
|
|
|
|
|
- sql = "SELECT IFNULL(t4.name,'未填写') AS item ,COUNT(*) AS COUNT FROM xjr_user t1" +
|
|
|
+ sql = "SELECT IFNULL(t4.name,'未填写') AS item ,ifnull(COUNT(*), 0) AS a_count FROM xjr_user t1" +
|
|
|
" INNER JOIN base_teacher t2 ON t1.id = t2.user_id" +
|
|
|
" LEFT JOIN xjr_user_dept_relation t3 ON t1.id = t3.user_id" +
|
|
|
" LEFT JOIN xjr_department t4 ON t3.dept_id = t4.id" +
|
|
@@ -357,7 +358,7 @@ public class DatadetailController {
|
|
|
genderList.add(
|
|
|
new ItemCountVo(){{
|
|
|
setItem(objectMap.get("item").toString());
|
|
|
- setCount(Integer.parseInt(objectMap.get("count").toString()));
|
|
|
+ setCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
@@ -377,7 +378,7 @@ public class DatadetailController {
|
|
|
|
|
|
List<XjrUserPageVo> teacherList = teacherService.selectJoinList(XjrUserPageVo.class, queryWrapper);
|
|
|
List<String> idCardList = teacherList.stream().map(XjrUserPageVo::getCredentialNumber).collect(Collectors.toList());
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
int age20 = 0;
|
|
|
int age30 = 0;
|
|
@@ -385,6 +386,9 @@ public class DatadetailController {
|
|
|
int age50 = 0;
|
|
|
int age60 = 0;
|
|
|
for (String idCard : idCardList) {
|
|
|
+ if(StrUtil.isEmpty(idCard) || idCard.length() < 18){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String birthdayStr = idCard.substring(6, 14);
|
|
|
java.util.Date date = sdf.parse(birthdayStr);
|
|
|
|
|
@@ -537,4 +541,105 @@ public class DatadetailController {
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/subscription-statistics")
|
|
|
+ @ApiOperation(value="物品申购详情数据统计")
|
|
|
+ @SaCheckPermission("datadetail:detail")
|
|
|
+ public RT<StudnetStatisticsDetailVo> subscriptionStatistics(@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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|