Explorar el Código

试读报到移动端班级统计

dzx hace 8 meses
padre
commit
de8a560a18

+ 27 - 4
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -8,9 +8,9 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.YesOrNoEnum;
 import com.xjrsoft.common.exception.MyException;
-import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
@@ -323,8 +323,6 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     /**
      * 班级管理中,修改信息时同步修改新生分班中的班级信息
-     * @param baseClass
-     * @return
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -450,9 +448,34 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     @Override
     public BandingTaskClassReportStatisticsVo getTryReadingReportClassStatistics(Long classId) {
+        BandingTaskClassReportStatisticsVo result = new BandingTaskClassReportStatisticsVo();
+
         StudentReportRecordPageDto dto = new StudentReportRecordPageDto();
         dto.setClassId(classId);
         List<StudentReportRecordPlanPageVo> tryReadingList = reportRecordMapper.getTryReadingList(dto);
-        return null;
+
+        result.setAllCount(tryReadingList.size());
+
+        //女生人数
+        List<StudentReportRecordPlanPageVo> femaleList = tryReadingList.stream()
+                .filter(x -> x.getGender() != null && GenderDictionaryEnum.FEMALE.getCode().equals(x.getGender()))
+                .collect(Collectors.toList());
+        result.setMaleCount(femaleList.size());
+        //男生人数
+        List<StudentReportRecordPlanPageVo> maleList = tryReadingList.stream()
+                .filter(x -> x.getGender() != null && GenderDictionaryEnum.MALE.getCode().equals(x.getGender()))
+                .collect(Collectors.toList());
+        result.setFemaleCount(maleList.size());
+        //已到人数
+        List<StudentReportRecordPlanPageVo> arrivedList = tryReadingList.stream()
+                .filter(x -> x.getIsReport() == 1)
+                .collect(Collectors.toList());
+        result.setArrivedCount(arrivedList.size());
+        //未到人数
+        List<StudentReportRecordPlanPageVo> notArrivedList = tryReadingList.stream()
+                .filter(x -> x.getIsReport() == 1)
+                .collect(Collectors.toList());
+        result.setNotArrivedCount(notArrivedList.size());
+        return result;
     }
 }

+ 4 - 6
src/main/java/com/xjrsoft/module/banding/vo/BandingTaskClassReportStatisticsVo.java

@@ -52,16 +52,14 @@ public class BandingTaskClassReportStatisticsVo {
     private String classType;
 
     @ApiModelProperty("已到人数")
-    private Long arrivedCount;
+    private Integer arrivedCount;
 
     @ApiModelProperty("未到人数")
-    private Long notArrivedCount;
-
+    private Integer notArrivedCount;
 
     @ApiModelProperty("已到男生人数")
-    private Long arrivedMaleCount;
-
+    private Integer arrivedMaleCount;
 
     @ApiModelProperty("已到女生人数")
-    private Long arrivedFemaleCount;
+    private Integer arrivedFemaleCount;
 }

+ 23 - 7
src/main/resources/mapper/student/StudentReportRecordMapper.xml

@@ -228,8 +228,8 @@
         t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
         t3.family_mobile AS parent_mobile
         FROM student_report_record t1
-        INNER JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id
         INNER JOIN base_new_student t3 ON t3.id = t1.user_id
+        LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
         LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
         LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
         LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
@@ -240,13 +240,21 @@
         LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
         LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
         WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
-        and t12.status = 1 and t2.delete_mark = 0
+        and t12.status = 1
         and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
         <if test="dto.keyword != null and dto.keyword != ''">
             and t1.name like concat('%', #{dto.keyword},'%')
         </if>
         <if test="dto.classId != null">
-            and t5.id = #{dto.classId}
+            <if test="dto.classId != 0">
+                and t5.id = #{dto.classId}
+            </if>
+            <if test="dto.classId == 0">
+                and t5.id is null
+            </if>
+        </if>
+        <if test="dto.teacherId != null">
+            and t5.teacher_id = #{dto.teacherId}
         </if>
         <if test="dto.gradeId != null">
             and t4.id = #{dto.gradeId}
@@ -285,12 +293,12 @@
     <select id="getTryReadingList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
         SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
         t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
-        t9.name AS stduy_status_cn,
+        t9.name AS stduy_status_cn,t3.gender
         t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
         t3.family_mobile AS parent_mobile
         FROM student_report_record t1
-        INNER JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id
         INNER JOIN base_new_student t3 ON t3.id = t1.user_id
+        LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
         LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
         LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
         LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
@@ -301,13 +309,21 @@
         LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
         LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
         WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
-        and t12.status = 1 and t2.delete_mark = 0
+        and t12.status = 1
         and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
         <if test="dto.keyword != null and dto.keyword != ''">
             and t1.name like concat('%', #{dto.keyword},'%')
         </if>
         <if test="dto.classId != null">
-            and t5.id = #{dto.classId}
+            <if test="dto.classId != 0">
+                and t5.id = #{dto.classId}
+            </if>
+            <if test="dto.classId == 0">
+                and t5.id is null
+            </if>
+        </if>
+        <if test="dto.teacherId != null">
+            and t5.teacher_id = #{dto.teacherId}
         </if>
         <if test="dto.gradeId != null">
             and t4.id = #{dto.gradeId}