Browse Source

开学报到领导统计调整

dzx 10 tháng trước cách đây
mục cha
commit
cc681c5011

+ 3 - 0
src/main/java/com/xjrsoft/module/base/service/IBaseSemesterService.java

@@ -14,4 +14,7 @@ import com.xjrsoft.module.base.entity.BaseSemester;
 public interface IBaseSemesterService extends IService<BaseSemester> {
 
     BaseSemester getCurrentSemester();
+
+
+    Long getLastSemester();
 }

+ 15 - 0
src/main/java/com/xjrsoft/module/base/service/impl/BaseSemesterServiceImpl.java

@@ -39,4 +39,19 @@ public class BaseSemesterServiceImpl extends ServiceImpl<BaseSemesterMapper, Bas
         BaseSemester baseSemester = semesterList.get(0);
         return baseSemester;
     }
+
+
+    @Override
+    public Long getLastSemester() {
+        List<BaseSemester> semesterList = this.list(
+                new QueryWrapper<BaseSemester>().lambda()
+                        .eq(BaseSemester::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .orderByDesc(BaseSemester::getStartDate)
+        );
+        if(semesterList.isEmpty()){
+            return null;
+        }
+        BaseSemester baseSemester = semesterList.get(0);
+        return baseSemester.getId();
+    }
 }

+ 58 - 20
src/main/java/com/xjrsoft/module/student/controller/StudentReportRecordController.java

@@ -10,6 +10,7 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.enums.EnrollTypeEnum;
@@ -20,11 +21,13 @@ 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.BaseClass;
 import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.base.service.IBaseSemesterService;
+import com.xjrsoft.module.base.vo.BaseClassPageVo;
 import com.xjrsoft.module.databoard.vo.ItemCountVo;
 import com.xjrsoft.module.student.dto.AddStudentReportRecordDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
@@ -32,10 +35,12 @@ import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
 import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
 import com.xjrsoft.module.student.entity.StudentReportPlan;
+import com.xjrsoft.module.student.entity.StudentReportPlanClassRelation;
 import com.xjrsoft.module.student.entity.StudentReportRecord;
 import com.xjrsoft.module.student.service.IStudentReportPlanService;
 import com.xjrsoft.module.student.service.IStudentReportRecordService;
 import com.xjrsoft.module.student.vo.BaseMajorCategorPageVo;
+import com.xjrsoft.module.student.vo.StudentReportRecordItemVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
@@ -198,7 +203,7 @@ public class StudentReportRecordController {
     @SaCheckPermission("studentreportrecord:detail")
     public RT<StudentReportRecordStatisticsVo> classStatistics(@Valid StudentReportRecordStatisticsDto dto){
 
-         if(dto.getTeacherId() == null && dto.getClassId() == null){
+        if(dto.getTeacherId() == null && dto.getClassId() == null){
             dto.setTeacherId(StpUtil.getLoginIdAsLong());
         }
         if(dto.getBaseSemesterId() == null){
@@ -244,7 +249,7 @@ public class StudentReportRecordController {
     @ApiOperation(value="领导统计")
     @SaCheckPermission("studentreportrecord:detail")
     public RT<StudentReportRecordStatisticsVo> statistics(@Valid StudentReportRecordStatisticsDto dto){
-        if(dto.getGradeId() == null){
+        if(dto.getGradeId() == null && (dto.getCategory() == null || dto.getCategory() == 1)){
             LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper
                     .orderByDesc(BaseGrade::getTitle)
@@ -257,6 +262,9 @@ public class StudentReportRecordController {
         if(dto.getEnrollType() == null || dto.getEnrollType().isEmpty()){
             dto.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
         }
+        if(dto.getCategory() != null && dto.getCategory() == 2){
+            dto.setBaseSemesterId(semesterService.getLastSemester());
+        }
         List<StudentReportRecordStatisticsListVo> dataList = studentReportRecordService.getStatisticsDataList(dto);
         StudentReportRecordStatisticsVo statisticsVo = new StudentReportRecordStatisticsVo();
         statisticsVo.setAllCount(dataList.stream().count());
@@ -286,49 +294,58 @@ public class StudentReportRecordController {
                         && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatus())
                         && x.getReportTime() != null
         ).count());
-        Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).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());
-                    }}
-            );
+
+        if(dto.getCategory() != null && dto.getCategory() == 1){
+            Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).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);
         }
