Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 3 weeks ago
parent
commit
51eb46b424

+ 11
- 5
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java View File

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.utils;
2 2
 
3 3
 import com.xhkjedu.exception.MissingParametersException;
4
+import com.xhkjedu.exception.ServiceException;
4 5
 import lombok.extern.slf4j.Slf4j;
5 6
 import org.apache.commons.lang.StringUtils;
6 7
 import org.springframework.util.CollectionUtils;
@@ -463,18 +464,23 @@ public class N_Utils {
463 464
      * @return void
464 465
      **/
465 466
     public static void validation(Object[] strs) {
466
-        for (int i = 0; i < strs.length; i+=3) {
467
+        for (int i = 0; i < strs.length; i += 3) {
467 468
             Object filename = strs[i];
468
-            String msg = strs[i+1].toString()+"不能为空";
469
-            Integer type = Integer.parseInt(strs[i+2].toString());
470
-            if(type == 1){//Integer类型参数
469
+            String msg = strs[i + 1].toString() + "不能为空";
470
+            Integer type = Integer.parseInt(strs[i + 2].toString());
471
+            if (type == 1) {//Integer类型参数
471 472
                 if (!N_Utils.isNotEmpty(filename) || filename.equals(0)) {
472 473
                     throw new MissingParametersException(msg);
473 474
                 }
474
-            } else {//String类型参数
475
+            } else if (type == 2) {//String类型参数
475 476
                 if (!N_Utils.isNotEmpty(filename)) {
476 477
                     throw new MissingParametersException(msg);
477 478
                 }
479
+            } else if (type == 3) {// List类型参数
480
+                List list = (List) filename;
481
+                if (!isListNotEmpty(list)) {
482
+                    throw new ServiceException(msg);
483
+                }
478 484
             }
479 485
         }
480 486
     }

+ 27
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/report/ZhReportController.java View File

@@ -4,10 +4,12 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.smarking.model.exam.MsSubject;
6 6
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
7
+import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
7 8
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudentAction;
8 9
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
9 10
 import com.xhkjedu.smarking.service.report.report.*;
10 11
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
12
+import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
11 13
 import com.xhkjedu.utils.N_Utils;
12 14
 import com.xhkjedu.utils.PageUtil;
13 15
 import com.xhkjedu.vo.PageResult;
@@ -38,6 +40,8 @@ public class ZhReportController {
38 40
     private MsrSubjectService msrSubjectService;
39 41
     @Resource
40 42
     private MsrActionService msrActionService;
43
+    @Resource
44
+    private MsrClassService msrClassService;
41 45
 
42 46
     /**
43 47
      * @Description 总概览
@@ -52,6 +56,29 @@ public class ZhReportController {
52 56
         return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForZgl(subject));
53 57
     }
54 58
 
59
+    /**
60
+     * @Description 排行榜
61
+     * @Date 2025/1/6 9:11
62
+     * @Author YWX
63
+     * @Param [params]
64
+     * @Return com.xhkjedu.vo.ResultVo
65
+     **/
66
+    @PostMapping("/phb")
67
+    public ResultVo listStudentForPhb(@RequestBody StudentParams params) {
68
+        Integer page = params.getPage();
69
+        Integer pageSize = params.getPageSize();
70
+        N_Utils.validation(new Object[]{
71
+                params.getExamid(), "考试id", 1
72
+                , params.getClassids(), "班级", 2
73
+                , params.getFields(), "指标", 3
74
+                , page, "显示页码", 1, pageSize, "显示条数", 1
75
+        });
76
+        PageHelper.startPage(page, pageSize);
77
+        List<Map> list = msrStudentService.listStudentForPhb(params);
78
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
79
+        return new ResultVo(0, "获取成功", pageResult);
80
+    }
81
+
55 82
     /*
56 83
      * @Description 小分表-列表
57 84
      * @Date 2024/12/24 10:25:06

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportstu/MsrStudentMapper.java View File

@@ -3,6 +3,7 @@ package com.xhkjedu.smarking.mapper.report.reportstu;
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
5 5
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
6
+import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 import java.util.List;
@@ -24,4 +25,7 @@ public interface MsrStudentMapper extends TkMapper<MsrStudent> {
24 25
     List<Map<String, Object>> listStuSubjectQuestions(@Param("params") ExamReportParams params);
25 26
     //综合报告-总概览-整体分数分布分析
26 27
     List<Map<String, Object>> listScoreForZgl(@Param("examid") Integer examid,@Param("subjectid") String subjectid);
28
+
29
+    //综合报告-排行榜
30
+    List<Map> listStudentForPhb(@Param("sql") String sql,@Param("params") StudentParams params);
27 31
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportstu/MsrStudentAction.java View File

@@ -5,6 +5,7 @@ import lombok.Data;
5 5
 
6 6
 import javax.persistence.Id;
7 7
 import javax.persistence.Table;
8
+import java.util.List;
8 9
 
9 10
 /**
10 11
  * @Description 考试报告学生违纪优秀分析表
@@ -29,4 +30,6 @@ public class MsrStudentAction extends BaseBean {
29 30
     private Integer actiontype;
30 31
     //科目信息
31 32
     private String subjectjson;
33
+    //班级ids
34
+    private List<Integer> classids;
32 35
 }

+ 49
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/report/report/MsrStudentService.java View File

@@ -2,7 +2,9 @@ package com.xhkjedu.smarking.service.report.report;
2 2
 
3 3
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
4 4
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentPointMapper;
5
+import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
5 6
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
7
+import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
6 8
 import org.springframework.stereotype.Service;
7 9
 
8 10
 import javax.annotation.Resource;
@@ -36,5 +38,51 @@ public class MsrStudentService {
36 38
         return msrStudentPointMapper.listStuPoints(params);
37 39
     }
38 40
 
39
-
41
+    /**
42
+     * @Description 综合报告-排行榜
43
+     * @Date 2025/1/6 9:12
44
+     * @Author YWX
45
+     * @Param [params]
46
+     * @Return java.lang.Object
47
+     **/
48
+    public List<Map> listStudentForPhb(StudentParams params) {
49
+        List<String> fields = params.getFields();
50
+        StringBuilder sql = new StringBuilder();
51
+        sql.append("s.rsid");
52
+        boolean user = false;
53
+        if (fields.contains("姓名")) {
54
+            sql.append(",u.username as studentname");
55
+            user = true;
56
+        }
57
+        if (fields.contains("考号")) {
58
+            sql.append(",u.examno");
59
+            user = true;
60
+        }
61
+        if (fields.contains("学号")) {
62
+            sql.append(",u.studentno");
63
+            user = true;
64
+        }
65
+        if (fields.contains("班级")) {
66
+            sql.append(",(select c.classname from t_class c where c.classid=s.classid) as classname");
67
+        }
68
+        if (fields.contains("分数")) {
69
+            sql.append(",s.stuscore");
70
+        }if (fields.contains("等级")) {
71
+            sql.append(",s.gradevalue");
72
+        }if (fields.contains("学校排名")) {
73
+            sql.append(",s.schoolrank");
74
+        }if (fields.contains("班级排名")) {
75
+            sql.append(",s.classrank");
76
+        }if (fields.contains("标准分")) {
77
+            sql.append(",s.bzf");
78
+        }if (fields.contains("超均率")) {
79
+            sql.append(",s.cjl");
80
+        }
81
+        sql.append(" from msr_student s ");
82
+        if (user) {
83
+            sql.append(" inner join t_user u on s.studentid=u.userid ");
84
+        }
85
+        List<Map> list=msrStudentMapper.listStudentForPhb(sql.toString(), params);
86
+        return list;
87
+    }
40 88
 }

+ 27
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportstu/StudentParams.java View File

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.smarking.vo.report.reportstu;
2
+
3
+import com.xhkjedu.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description 学生成绩参数类
10
+ * @Author YWX
11
+ * @Date 2025/1/6 9:42
12
+ **/
13
+@Data
14
+public class StudentParams extends BaseBean {
15
+
16
+    private Integer examid;//考试ID
17
+
18
+    private String subjectid;//科目ID
19
+
20
+    private List<String> subjectids;//科目ID
21
+
22
+    private Integer classid;//班级ID
23
+
24
+    private List<Integer> classids;//多个班级id
25
+
26
+    private List<String> fields;//指标字段
27
+}

+ 1
- 1
smarking/src/main/resources/mapper/report/reportclass/MsrClassActionMapper.xml View File

@@ -25,7 +25,7 @@
25 25
     <!--行为分析-班级-->
26 26
     <select id="listXwBj" resultType="java.util.Map">
27 27
         select c.classname,ca.classid,ca.subjectjson
28
-        from msr_rclass_action ca left join t_class c on ca.classid = c.classid
28
+        from msr_class_action ca left join t_class c on ca.classid = c.classid
29 29
         where ca.examid=#{action.examid} and ca.actiontype=#{action.actiontype}
30 30
         <if test="action.classid!=null and action.classid!=0">
31 31
             and ca.classid=#{action.classid}

+ 1
- 1
smarking/src/main/resources/mapper/report/reportclass/MsrClassSubjectGradeMapper.xml View File

@@ -17,7 +17,7 @@
17 17
     <select id="getZfScoreRate" resultType="java.util.Map">
18 18
         select rangename,rangenum,rangerate
19 19
         from msr_class_subject_grade
20
-        where examid = #{examid} and reportcode = #{reportcode} and classid = 0 and subjectid = 'zf'
20
+        where examid = #{examid} and reportcode = 'zh' and classid = 0 and subjectid = 'zf'
21 21
     </select>
22 22
 
23 23
 </mapper>

+ 11
- 0
smarking/src/main/resources/mapper/report/reportstu/MsrStudentMapper.xml View File

@@ -72,4 +72,15 @@
72 72
         where examid=#{examid} and subjectid=#{subjectid}
73 73
         group by stuscore
74 74
     </select>
75
+    <!--综合报告-排行榜-->
76
+    <select id="listStudentForPhb" resultType="java.util.Map">
77
+        select ${sql}
78
+        where s.examid=#{params.examid}
79
+        <foreach collection="params.classids" item="classid" open="and s.classid in(" separator="," close=")">
80
+            ${classid}
81
+        </foreach>
82
+        <foreach collection="params.subjectids" item="subjectid" open="and s.subjectid in(" separator="," close=")">
83
+            #{subjectid}
84
+        </foreach>
85
+    </select>
75 86
 </mapper>

Loading…
Cancel
Save