Procházet zdrojové kódy

班级成绩查看

dzx před 10 měsíci
rodič
revize
183d653751

+ 23 - 8
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreController.java

@@ -1,29 +1,25 @@
 package com.xjrsoft.module.xycxedu.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.module.base.entity.BaseClass;
-import com.xjrsoft.module.organization.entity.User;
-import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
-import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ClassStudentScorePageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.UpdateExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ClassStudentScorePageVo;
+import com.xjrsoft.module.xycxedu.vo.ClassStudentScoreTitleVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -44,7 +40,6 @@ import java.util.List;
 @AllArgsConstructor
 public class ExamSubjectScoreController {
 
-
     private final IExamSubjectScoreService scoreService;
 
     @GetMapping(value = "/page")
@@ -94,4 +89,24 @@ public class ExamSubjectScoreController {
     }
 
 
+    @GetMapping(value = "/class-student-page")
+    @ApiOperation(value="班级成绩查询(分页)")
+    @SaCheckPermission("examsubjectscore:detail")
+    @XjrLog("查询考试成绩")
+    public RT<PageOutput<ClassStudentScorePageVo>> classStudentScorePage(@Valid ClassStudentScorePageDto dto){
+        PageOutput<ClassStudentScorePageVo> pageOutput = scoreService.getClassStudentScorePage(dto);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/class-student-page-title")
+    @ApiOperation(value="班级成绩查询列头")
+    @SaCheckPermission("examsubjectscore:detail")
+    @XjrLog("查询考试成绩")
+    public RT<List<ClassStudentScoreTitleVo>> classStudentScorePageTitle(@Valid ClassStudentScorePageDto dto){
+        //查询列头
+        List<ClassStudentScoreTitleVo> list = scoreService.getClassStudentScoreCourse(dto);
+        return RT.ok(list);
+    }
+
+
 }

+ 37 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/ClassStudentScorePageDto.java

@@ -0,0 +1,37 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ClassStudentScorePageDto extends PageInput {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("学生姓名")
+    private String name;
+
+    @ApiModelProperty("学期id")
+    private String credentialNumber;
+
+    @ApiModelProperty("考试计划id")
+    private Long examPlanId;
+
+    @ApiModelProperty("学期id")
+    private Long semesterId;
+
+    @ApiModelProperty("树id")
+    private String treeId;
+
+    @ApiModelProperty("树类型(1:部门  2:专业  3:年级  4:班级)")
+    private Integer treeType;
+
+    @JsonIgnore
+    private List<Long> userIdList;
+}

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

@@ -2,14 +2,18 @@ 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.ClassStudentScorePageDto;
 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.ClassStudentScoreTitleVo;
 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;
 
+import java.util.List;
+
 /**
 * @title: 晓羊策学考试计划表
 * @Author dzx
@@ -24,4 +28,8 @@ public interface ExamSubjectScoreMappper extends MPJBaseMapper<ExamSubjectScore>
     Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, @Param("dto") ExamSubjectScoreDto dto);
 
     Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, @Param("dto") ExamStatisticsPageDto dto);
+
+    List<ClassStudentScoreTitleVo> getClassStudentScoreCourse(@Param("dto") ClassStudentScorePageDto dto);
+
+    List<ExamSubjectScore> getClassStudentScoreList(@Param("dto") ClassStudentScorePageDto dto);
 }

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

@@ -3,13 +3,17 @@ package com.xjrsoft.module.xycxedu.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.xycxedu.dto.ClassStudentScorePageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
+import com.xjrsoft.module.xycxedu.vo.ClassStudentScorePageVo;
+import com.xjrsoft.module.xycxedu.vo.ClassStudentScoreTitleVo;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -32,4 +36,11 @@ public interface IExamSubjectScoreService extends MPJBaseService<ExamSubjectScor
     List<ExamSubjectScoreEnterImportVo> getEnterScoreStudentList(ExamSubjectScoreEnterDto dto);
 
     PageOutput<ExamSubjectScoreEnterImportVo> getEnterScoreStudentPage(Page<ExamSubjectScoreEnterImportVo> page, ExamSubjectScoreEnterDto dto);
+
+
+    List<ClassStudentScoreTitleVo> getClassStudentScoreCourse(ClassStudentScorePageDto dto);
+
+    List<ExamSubjectScore> getClassStudentScoreList(ClassStudentScorePageDto dto);
+
+    PageOutput<ClassStudentScorePageVo> getClassStudentScorePage(ClassStudentScorePageDto dto);
 }

+ 0 - 1
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreEnterServiceImpl.java

@@ -120,7 +120,6 @@ public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSub
                 examSubjectScores.setClassRanking(importVo.getClassRanking());
                 examSubjectScores.setGradeRanking(importVo.getGradeRanking());
                 examSubjectScores.setCoursename(courseSubjectMaps.get(enter.getCourseSubjectId()));
-                examSubjectScores.setMilexamid(enter.getExamPlanId());
                 updateList.add(examSubjectScores);
             }
 

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

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.xycxedu.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,20 +10,30 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.xycxedu.dto.ClassStudentScorePageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 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.ClassStudentScorePageVo;
+import com.xjrsoft.module.xycxedu.vo.ClassStudentScoreTitleVo;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @title: 晓羊策学考试计划表
@@ -33,6 +44,9 @@ import java.util.List;
 @Service
 @AllArgsConstructor
 public class ExamSubjectScoreServiceImpl extends MPJBaseServiceImpl<ExamSubjectScoreMappper, ExamSubjectScore> implements IExamSubjectScoreService {
+
+    private final IStudentManagerService studentManagerService;
+
     @Override
     public Long getUserIdByIdNumber(String idNumber) {
         return this.baseMapper.getUserIdByIdNumber(idNumber);
@@ -97,4 +111,52 @@ public class ExamSubjectScoreServiceImpl extends MPJBaseServiceImpl<ExamSubjectS
         PageOutput<ExamSubjectScoreEnterImportVo> pageOutput = ConventPage.getPageOutput(voIPage, ExamSubjectScoreEnterImportVo.class);
         return pageOutput;
     }
+
+    @Override
+    public List<ClassStudentScoreTitleVo> getClassStudentScoreCourse(ClassStudentScorePageDto dto) {
+        return this.baseMapper.getClassStudentScoreCourse(dto);
+    }
+
+    @Override
+    public List<ExamSubjectScore> getClassStudentScoreList(ClassStudentScorePageDto dto) {
+        return this.baseMapper.getClassStudentScoreList(dto);
+    }
+
+    @Override
+    public PageOutput<ClassStudentScorePageVo> getClassStudentScorePage(ClassStudentScorePageDto dto) {
+
+        BaseStudentUserPageDto studentDto = BeanUtil.toBean(dto, BaseStudentUserPageDto.class);
+        Page<BaseStudentUserPageVo> studentPage = studentManagerService.getStudentPage(new Page<>(dto.getLimit(), dto.getSize()), studentDto);
+
+        Set<Long> userIdSet = studentPage.getRecords().stream().map(x -> Long.parseLong(x.getId())).collect(Collectors.toSet());
+        ArrayList<Long> userIdList = new ArrayList<>(userIdSet);
+
+        List<ExamSubjectScore> allScoreList = this.baseMapper.getClassStudentScoreList(dto);
+        Map<Long, List<ExamSubjectScore>> listMap = allScoreList.stream().collect(Collectors.groupingBy(ExamSubjectScore::getUserId));
+        PageOutput<ClassStudentScorePageVo> pageOutput = ConventPage.getPageOutput(studentPage, ClassStudentScorePageVo.class);
+
+        for (ClassStudentScorePageVo vo : pageOutput.getList()) {
+            long userId = Long.parseLong(vo.getId());
+            List<ClassStudentScoreTitleVo> scoreList = new ArrayList<>();
+
+            List<ExamSubjectScore> scores = listMap.get(userId);
+            for (ExamSubjectScore score : scores) {
+                scoreList.add(
+                        new ClassStudentScoreTitleVo(){{
+                            if(score.getScore() != null){
+                                setScore(Float.toString(score.getScore()));
+                            }
+                            if(score.getExamPlanId() == null){
+                                setCourseId(score.getMilexamid() + "" + score.getCourseSubjectId());
+                            }else{
+                                setCourseId(score.getExamPlanId() + "" + score.getCourseSubjectId());
+                            }
+                            setName(score.getCoursename());
+                        }}
+                );
+            }
+            vo.setScoreList(scoreList);
+        }
+        return pageOutput;
+    }
 }

+ 21 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ClassStudentScorePageVo.java

@@ -0,0 +1,21 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+* @title: 考试计划维护表单出参
+* @Author dzx
+* @Date: 2024-07-18
+* @Version 1.0
+*/
+@Data
+public class ClassStudentScorePageVo extends BaseStudentUserPageVo {
+
+    @ApiModelProperty("学生姓名")
+    private List<ClassStudentScoreTitleVo> scoreList;
+
+}

+ 24 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ClassStudentScoreTitleVo.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 考试计划维护表单出参
+* @Author dzx
+* @Date: 2024-07-18
+* @Version 1.0
+*/
+@Data
+public class ClassStudentScoreTitleVo {
+
+    @ApiModelProperty("科目id")
+    private String courseId;
+
+    @ApiModelProperty("科目名称")
+    private String name;
+
+    @ApiModelProperty("科目分数")
+    private String score;
+
+}

+ 1 - 1
src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
 spring:
   # 环 io境 dev|pre|prod
   profiles:
-    active: dev
+    active: pre
   # jackson时间格式化
   jackson:
     time-zone: GMT+8

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

@@ -42,4 +42,27 @@
             and t1.sdate between #{dto.startDate} and #{dto.endDate}
         </if>
     </select>
+
+    <select id="getClassStudentScoreCourse" parameterType="com.xjrsoft.module.xycxedu.dto.ClassStudentScorePageDto" resultType="com.xjrsoft.module.xycxedu.vo.ClassStudentScoreTitleVo">
+        SELECT DISTINCT CONCAT(IFNULL(t1.exam_plan_id, t1.milexamid), t1.course_subject_id) as course_id, t4.name FROM exam_subject_score t1
+        INNER JOIN exam_plan t2 ON (t1.exam_plan_id = t2.id OR t2.milexamids LIKE CONCAT('%', t1.milexamid, '%'))
+        INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
+        LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
+        WHERE t1.delete_mark = 0
+        AND t1.semester_id = #{dto.semesterId}
+        AND t2.id = #{dto.examPlanId}
+        AND t3.class_id = #{dto.treeId}
+        order by t4.name
+    </select>
+    <select id="getClassStudentScoreList" parameterType="com.xjrsoft.module.xycxedu.dto.ClassStudentScorePageDto" resultType="com.xjrsoft.module.xycxedu.entity.ExamSubjectScore">
+        SELECT t1.* FROM exam_subject_score t1
+        INNER JOIN exam_plan t2 ON (t1.exam_plan_id = t2.id OR t2.milexamids LIKE CONCAT('%', t1.milexamid, '%'))
+        INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
+        LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
+        WHERE t1.delete_mark = 0
+        AND t1.semester_id = #{dto.semesterId}
+        AND t2.id = #{dto.examPlanId}
+        AND t3.class_id = #{dto.treeId}
+        order by t4.name
+    </select>
 </mapper>