-        statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> classMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
-        List<ItemCountVo> classList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> classNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
+        List<StudentReportRecordItemVo> classList = new ArrayList<>();
         for (String className : classMap.keySet()) {
             classList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(className);
                         setCount(classMap.get(className).size());
+                        setCount2(classNotMap.get(className).size());
                     }}
             );
         }
         statisticsVo.setClassList(classList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> classTypeMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
-        List<ItemCountVo> classTypeList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> classTypeNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
+        List<StudentReportRecordItemVo> classTypeList = new ArrayList<>();
         for (String classType : classTypeMap.keySet()) {
             classTypeList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(classType);
                         setCount(classTypeMap.get(classType).size());
+                        setCount2(classTypeNotMap.get(classType).size());
                     }}
             );
         }
         statisticsVo.setClassTypeList(classTypeList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> majorMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
-        List<ItemCountVo> majorList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> majorNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
+        List<StudentReportRecordItemVo> majorList = new ArrayList<>();
         for (String majorName : majorMap.keySet()) {
             majorList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(majorName);
                         setCount(majorMap.get(majorName).size());
+                        setCount2(majorNotMap.get(majorName).size());
                     }}
             );
         }
@@ -368,14 +385,33 @@ public class StudentReportRecordController {
             if(dto.getClassId() == null){
                 dto.setClassId(classId);
             }
-            Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
-            dto.setStudentReportPlanId(planId);
+//            Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
+//            dto.setStudentReportPlanId(planId);
         }
         Page<StudentReportRecordPlanPageVo> planPage = studentReportRecordService.getPlanPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<StudentReportRecordPlanPageVo> pageOutput = ConventPage.getPageOutput(planPage, StudentReportRecordPlanPageVo.class);
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/class-list")
+    @ApiOperation(value="班主任负责班级")
+    @SaCheckPermission("studentreportrecord:detail")
+    public RT<List<BaseClassPageVo>> classList(@Valid StudentReportRecordPageDto dto){
+
+        long teacherId = StpUtil.getLoginIdAsLong();
+        Long planId = planService.getEffectivePlanId(teacherId, null);
+        List<BaseClassPageVo> list = classService.selectJoinList(BaseClassPageVo.class,
+                new MPJLambdaWrapper<BaseClass>()
+                        .select(BaseClass::getId)
+                        .selectAs(BaseClass::getName, BaseClassPageVo::getName)
+                        .innerJoin(StudentReportPlanClassRelation.class, StudentReportPlanClassRelation::getClassId, BaseClass::getId)
+                        .innerJoin(StudentReportPlan.class, StudentReportPlan::getId, StudentReportPlanClassRelation::getStudentReportPlanId)
+                        .eq(StudentReportPlan::getId, planId)
+                        .eq(BaseClass::getTeacherId, teacherId)
+        );
+        return RT.ok(list);
+    }
+
     @PostMapping(value = "/sign")
     @ApiOperation(value="学生报到")
     @SaCheckPermission("studentreportrecord:detail")
@@ -389,6 +425,8 @@ public class StudentReportRecordController {
         return RT.ok(studentReportRecordService.sgin(dto));
     }
 
+
+
     @PostMapping(value = "/all-sign")
     @ApiOperation(value="变更已报到")
     @SaCheckPermission("studentreportrecord:detail")

+ 3 - 0
src/main/java/com/xjrsoft/module/student/dto/StudentReportRecordStatisticsDto.java

@@ -34,4 +34,7 @@ public class StudentReportRecordStatisticsDto extends PageInput {
     @JsonIgnore
     @ApiModelProperty("报到计划id")
     private Long studentReportPlanId;
+
+    @ApiModelProperty("统计类别(1:新生报到 2:开学报告 3:试读报到)")
+    private Integer category;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/student/mapper/StudentReportRecordMapper.java

@@ -33,4 +33,7 @@ public interface StudentReportRecordMapper extends MPJBaseMapper<StudentReportRe
 
     List<StudentReportRecordPlanPageVo> getPlanPageList(@Param("dto") StudentReportRecordPageDto dto);
 
+
+    List<StudentReportRecordStatisticsListVo> getStatisticsPlanDataList(@Param("dto") StudentReportRecordStatisticsDto dto);
+
 }

+ 11 - 1
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportRecordServiceImpl.java

