Browse Source

学生成绩

dzx 4 tháng trước cách đây
mục cha
commit
94595988b3

+ 1 - 1
src/main/java/com/xjrsoft/module/job/ExamScoreDataTask.java

@@ -31,7 +31,7 @@ public class ExamScoreDataTask {
         String active = SpringUtil.getActiveProfile();
         if(!"prod".equals(active)){
             log.info("非正式环境,无法执行数据推送");
-            //return;
+            return;
         }
         doExecute();
     }

+ 15 - 3
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamPlanController.java

@@ -5,19 +5,24 @@ import cn.hutool.core.bean.BeanUtil;
 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.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.xycxedu.dto.AddExamPlanDto;
 import com.xjrsoft.module.xycxedu.dto.ExamPlanPageDto;
+import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.UpdateExamPlanDto;
 import com.xjrsoft.module.xycxedu.entity.ExamPlan;
 import com.xjrsoft.module.xycxedu.entity.XycxeduExamList;
 import com.xjrsoft.module.xycxedu.service.IExamPlanService;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
 import com.xjrsoft.module.xycxedu.service.IXycxeduExamListService;
 import com.xjrsoft.module.xycxedu.vo.ExamPlanPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamPlanVo;
+import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import com.xjrsoft.module.xycxedu.vo.XycxeduExamListVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -30,10 +35,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -53,7 +56,7 @@ public class ExamPlanController {
 
     private final IExamPlanService examPlanService;
     private final IXycxeduExamListService examListService;
-
+    private final IExamSubjectScoreService scoreService;
     @GetMapping(value = "/page")
     @ApiOperation(value="考试计划维护列表(分页)")
     @SaCheckPermission("examplan:detail")
@@ -122,4 +125,13 @@ public class ExamPlanController {
         List<XycxeduExamListVo> listVos = BeanUtil.copyToList(list, XycxeduExamListVo.class);
         return RT.ok(listVos);
     }
+
+    @GetMapping(value = "/exam-statistics")
+    @ApiOperation(value="考试记录(分页)")
+    @SaCheckPermission("examplan:detail")
+    public RT<PageOutput<ExamStatisticsPageVo>> page(@Valid ExamStatisticsPageDto dto){
+        Page<ExamStatisticsPageVo> page = scoreService.getStatisticsPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<ExamStatisticsPageVo> pageOutput = ConventPage.getPageOutput(page, ExamStatisticsPageVo.class);
+        return RT.ok(pageOutput);
+    }
 }

+ 1 - 0
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreController.java

@@ -41,4 +41,5 @@ public class ExamSubjectScoreController {
         return RT.ok(pageOutput);
     }
 
+
 }

+ 30 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/ExamStatisticsPageDto.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDate;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ExamStatisticsPageDto extends PageInput {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 用户ID(xjr_user)
+     */
+    @ApiModelProperty("考试名称")
+    private String milexamname;
+    /**
+     * 学号
+     */
+    @ApiModelProperty("学期id")
+    private Long semesterId;
+
+    @ApiModelProperty("开始时间")
+    private LocalDate startDate;
+
+    @ApiModelProperty("结束时间")
+    private LocalDate endDate;
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/xycxedu/mapper/ExamSubjectScoreMappper.java

@@ -2,8 +2,10 @@ package com.xjrsoft.module.xycxedu.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
+import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -20,4 +22,6 @@ public interface ExamSubjectScoreMappper extends MPJBaseMapper<ExamSubjectScore>
     Long getUserIdByIdNumber(@Param("idNumber") String idNumber);
 
     Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, @Param("dto") ExamSubjectScoreDto dto);
+
+    Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, @Param("dto") ExamStatisticsPageDto dto);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreService.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.room.dto.RoomPageDto;
 import com.xjrsoft.module.room.vo.RoomPageVo;
+import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
+import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @title: 晓羊策学考试计划表
@@ -20,4 +23,6 @@ public interface IExamSubjectScoreService extends MPJBaseService<ExamSubjectScor
     Long getUserIdByIdNumber(String idNumber);
 
     Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, ExamSubjectScoreDto dto);
+
+    Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto);
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreServiceImpl.java

@@ -2,10 +2,12 @@ package com.xjrsoft.module.xycxedu.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.mapper.ExamSubjectScoreMappper;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -28,4 +30,9 @@ public class ExamSubjectScoreServiceImpl extends MPJBaseServiceImpl<ExamSubjectS
     public Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, ExamSubjectScoreDto dto) {
         return this.baseMapper.getPage(page, dto);
     }
+
+    @Override
+    public Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto) {
+        return this.baseMapper.getStatisticsPage(page, dto);
+    }
 }

+ 41 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamStatisticsPageVo.java

@@ -0,0 +1,41 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+/**
+* @title: 考试计划维护表单出参
+* @Author dzx
+* @Date: 2024-07-18
+* @Version 1.0
+*/
+@Data
+public class ExamStatisticsPageVo {
+
+    /**
+    * 考试计划名称
+    */
+    @ApiModelProperty("学期名称")
+    private String semesterName;
+    /**
+    * 晓羊策学考试计划id
+    */
+    @ApiModelProperty("考试名称")
+    private String milexamname;
+
+    @ApiModelProperty("考试时间")
+    private LocalDate sdate;
+
+    @ApiModelProperty("学生数量")
+    private Integer studentCount;
+
+    @ApiModelProperty("班级数量")
+    private Integer classCount;
+
+    @ApiModelProperty("主键")
+    private Long id;
+
+
+}

+ 17 - 0
src/main/resources/mapper/xycxedu/ExamSubjectScoreMappper.xml

@@ -22,4 +22,21 @@
             and t3.id = #{dto.examPlanId}
         </if>
     </select>
+
+    <select id="getStatisticsPage" parameterType="com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto" resultType="com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo">
+        SELECT t1.id, t1.milexamname,t3.name AS semester_name,t1.sdate,
+        (SELECT COUNT(DISTINCT(user_id)) FROM exam_subject_score WHERE delete_mark = 0 AND milexamid = t1.milexamid) AS student_count,
+        (SELECT COUNT(DISTINCT(a2.class_id)) FROM exam_subject_score a1
+        INNER JOIN base_student_school_roll a2 ON a1.user_id = a2.user_id
+        WHERE a1.delete_mark = 0 AND a1.milexamid = t1.milexamid) AS class_count FROM xycxedu_exam_list t1
+        LEFT JOIN exam_plan t2 ON t2.milexamids LIKE CONCAT('%', t1.milexamid ,'%')
+        LEFT JOIN base_semester t3 ON t2.semester_id = t3.id
+        WHERE t1.delete_mark = 0
+        <if test="dto.semesterId != null">
+            and t3.id = #{dto.semesterId}
+        </if>
+        <if test="dto.startDate != null and dto.endDate != null">
+            and t1.sdate between #{dto.startDate} and #{dto.endDate}
+        </if>
+    </select>
 </mapper>