@@ -54,7 +54,17 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
 
     @Override
     public List<StudentReportRecordStatisticsListVo> getStatisticsDataList(StudentReportRecordStatisticsDto dto) {
-        return this.baseMapper.getStatisticsDataList(dto);
+        List<StudentReportRecordStatisticsListVo> resultList;
+        if(dto.getCategory() != null && dto.getCategory() == 1){
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }else if(dto.getCategory() != null && dto.getCategory() == 2){
+            resultList = this.baseMapper.getStatisticsPlanDataList(dto);
+        }else if(dto.getCategory() != null && dto.getCategory() == 3){
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }else{
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }
+        return resultList;
     }
 
     @Override

+ 30 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordItemVo.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 学生报到记录表表单出参
+* @Author dzx
+* @Date: 2024-08-28
+* @Version 1.0
+*/
+@Data
+public class StudentReportRecordItemVo {
+
+    @ApiModelProperty("统计项")
+    private String item;
+    /**
+     * 完成总数
+     */
+    @ApiModelProperty("数量")
+    private Integer count;
+
+    @ApiModelProperty("数量")
+    private Integer count2;
+
+
+
+}

+ 3 - 3
src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordStatisticsVo.java

@@ -65,13 +65,13 @@ public class StudentReportRecordStatisticsVo {
     private Long notStayFemaleCount;
 
     @ApiModelProperty("班级报到情况")
-    private List<ItemCountVo> classList;
+    private List<StudentReportRecordItemVo> classList;
 
     @ApiModelProperty("班级类型报到情况")
-    private List<ItemCountVo> classTypeList;
+    private List<StudentReportRecordItemVo> classTypeList;
 
     @ApiModelProperty("专业报到情况")
-    private List<ItemCountVo> majorList;
+    private List<StudentReportRecordItemVo> majorList;
 
     @ApiModelProperty("专业部报到情况")
     private List<ItemCountVo> deptList;

+ 17 - 0
src/main/resources/mapper/student/StudentReportRecordMapper.xml

@@ -206,4 +206,21 @@
         AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
         AND t2.delete_mark = 0
     </select>
+    <select id="getStatisticsPlanDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
+            resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
+        SELECT t1.name,t1.credential_number,t1.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
+        t6.name AS class_name,t8.name AS class_type,t7.name AS major_name,t9.name AS dept_name FROM xjr_user t1
+        INNER JOIN base_student_school_roll t4 ON t4.user_id = t1.id
+        INNER JOIN student_report_record t5 ON t1.id = t5.user_id AND t5.delete_mark = 0
+        INNER JOIN base_class t6 ON t6.id = t4.class_id
+        INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
+        LEFT JOIN xjr_dictionary_detail t8 ON t6.class_type = t8.code AND t8.item_id = 2023000000000000039
+        INNER JOIN xjr_department t9 ON t9.id = t6.org_id
+        inner join student_report_plan t10 on t5.student_report_plan_id = t10.id
+        WHERE t1.delete_mark = 0 and t10.delete_mark = 0
+        <if test="dto.gradeId != null">
+            and t4.grade_id = #{dto.gradeId}
+        </if>
+        AND t10.semester_id = #{dto.baseSemesterId}
+    </select>
 </mapper>

+ 50 - 43
src/main/resources/sqlScript/20250120_sql.sql

@@ -2,55 +2,55 @@
 -- 2025-01-20 10:36
 -- 需要进行课程管理的班级
 -- ----------------------------
-drop table if exists base_class_admin_course;
-create table `base_class_admin_course`
+DROP TABLE IF EXISTS base_class_admin_course;
+CREATE TABLE `base_class_admin_course`
 (
-    id                  bigint        not null comment '主键编号'
-        primary key,
-    create_user_id      bigint        null comment '创建人',
-    create_date         datetime      null comment '创建时间',
-    modify_user_id      bigint        null comment '修改人',
-    modify_date         datetime      null comment '修改时间',
-    delete_mark         int           not null comment '删除标记',
-    enabled_mark        int           not null comment '有效标志',
-    sort_code           int           null comment '序号',
-    remark              varchar(1000) null comment '备注',
-
-    class_id         bigint      null comment '班级id(base_class)',
-    base_semester_id bigint      null comment '学期id'
-) engine = innodb
-  default charset = utf8mb4
-  collate = utf8mb4_0900_ai_ci comment ='需要进行课程管理的班级';
-
-alter table base_class_course
-    modify class_id bigint null comment '需要进行课程管理的班级id(base_class_admin_course)(原有班级主键id字段)';
-
-alter table textbook_subscription_item
-    add use_class_num int default 0 null comment '在本次征订中本征订项的教材使用的班级数量';
+    id                  BIGINT        NOT NULL COMMENT '主键编号'
+        PRIMARY KEY,
+    create_user_id      BIGINT        NULL COMMENT '创建人',
+    create_date         DATETIME      NULL COMMENT '创建时间',
+    modify_user_id      BIGINT        NULL COMMENT '修改人',
+    modify_date         DATETIME      NULL COMMENT '修改时间',
+    delete_mark         INT           NOT NULL COMMENT '删除标记',
+    enabled_mark        INT           NOT NULL COMMENT '有效标志',
+    sort_code           INT           NULL COMMENT '序号',
+    remark              VARCHAR(1000) NULL COMMENT '备注',
+
+    class_id         BIGINT      NULL COMMENT '班级id(base_class)',
+    base_semester_id BIGINT      NULL COMMENT '学期id'
+) ENGINE = INNODB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_0900_ai_ci COMMENT ='需要进行课程管理的班级';
+
+ALTER TABLE base_class_course
+    MODIFY class_id BIGINT NULL COMMENT '需要进行课程管理的班级id(base_class_admin_course)(原有班级主键id字段)';
+
+ALTER TABLE textbook_subscription_item
+    ADD use_class_num INT DEFAULT 0 NULL COMMENT '在本次征订中本征订项的教材使用的班级数量';
 
 -- ----------------------------
 -- 2025-01-22 14:36
 -- 教材征订记录详情与班级关联表
 -- ----------------------------
-drop table if exists textbook_subscription_item_class;
-create table `textbook_subscription_item_class`
+DROP TABLE IF EXISTS textbook_subscription_item_class;
+CREATE TABLE `textbook_subscription_item_class`
 (
-    id                       bigint        not null comment '主键编号'
-        primary key,
-    create_user_id           bigint        null comment '创建人',
-    create_date              datetime      null comment '创建时间',
-    modify_user_id           bigint        null comment '修改人',
-    modify_date              datetime      null comment '修改时间',
-    delete_mark              int           not null comment '删除标记',
-    enabled_mark             int           not null comment '有效标志',
-    sort_code                int           null comment '序号',
-    remark                   varchar(1000) null comment '备注',
+    id                       BIGINT        NOT NULL COMMENT '主键编号'
+        PRIMARY KEY,
+    create_user_id           BIGINT        NULL COMMENT '创建人',
+    create_date              DATETIME      NULL COMMENT '创建时间',
+    modify_user_id           BIGINT        NULL COMMENT '修改人',
+    modify_date              DATETIME      NULL COMMENT '修改时间',
+    delete_mark              INT           NOT NULL COMMENT '删除标记',
+    enabled_mark             INT           NOT NULL COMMENT '有效标志',
+    sort_code                INT           NULL COMMENT '序号',
+    remark                   VARCHAR(1000) NULL COMMENT '备注',
 
-    textbook_subscription_item_id bigint        not null comment '教材征订记录详情表id(textbook_subscription)',
-    base_class_id            bigint        not null comment '按班级征订中征订的班级主键(base_class)'
-) engine = innodb
-  default charset = utf8mb4
-  collate = utf8mb4_0900_ai_ci comment ='教材征订记录详情与班级关联表';
+    textbook_subscription_item_id BIGINT        NOT NULL COMMENT '教材征订记录详情表id(textbook_subscription)',
+    base_class_id            BIGINT        NOT NULL COMMENT '按班级征订中征订的班级主键(base_class)'
+) ENGINE = INNODB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_0900_ai_ci COMMENT ='教材征订记录详情与班级关联表';
 
 
 
@@ -111,6 +111,13 @@ CREATE TABLE `student_report_plan_class_relation`  (
 ALTER TABLE `student_report_record`
   ADD COLUMN `student_report_plan_id` BIGINT NULL   COMMENT '报到计划id' AFTER `base_semester_id`;
 
-alter table textbook_subscription_item
-    add class_ids varchar(1024) null comment '按班级征订当前征订项的的教材使用的班级的主键';
+ALTER TABLE textbook_subscription_item
+    ADD base_class_ids VARCHAR(1024) NULL COMMENT '按班级征订当前征订项的的教材使用的班级的主键';
+
+ALTER TABLE `base_class`   
+  ADD INDEX (`major_set_id`);
+
 
+ALTER TABLE `student_report_record`   
+  ADD INDEX (`base_semester_id`),
+  ADD INDEX (`student_report_plan_id`);