Browse Source

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式版本
王宁 2 years ago
parent
commit
b484e3d937
19 changed files with 544 additions and 159 deletions
  1. 100
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportSchoolController.java
  2. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentMapper.java
  3. 6
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/report/EReportGenerateMapper.java
  4. 31
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/report/EReportSchoolMapper.java
  5. 14
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassActionMapper.java
  6. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassMapper.java
  7. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassRankMapper.java
  8. 14
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/reportstu/ERstudentActionMapper.java
  9. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/report/ERrank.java
  10. 27
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/reportclass/ERclassAction.java
  11. 30
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/reportstu/ERstudentAction.java
  12. 104
    159
      sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java
  13. 75
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportSchoolService.java
  14. 28
    0
      sexam/src/main/java/com/xhkjedu/sexam/vo/report/ERankParamVo.java
  15. 5
    0
      sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml
  16. 15
    0
      sexam/src/main/resources/mapper/report/ERclassMapper.xml
  17. 17
    0
      sexam/src/main/resources/mapper/report/ERclassRankMapper.xml
  18. 16
    0
      sexam/src/main/resources/mapper/report/EReportGenerateMapper.xml
  19. 42
    0
      sexam/src/main/resources/mapper/report/EReportSchoolMapper.xml

+ 100
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportSchoolController.java View File

@@ -4,7 +4,9 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.sexam.model.report.ERbase;
6 6
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
7
+import com.xhkjedu.sexam.model.reportstu.ERstudentAction;
7 8
 import com.xhkjedu.sexam.service.report.EReportSchoolService;
9
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
8 10
 import com.xhkjedu.utils.N_Utils;
9 11
 import com.xhkjedu.utils.PageUtil;
10 12
 import com.xhkjedu.vo.PageResult;
@@ -70,4 +72,102 @@ public class EReportSchoolController {
70 72
             return new ResultVo(0, "获取成功", pageResult);
71 73
         }
72 74
     }
75
+
76
+    /*
77
+     * 成绩分析
78
+     * @Param [rank]
79
+     * @Author ywx
80
+     * @Date 2022/8/29 9:01
81
+     * @return com.xhkjedu.vo.ResultVo
82
+     **/
83
+    @PostMapping("/list_cjfx")
84
+    public ResultVo listCjFx(@RequestBody ERankParamVo rank) {
85
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getSubjectid(), "科目id", 2});
86
+        Map map = eReportSchoolService.listCjFx(rank);
87
+        return new ResultVo(0, "获取成功", map);
88
+    }
89
+
90
+    /*
91
+     * 成绩分析-搜索
92
+     * @Param [rank]
93
+     * @Author ywx
94
+     * @Date 2022/8/29 9:55
95
+     * @return com.xhkjedu.vo.ResultVo
96
+     **/
97
+    @PostMapping("/cjfx_ss")
98
+    public ResultVo listCjFxForSearch(@RequestBody ERankParamVo rank) {
99
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getSubjectid(), "科目id", 2});
100
+        List<Map> map = eReportSchoolService.listCjFxForSearch(rank);
101
+        return new ResultVo(0, "获取成功", map);
102
+    }
103
+
104
+    /*
105
+     * 成绩分析-设置
106
+     * @Param [rank]
107
+     * @Author ywx
108
+     * @Date 2022/8/29 10:07
109
+     * @return com.xhkjedu.vo.ResultVo
110
+     **/
111
+    @PostMapping("/cjfx_sz")
112
+    public ResultVo listCjFxForSet(@RequestBody ERankParamVo rank) {
113
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getCreateid(), "操作人id", 1, rank.getSubjectid(), "科目id", 2});
114
+        List<Map> map = eReportSchoolService.listCjFxForSet(rank);
115
+        return new ResultVo(0, "获取成功", map);
116
+    }
117
+
118
+    /*
119
+     * 行为分析-班级
120
+     * @Param [rank]
121
+     * @Author ywx
122
+     * @Date 2022/8/29 16:29
123
+     * @return com.xhkjedu.vo.ResultVo
124
+     **/
125
+    @PostMapping("/list_xw_bj")
126
+    public ResultVo listXwBj(@RequestBody ERstudentAction rank) {
127
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getActiontype(), "类型", 1});
128
+        List<Map> map = eReportSchoolService.listXwBj(rank);
129
+        return new ResultVo(0, "获取成功", map);
130
+    }
131
+
132
+    /*
133
+     * 行为分析-学生
134
+     * @Param [rank]
135
+     * @Author ywx
136
+     * @Date 2022/8/29 16:45
137
+     * @return com.xhkjedu.vo.ResultVo
138
+     **/
139
+    @PostMapping("/list_xw_xs")
140
+    public ResultVo listXwXs(@RequestBody ERstudentAction rank) {
141
+        Integer page = rank.getPage();
142
+        Integer pageSize = rank.getPageSize();
143
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getActiontype(), "类型", 1});
144
+        if(N_Utils.isEmptyInteger(page)){
145
+            List<Map> list = eReportSchoolService.listXwXs(rank);
146
+            return new ResultVo(0, "获取成功", list);
147
+        }else {
148
+            PageHelper.startPage(page, pageSize);
149
+            List<Map> list = eReportSchoolService.listXwXs(rank);
150
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
151
+            return new ResultVo(0, "获取成功", pageResult);
152
+        }
153
+    }
154
+
155
+    /*
156
+     * 违纪行为分析-详情
157
+     * @Param [rank]
158
+     * @Author ywx
159
+     * @Date 2022/8/29 16:54
160
+     * @return com.xhkjedu.vo.ResultVo
161
+     **/
162
+    @PostMapping("/xw_xq")
163
+    public ResultVo listWjXq(@RequestBody ERstudentAction rank) {
164
+        Integer page = rank.getPage();
165
+        Integer pageSize = rank.getPageSize();
166
+        N_Utils.validation(new Object[]{rank.getExamid(), "考试id", 1, rank.getActiontype(), "类型", 1
167
+                , rank.getStudentid(), "学生id", 1, page, "显示页码", 1, pageSize, "显示条数", 1});
168
+        PageHelper.startPage(page, pageSize);
169
+        List<Map> list = eReportSchoolService.listWjXq(rank);
170
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
171
+        return new ResultVo(0, "获取成功", pageResult);
172
+    }
73 173
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentMapper.java View File

@@ -82,4 +82,7 @@ public interface EPaperStudentMapper extends TkMapper<EPaperStudent> {
82 82
 
83 83
     //批量更新试卷学生试卷状态
84 84
     void batchUpdatePStuState(@Param("list") List<EPaperStudent> list);
85
+
86
+    //考试试卷学生
87
+    List<ERstudent> listByExamAndSubjectId(@Param("examid") Integer examid,@Param("subjectid") String subjectid);
85 88
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/report/EReportGenerateMapper.java View File

@@ -25,4 +25,10 @@ public interface EReportGenerateMapper {
25 25
 
26 26
     //学生上次考试排名及目标
27 27
     List<ERstudent> listStuRankAndGoal(@Param("examid") Integer examid);
28
+
29
+    //学生违纪行为
30
+    List<Map> listBadActionByExamId(@Param("examid") Integer examid);
31
+
32
+    //学生优秀行为
33
+    List<Map> listGoodActionByExamId(@Param("examid") Integer examid);
28 34
 }

+ 31
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/report/EReportSchoolMapper.java View File

@@ -0,0 +1,31 @@
1
+package com.xhkjedu.sexam.mapper.report;
2
+
3
+import com.xhkjedu.sexam.model.reportstu.ERstudentAction;
4
+import com.xhkjedu.sexam.vo.report.ERPaperVo;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * @author ywx
12
+ * @className EReportSchoolMapper
13
+ * @description 考试报告生成
14
+ * @date 2022/8/29 10:00
15
+ **/
16
+public interface EReportSchoolMapper {
17
+    //考试试卷
18
+    List<ERPaperVo> listByExamAndSubjectId(@Param("examid") Integer examid, @Param("subjectid") String subjectid);
19
+
20
+    //删除考试等级报告
21
+    void delByExamAndSubjectId(@Param("examid") Integer examid, @Param("subjectid") String subjectid, @Param("ranktype") Integer ranktype);
22
+
23
+    //行为分析-班级
24
+    List<Map> listXwBj(@Param("rank") ERstudentAction rank);
25
+
26
+    //行为分析-学生
27
+    List<Map> listXwXs(@Param("rank") ERstudentAction rank);
28
+
29
+    //违纪行为分析-详情
30
+    List<Map> listWjXq(@Param("rank") ERstudentAction rank);
31
+}

+ 14
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassActionMapper.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.sexam.mapper.reportclass;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.reportclass.ERclassAction;
5
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+public interface ERclassActionMapper extends TkMapper<ERclassAction> {
12
+    //校级报告-行为分析
13
+    List<Map> listByExamId(@Param("rank") ERankParamVo rank);
14
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassMapper.java View File

@@ -2,6 +2,13 @@ package com.xhkjedu.sexam.mapper.reportclass;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4 4
 import com.xhkjedu.sexam.model.reportclass.ERclass;
5
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
5 10
 
6 11
 public interface ERclassMapper extends TkMapper<ERclass> {
12
+    //校级报告-成绩分析
13
+    List<Map> listByExamId(@Param("rank") ERankParamVo rank);
7 14
 }

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/reportclass/ERclassRankMapper.java View File

@@ -2,6 +2,13 @@ package com.xhkjedu.sexam.mapper.reportclass;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4 4
 import com.xhkjedu.sexam.model.reportclass.ERclassRank;
5
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
5 10
 
6 11
 public interface ERclassRankMapper extends TkMapper<ERclassRank> {
12
+    //校级报告-成绩分析
13
+    List<Map> listByExamId(@Param("rank") ERankParamVo rank);
7 14
 }

+ 14
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/reportstu/ERstudentActionMapper.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.sexam.mapper.reportstu;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.reportstu.ERstudentAction;
5
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+public interface ERstudentActionMapper extends TkMapper<ERstudentAction> {
12
+    //校级报告-行为分析
13
+    List<Map> listByExamId(@Param("rank") ERankParamVo rank);
14
+}

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/report/ERrank.java View File

@@ -16,6 +16,9 @@ public class ERrank extends BaseBean {
16 16
     //考试id
17 17
     private Integer examid;
18 18
 
19
+    //科目id
20
+    private String subjectid;
21
+
19 22
     //类型1等级2分数段3临界分4临界名次5优秀年级前6学困年级后
20 23
     private Integer ranktype;
21 24
 

+ 27
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/reportclass/ERclassAction.java View File

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.sexam.model.reportclass;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_rclass_action")
10
+@Data
11
+public class ERclassAction extends BaseBean {
12
+    @Id
13
+    //考试报告班级行为分析表
14
+    private Integer rcaid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //考试id
20
+    private Integer examid;
21
+
22
+    //类型1违纪2优秀
23
+    private Integer actiontype;
24
+
25
+    //科目信息
26
+    private String subjectjson;
27
+}

+ 30
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/reportstu/ERstudentAction.java View File

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sexam.model.reportstu;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_rstudent_action")
10
+@Data
11
+public class ERstudentAction extends BaseBean {
12
+    @Id
13
+    //考试报告学生行为分析表
14
+    private Integer rsaid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //考试id
23
+    private Integer examid;
24
+
25
+    //类型1违纪2优秀
26
+    private Integer actiontype;
27
+
28
+    //科目信息
29
+    private String subjectjson;
30
+}

+ 104
- 159
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

@@ -10,31 +10,15 @@ import com.xhkjedu.sexam.mapper.report.ERbaseMapper;
10 10
 import com.xhkjedu.sexam.mapper.report.EReportGenerateMapper;
11 11
 import com.xhkjedu.sexam.mapper.report.ERrankMapper;
12 12
 import com.xhkjedu.sexam.mapper.report.ERsubjectMapper;
13
-import com.xhkjedu.sexam.mapper.reportclass.ERclassComplexityMapper;
14
-import com.xhkjedu.sexam.mapper.reportclass.ERclassMapper;
15
-import com.xhkjedu.sexam.mapper.reportclass.ERclassPointMapper;
16
-import com.xhkjedu.sexam.mapper.reportclass.ERclassQtypeMapper;
17
-import com.xhkjedu.sexam.mapper.reportclass.ERclassQuestionMapper;
18
-import com.xhkjedu.sexam.mapper.reportclass.ERclassRankMapper;
19
-import com.xhkjedu.sexam.mapper.reportstu.ERStudentComplexityMapper;
20
-import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
21
-import com.xhkjedu.sexam.mapper.reportstu.ERstudentPointMapper;
22
-import com.xhkjedu.sexam.mapper.reportstu.ERstudentQtypeMapper;
13
+import com.xhkjedu.sexam.mapper.reportclass.*;
14
+import com.xhkjedu.sexam.mapper.reportstu.*;
23 15
 import com.xhkjedu.sexam.mapper.system.UserMapper;
24 16
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
25 17
 import com.xhkjedu.sexam.model.report.ERbase;
26 18
 import com.xhkjedu.sexam.model.report.ERrank;
27 19
 import com.xhkjedu.sexam.model.report.ERsubject;
28
-import com.xhkjedu.sexam.model.reportclass.ERclass;
29
-import com.xhkjedu.sexam.model.reportclass.ERclassComplexity;
30
-import com.xhkjedu.sexam.model.reportclass.ERclassPoint;
31
-import com.xhkjedu.sexam.model.reportclass.ERclassQtype;
32
-import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
33
-import com.xhkjedu.sexam.model.reportclass.ERclassRank;
34
-import com.xhkjedu.sexam.model.reportstu.ERStudentComplexity;
35
-import com.xhkjedu.sexam.model.reportstu.ERStudentQtype;
36
-import com.xhkjedu.sexam.model.reportstu.ERstudent;
37
-import com.xhkjedu.sexam.model.reportstu.ERstudentPoint;
20
+import com.xhkjedu.sexam.model.reportclass.*;
21
+import com.xhkjedu.sexam.model.reportstu.*;
38 22
 import com.xhkjedu.sexam.utils.ExamUtil;
39 23
 import com.xhkjedu.sexam.vo.paper.QuestionOrderVo;
40 24
 import com.xhkjedu.sexam.vo.paper.QuestionPointVo;
@@ -49,12 +33,7 @@ import org.springframework.stereotype.Service;
49 33
 import org.springframework.transaction.annotation.Transactional;
50 34
 
51 35
 import javax.annotation.Resource;
52
-import java.util.ArrayList;
53
-import java.util.Comparator;
54
-import java.util.DoubleSummaryStatistics;
55
-import java.util.HashMap;
56
-import java.util.List;
57
-import java.util.Map;
36
+import java.util.*;
58 37
 import java.util.stream.Collectors;
59 38
 
60 39
 /**
@@ -106,6 +85,10 @@ public class EReportGenerateService {
106 85
     private ERrankMapper eRrankMapper;
107 86
     @Resource
108 87
     private ERclassRankMapper eRclassRankMapper;
88
+    @Resource
89
+    private ERclassActionMapper eRclassActionMapper;
90
+    @Resource
91
+    private ERstudentActionMapper eRstudentActionMapper;
109 92
 
110 93
     //生成考试报告
111 94
     @Transactional(rollbackFor = Exception.class)
@@ -322,6 +305,74 @@ public class EReportGenerateService {
322 305
 
323 306
         setClassQuestion(examid, subjects, classes);//题型试题
324 307
         setClassGradeRankAll(examid, papers, classSubjectStudents, createid);//班级等级分布
308
+        setAction(examid, subjectMap);//行为分析
309
+    }
310
+
311
+    //行为分析
312
+    private void setAction(Integer examid, Map<String, String> subjectMap) {
313
+        List<ERstudentAction> studentActions = new ArrayList<>();
314
+        List<ERclassAction> classActions = new ArrayList<>();
315
+        //违纪行为
316
+        List<Map> bads = eReportGenerateMapper.listBadActionByExamId(examid);
317
+        Integer actiontype = 1;
318
+        setActions(examid, subjectMap, studentActions, classActions, bads, actiontype);
319
+        List<Map> goods = eReportGenerateMapper.listGoodActionByExamId(examid);
320
+        actiontype = 2;
321
+        setActions(examid, subjectMap, studentActions, classActions, goods, actiontype);
322
+        if (N_Utils.isListEmpty(studentActions)) return;
323
+        eRstudentActionMapper.insertList(studentActions);
324
+        eRclassActionMapper.insertList(classActions);
325
+    }
326
+
327
+    //处理行为数据
328
+    private void setActions(Integer examid, Map<String, String> subjectMap
329
+            , List<ERstudentAction> studentActions, List<ERclassAction> classActions
330
+            , List<Map> actions, Integer actiontype) {
331
+        if (N_Utils.isListNotEmpty(actions)) {
332
+            for (Map action : actions) {
333
+                action.put("subjectname", subjectMap.get(action.get("subjectid")));
334
+            }
335
+            //学生行为分析
336
+            Map<Integer, List<Map>> collect = actions.stream().collect(Collectors.groupingBy(s -> (Integer) s.get("studentid")));
337
+            for (Map.Entry<Integer, List<Map>> entry : collect.entrySet()) {
338
+                List<Map> list = entry.getValue();
339
+                Map sq = list.get(0);
340
+                ERstudentAction sa = new ERstudentAction();
341
+                sa.setClassid((Integer) sq.get("classid"));
342
+                sa.setStudentid(entry.getKey());
343
+                sa.setExamid(examid);
344
+                sa.setActiontype(actiontype);
345
+                for (Map s : list) {
346
+                    s.remove("classid");
347
+                    s.remove("studentid");
348
+                }
349
+                String subjectjson = JSON.toJSONString(list);
350
+                sa.setSubjectjson(subjectjson);
351
+                studentActions.add(sa);
352
+            }
353
+
354
+            //班级行为分析
355
+            Map<Integer, List<Map>> ccollect = actions.stream().collect(Collectors.groupingBy(s -> (Integer) s.get("classid")));
356
+            for (Map.Entry<Integer, List<Map>> entry : ccollect.entrySet()) {
357
+                List<Map> subjects = new ArrayList<>();
358
+                Map<String, List<Map>> scollect = entry.getValue().stream().collect(Collectors.groupingBy(s -> s.get("subjectid").toString()));
359
+                for (Map.Entry<String, List<Map>> sentry : scollect.entrySet()) {
360
+                    List<Map> list = sentry.getValue();
361
+                    Map subject = new HashMap();
362
+                    subject.put("subjectid", sentry.getKey());
363
+                    subject.put("subjectname", list.get(0).get("subjectname"));
364
+                    subject.put("num", list.size());
365
+                    subjects.add(subject);
366
+                }
367
+                ERclassAction ca = new ERclassAction();
368
+                ca.setClassid(entry.getKey());
369
+                ca.setExamid(examid);
370
+                ca.setActiontype(actiontype);
371
+                String subjectjson = JSON.toJSONString(subjects);
372
+                ca.setSubjectjson(subjectjson);
373
+                classActions.add(ca);
374
+            }
375
+        }
325 376
     }
326 377
 
327 378
     //班级等级分布
@@ -404,22 +455,14 @@ public class EReportGenerateService {
404 455
     }
405 456
 
406 457
     //班级等级分布
407
-    private void setClassGradeRank(Integer examid, List<ERPaperVo> papers, List<ERstudent> students
458
+    public void setClassGradeRank(Integer examid, List<ERPaperVo> papers, List<ERstudent> students
408 459
             , List<ERrank> rranks, Integer createid) {
409 460
         List<Integer> userids = students.stream().map(ERstudent::getStudentid).distinct().collect(Collectors.toList());
410 461
         List<UserVo> users = userMapper.listNameByUserIds(userids);
411 462
         Map<Integer, String> userMap = users.stream().collect(Collectors.toMap(UserVo::getUserid, UserVo::getUsername));
412 463
 
413
-        Double zfscore = papers.stream().mapToDouble(p -> p.getPscore()).sum();//考试总分
414 464
         Map<String, Double> scoreMap = papers.stream().collect(Collectors.toMap(p -> p.getSubjectid(), p -> p.getPscore()));//考试总分
415 465
         Double pscore;//试卷总分
416
-        List<ERstudent> cstudents = new ArrayList<>();//班级学生
417
-        Map<String, List<ERstudent>> cscollect = students.stream().collect(
418
-                Collectors.groupingBy(s -> s.getClassid() + "_" + s.getStudentid()));
419
-        setStuScore(cscollect, cstudents);
420
-        //总分统计
421
-        Map<Integer, List<ERstudent>> zfcollect = cstudents.stream().collect(
422
-                Collectors.groupingBy(s -> s.getClassid()));
423 466
 
424 467
         List<ERstudent> sstudents = new ArrayList<>();//科目学生
425 468
         Map<String, List<ERstudent>> sscollect = students.stream().collect(
@@ -437,39 +480,21 @@ public class EReportGenerateService {
437 480
             for (ERrank rrank : rranks) {
438 481
                 Double maxrate = rrank.getMaxscore();
439 482
                 Double minrate = rrank.getMinscore();
440
-                //总分统计
441
-                double maxscore = ExamUtil.mul(maxrate, zfscore);
442
-                double minscore = ExamUtil.mul(minrate, zfscore);
443
-                rrank.setMaxscore(maxscore);
444
-                rrank.setMinscore(minscore);
445
-                rrankList.add(rrank);
446
-                String rankname = rrank.getRankname();
447
-                String rankrange = "[" + minscore + "," + maxscore;
448
-                if (rankname.equals("A")) {
449
-                    rankrange = rankrange + "]";
450
-                } else {
451
-                    rankrange = rankrange + ")";
452
-                }
453
-                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
454
-                    Integer classid = entry.getKey();
455
-                    String subjectid = "zf";
456
-                    List<ERstudent> list = entry.getValue();
457
-                    setDjTj(examid, userMap, rclassRankList, rrank, rankrange, subjectid, classid, list);
458
-                }
459 483
 
460 484
                 //分科统计
461 485
                 for (ERPaperVo paper : papers) {
462 486
                     String subjectid = paper.getSubjectid();
487
+                    rrank.setSubjectid(subjectid);
463 488
                     pscore = scoreMap.get(subjectid);
464
-                    maxscore = ExamUtil.mul(maxrate, pscore);
465
-                    minscore = ExamUtil.mul(minrate, pscore);
489
+                    double maxscore = ExamUtil.mul(maxrate, pscore);
490
+                    double minscore = ExamUtil.mul(minrate, pscore);
466 491
                     rrank.setMaxscore(maxscore);
467 492
                     rrank.setMinscore(minscore);
468 493
                     ERrank rrank1 = new ERrank();
469 494
                     BeanUtils.copyProperties(rrank, rrank1);
470 495
                     rrankList.add(rrank1);
471
-                    rankrange = "[" + minscore + "," + maxscore;
472
-                    if (rankname.equals("A")) {
496
+                    String rankrange = "[" + minscore + "," + maxscore;
497
+                    if (rrank.getRankname().equals("A")) {
473 498
                         rankrange = rankrange + "]";
474 499
                     } else {
475 500
                         rankrange = rankrange + ")";
@@ -494,34 +519,6 @@ public class EReportGenerateService {
494 519
             }
495 520
         } else if (ranktype == 2) {//分数段(10分/段)
496 521
             Integer linescore = eRrank.getLinescore();
497
-            //总分统计
498
-            Integer gnum = ExamUtil.divUp(zfscore, linescore);
499
-            for (Integer i = 1; i <= gnum; i++) {
500
-                ERrank rrank = new ERrank();
501
-                rrank.setRanktype(ranktype);
502
-                double maxscore = ExamUtil.mul(i, linescore);
503
-                double minscore = ExamUtil.mul(i - 1, linescore);
504
-                if (maxscore > zfscore) {
505
-                    maxscore = zfscore;
506
-                }
507
-                rrank.setMaxscore(maxscore);
508
-                rrank.setMinscore(minscore);
509
-                String rankrange = "[" + minscore + "," + maxscore;
510
-                if (i == gnum) {
511
-                    rankrange = rankrange + "]";
512
-                } else {
513
-                    rankrange = rankrange + ")";
514
-                }
515
-                rrank.setRankname(rankrange);
516
-                rrankList.add(rrank);
517
-
518
-                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
519
-                    Integer classid = entry.getKey();
520
-                    String subjectid = "zf";
521
-                    List<ERstudent> list = entry.getValue();
522
-                    setFdTj(examid, userMap, rclassRankList, gnum, i, rrank, rankrange, classid, list);
523
-                }
524
-            }
525 522
 
526 523
             //分科统计
527 524
             for (ERPaperVo paper : papers) {
@@ -531,10 +528,11 @@ public class EReportGenerateService {
531 528
                 for (Integer i = 1; i <= cnum; i++) {
532 529
                     ERrank rrank = new ERrank();
533 530
                     rrank.setRanktype(ranktype);
531
+                    rrank.setSubjectid(subjectid);
534 532
                     double maxscore = ExamUtil.mul(i, linescore);
535 533
                     double minscore = ExamUtil.mul(i - 1, linescore);
536
-                    if (maxscore > zfscore) {
537
-                        maxscore = zfscore;
534
+                    if (maxscore > pscore) {
535
+                        maxscore = pscore;
538 536
                     }
539 537
                     rrank.setMaxscore(maxscore);
540 538
                     rrank.setMinscore(minscore);
@@ -567,47 +565,26 @@ public class EReportGenerateService {
567 565
                 }
568 566
             }
569 567
         } else if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
570
-            Integer linescore1 = eRrank.getLinescore();
571
-            Integer linescore = linescore1;
568
+            Integer linescore = eRrank.getLinescore();
572 569
             Integer floatscore = eRrank.getFloatscore();
573
-            if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(zfscore, 0.8));
574
-            //总分统计
575 570
             ERrank rrank = new ERrank();
576 571
             rrank.setRanktype(ranktype);
577
-            double maxscore = ExamUtil.add(linescore, floatscore);
578
-            double minscore = ExamUtil.sub(linescore, floatscore);
579
-            if (maxscore > zfscore) maxscore = zfscore;
580
-            if (minscore < 0) minscore = 0;
581
-            rrank.setMaxscore(maxscore);
582
-            rrank.setMinscore(minscore);
583
-            rrank.setLinescore(linescore);
584
-            rrank.setFloatscore(floatscore);
585
-            String rankrange = "[" + minscore + "," + maxscore + "]";
586
-            rrank.setRankname(rankrange);
587
-            rrankList.add(rrank);
588
-
589
-            for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
590
-                Integer classid = entry.getKey();
591
-                String subjectid = "zf";
592
-                List<ERstudent> list = entry.getValue();
593
-                setLjfTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
594
-            }
595 572
 
596 573
             //分科统计
597 574
             for (ERPaperVo paper : papers) {
598 575
                 String subjectid = paper.getSubjectid();
576
+                rrank.setSubjectid(subjectid);
599 577
                 pscore = scoreMap.get(subjectid);
600
-                linescore = linescore1;
601 578
                 if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(pscore, 0.8));
602
-                maxscore = ExamUtil.add(linescore, floatscore);
603
-                minscore = ExamUtil.sub(linescore, floatscore);
579
+                double maxscore = ExamUtil.add(linescore, floatscore);
580
+                double minscore = ExamUtil.sub(linescore, floatscore);
604 581
                 if (maxscore > pscore) maxscore = pscore;
605 582
                 if (minscore < 0) minscore = 0;
606 583
                 rrank.setMaxscore(maxscore);
607 584
                 rrank.setMinscore(minscore);
608 585
                 rrank.setLinescore(linescore);
609 586
                 rrank.setFloatscore(floatscore);
610
-                rankrange = "[" + minscore + "," + maxscore + "]";
587
+                String rankrange = "[" + minscore + "," + maxscore + "]";
611 588
                 rrank.setRankname(rankrange);
612 589
                 ERrank rrank1 = new ERrank();
613 590
                 BeanUtils.copyProperties(rrank, rrank1);
@@ -632,42 +609,23 @@ public class EReportGenerateService {
632 609
         } else if (ranktype == 4) {//临界名次(临界名次10,浮动名次5)
633 610
             Integer linescore = eRrank.getLinescore();
634 611
             Integer floatscore = eRrank.getFloatscore();
635
-            //总分统计
636 612
             ERrank rrank = new ERrank();
637 613
             rrank.setRanktype(ranktype);
638
-            double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
639
-            double minscore = ExamUtil.add(linescore, floatscore);//最低名次
640
-            if (maxscore < 1) maxscore = 1;//最高名次为1
641
-            int stunum = (int) students.stream().map(s -> s.getStudentid()).distinct().count();//学生数量
642
-            if (minscore > stunum) minscore = stunum;//最低名次=学生数量
643
-            rrank.setMaxscore(maxscore);
644
-            rrank.setMinscore(minscore);
645
-            rrank.setLinescore(linescore);
646
-            rrank.setFloatscore(floatscore);
647
-            String rankrange = "[" + minscore + "," + maxscore + "]";
648
-            rrank.setRankname(rankrange);
649
-            rrankList.add(rrank);
650
-
651
-            for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
652
-                Integer classid = entry.getKey();
653
-                String subjectid = "zf";
654
-                List<ERstudent> list = entry.getValue();
655
-                setLjmcTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
656
-            }
657 614
 
658 615
             //分科统计
659 616
             for (ERPaperVo paper : papers) {
660 617
                 String subjectid = paper.getSubjectid();
661
-                maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
662
-                minscore = ExamUtil.add(linescore, floatscore);//最低名次
618
+                rrank.setSubjectid(subjectid);
619
+                double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
620
+                double minscore = ExamUtil.add(linescore, floatscore);//最低名次
663 621
                 if (maxscore < 1) maxscore = 1;//最高名次为1
664
-                stunum = students.size();//学生数量
622
+                Integer stunum = students.size();//学生数量
665 623
                 if (minscore > stunum) minscore = stunum;//最低名次=学生数量
666 624
                 rrank.setMaxscore(maxscore);
667 625
                 rrank.setMinscore(minscore);
668 626
                 rrank.setLinescore(linescore);
669 627
                 rrank.setFloatscore(floatscore);
670
-                rankrange = "[" + minscore + "," + maxscore + "]";
628
+                String rankrange = "[" + minscore + "," + maxscore + "]";
671 629
                 rrank.setRankname(rankrange);
672 630
                 ERrank rrank1 = new ERrank();
673 631
                 BeanUtils.copyProperties(rrank, rrank1);
@@ -691,25 +649,19 @@ public class EReportGenerateService {
691 649
             }
692 650
         } else if (ranktype == 5) {//优秀年级前(10名)
693 651
             Integer linescore = eRrank.getLinescore();
694
-            //总分统计
695 652
             ERrank rrank = new ERrank();
696 653
             rrank.setRanktype(ranktype);
697 654
             rrank.setLinescore(linescore);
698 655
             String rankrange = "年级前" + linescore + "名";
699 656
             rrank.setRankname(rankrange);
700
-            rrankList.add(rrank);
701
-
702
-            for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
703
-                Integer classid = entry.getKey();
704
-                String subjectid = "zf";
705
-                List<ERstudent> list = entry.getValue();
706
-                setNjqTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
707
-            }
708 657
 
709 658
             //分科统计
710 659
             for (ERPaperVo paper : papers) {
711 660
                 String subjectid = paper.getSubjectid();
712
-
661
+                rrank.setSubjectid(subjectid);
662
+                ERrank rrank1 = new ERrank();
663
+                BeanUtils.copyProperties(rrank, rrank1);
664
+                rrankList.add(rrank1);
713 665
                 //全部班级统计
714 666
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
715 667
                     Integer classid = 0;
@@ -728,26 +680,19 @@ public class EReportGenerateService {
728 680
             }
729 681
         } else if (ranktype == 6) {//学困年级后(10名)
730 682
             Integer linescore = eRrank.getLinescore();
731
-            //总分统计
732 683
             ERrank rrank = new ERrank();
733 684
             rrank.setRanktype(ranktype);
734 685
             rrank.setLinescore(linescore);
735 686
             String rankrange = "年级后" + linescore + "名";
736 687
             rrank.setRankname(rankrange);
737
-            rrankList.add(rrank);
738
-
739
-            for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
740
-                Integer classid = entry.getKey();
741
-                String subjectid = "zf";
742
-                List<ERstudent> list = entry.getValue();
743
-                rrank.setMaxscore(getMaxScore(list, linescore));
744
-                setNjhTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
745
-            }
746 688
 
747 689
             //分科统计
748 690
             for (ERPaperVo paper : papers) {
749 691
                 String subjectid = paper.getSubjectid();
750
-
692
+                rrank.setSubjectid(subjectid);
693
+                ERrank rrank1 = new ERrank();
694
+                BeanUtils.copyProperties(rrank, rrank1);
695
+                rrankList.add(rrank1);
751 696
                 //全部班级统计
752 697
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
753 698
                     Integer classid = 0;

+ 75
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportSchoolService.java View File

@@ -1,14 +1,24 @@
1 1
 package com.xhkjedu.sexam.service.report;
2 2
 
3
+import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
3 4
 import com.xhkjedu.sexam.mapper.report.ERbaseMapper;
5
+import com.xhkjedu.sexam.mapper.report.EReportSchoolMapper;
4 6
 import com.xhkjedu.sexam.mapper.report.ERsubjectMapper;
7
+import com.xhkjedu.sexam.mapper.reportclass.ERclassMapper;
8
+import com.xhkjedu.sexam.mapper.reportclass.ERclassRankMapper;
5 9
 import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
6 10
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
11
+import com.xhkjedu.sexam.model.reportstu.ERstudentAction;
12
+import com.xhkjedu.sexam.vo.report.ERPaperVo;
13
+import com.xhkjedu.sexam.vo.report.ERankParamVo;
7 14
 import org.springframework.stereotype.Service;
15
+import org.springframework.transaction.annotation.Transactional;
8 16
 
9 17
 import javax.annotation.Resource;
18
+import java.util.HashMap;
10 19
 import java.util.List;
11 20
 import java.util.Map;
21
+import java.util.stream.Collectors;
12 22
 
13 23
 /**
14 24
  * @author ywx
@@ -24,6 +34,16 @@ public class EReportSchoolService {
24 34
     private ERsubjectMapper eRsubjectMapper;
25 35
     @Resource
26 36
     private ERstudentMapper eRstudentMapper;
37
+    @Resource
38
+    private ERclassMapper eRclassMapper;
39
+    @Resource
40
+    private ERclassRankMapper eRclassRankMapper;
41
+    @Resource
42
+    private EReportGenerateService eReportGenerateService;
43
+    @Resource
44
+    private EReportSchoolMapper eReportSchoolMapper;
45
+    @Resource
46
+    private EPaperStudentMapper ePaperStudentMapper;
27 47
 
28 48
     //考试概况
29 49
     public Map getKsGk(Integer examid) {
@@ -38,4 +58,59 @@ public class EReportSchoolService {
38 58
     public List<Map> listCjd(ERstudent stu) {
39 59
         return eRstudentMapper.listByExamId(stu);
40 60
     }
61
+
62
+    //成绩分析
63
+    public Map listCjFx(ERankParamVo rank) {
64
+        Map map = new HashMap();
65
+        List<Map> classes = eRclassMapper.listByExamId(rank);
66
+        List<Map> list = eRclassRankMapper.listByExamId(rank);
67
+        List<Map> djList = list.stream().filter(l -> "1".equals(l.get("ranktype").toString())).collect(Collectors.toList());
68
+        List<Map> fsdList = list.stream().filter(l -> "2".equals(l.get("ranktype").toString())).collect(Collectors.toList());
69
+        List<Map> ljfList = list.stream().filter(l -> "3".equals(l.get("ranktype").toString())).collect(Collectors.toList());
70
+        List<Map> ljmcList = list.stream().filter(l -> "4".equals(l.get("ranktype").toString())).collect(Collectors.toList());
71
+        List<Map> yxsList = list.stream().filter(l -> "5".equals(l.get("ranktype").toString())).collect(Collectors.toList());
72
+        List<Map> xksList = list.stream().filter(l -> "6".equals(l.get("ranktype").toString())).collect(Collectors.toList());
73
+        map.put("classes", classes);
74
+        map.put("djList", djList);
75
+        map.put("fsdList", fsdList);
76
+        map.put("ljfList", ljfList);
77
+        map.put("ljmcList", ljmcList);
78
+        map.put("yxsList", yxsList);
79
+        map.put("xksList", xksList);
80
+        return map;
81
+    }
82
+
83
+    //成绩分析-搜索
84
+    public List<Map> listCjFxForSearch(ERankParamVo rank) {
85
+        return eRclassRankMapper.listByExamId(rank);
86
+    }
87
+
88
+    //成绩分析-设置
89
+    @Transactional(rollbackFor = Exception.class)
90
+    public List<Map> listCjFxForSet(ERankParamVo rank) {
91
+        Integer examid = rank.getExamid();
92
+        String subjectid = rank.getSubjectid();
93
+        Integer createid = rank.getCreateid();
94
+        Integer ranktype = rank.getRanktype();
95
+        eReportSchoolMapper.delByExamAndSubjectId(examid, subjectid, ranktype);//删除考试等级报告
96
+        List<ERPaperVo> papers = eReportSchoolMapper.listByExamAndSubjectId(examid, subjectid);//考试试卷
97
+        List<ERstudent> students = ePaperStudentMapper.listByExamAndSubjectId(examid, subjectid);//考试试卷学生
98
+        eReportGenerateService.setClassGradeRank(examid, papers, students, rank.getRranks(), createid);//生成考试等级报告
99
+        return eRclassRankMapper.listByExamId(rank);//考试等级报告列表
100
+    }
101
+
102
+    //行为分析-班级
103
+    public List<Map> listXwBj(ERstudentAction rank) {
104
+        return eReportSchoolMapper.listXwBj(rank);
105
+    }
106
+
107
+    //行为分析-学生
108
+    public List<Map> listXwXs(ERstudentAction rank) {
109
+        return eReportSchoolMapper.listXwXs(rank);
110
+    }
111
+
112
+    //违纪行为分析-详情
113
+    public List<Map> listWjXq(ERstudentAction rank) {
114
+        return eReportSchoolMapper.listWjXq(rank);
115
+    }
41 116
 }

+ 28
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/report/ERankParamVo.java View File

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sexam.vo.report;
2
+
3
+import com.xhkjedu.sexam.model.report.ERrank;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description 考试报告等级信息
10
+ * @Author ywx
11
+ * Date 2022/8/29 10:57
12
+ **/
13
+@Data
14
+public class ERankParamVo {
15
+
16
+    private Integer examid;//开始id
17
+
18
+    private Integer createid;//操作人id
19
+
20
+    private String subjectid;//科目id
21
+
22
+    private Integer classid;//班级id
23
+
24
+    //类型1等级2分数段3临界分4临界名次5优秀年级前6学困年级后
25
+    private Integer ranktype;
26
+
27
+    private List<ERrank> rranks;//等级
28
+}

+ 5
- 0
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml View File

@@ -195,6 +195,11 @@
195 195
         select classid,examid,subjectid,studentid,stuscore score,sstate
196 196
         from e_paper_student where examid=#{examid} and sstate!=0
197 197
     </select>
198
+    <!--考试试卷学生-->
199
+    <select id="listByExamAndSubjectId" resultType="com.xhkjedu.sexam.model.reportstu.ERstudent">
200
+        select classid,examid,subjectid,studentid,stuscore score,sstate
201
+        from e_paper_student where examid=#{examid} and subjectid=#{subjectid} and sstate!=0
202
+    </select>
198 203
 
199 204
     <!--更改单个学生试卷分值-->
200 205
     <update id="updateStuPaperscoreEpsid">

+ 15
- 0
sexam/src/main/resources/mapper/report/ERclassMapper.xml View File

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.reportclass.ERclassMapper">
4
+    <!--校级报告-成绩分析-->
5
+    <select id="listByExamId" resultType="java.util.Map">
6
+        select er.allscore,er.classmaxscore,er.classminscore,er.classavgscore,er.schoolmaxscore,er.schoolavgscore
7
+        ,er.stunum,er.missnum,er.yxrate,er.lhrate,er.jgrate,er.dfrate,er.bzc
8
+        ,er.classid,(case when er.classid=0 then '全部班级' else ec.classname end)classname
9
+        from e_rclass er left join e_class ec on er.examid = ec.examid and er.classid = ec.classid
10
+        where er.examid=#{rank.examid} and er.subjectid=#{rank.subjectid}
11
+        <if test="rank.classid!=null and rank.classid!=0">
12
+            and er.classid=#{rank.classid}
13
+        </if>
14
+    </select>
15
+</mapper>

+ 17
- 0
sexam/src/main/resources/mapper/report/ERclassRankMapper.xml View File

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.reportclass.ERclassRankMapper">
4
+    <!--校级报告-成绩分析-->
5
+    <select id="listByExamId" resultType="java.util.Map">
6
+        select err.ranktype,err.rankname,err.rankrange,err.stunum,err.stujson,err.sturate
7
+        ,err.classid,(case when err.classid=0 then '全部班级' else ec.classname end)classname
8
+        from e_rclass_rank err left join e_class ec on err.examid = ec.examid and err.classid = ec.classid
9
+        where err.examid=#{rank.examid} and err.subjectid=#{rank.subjectid}
10
+        <if test="rank.classid!=null and rank.classid!=0">
11
+            and err.classid=#{rank.classid}
12
+        </if>
13
+        <if test="rank.ranktype!=null and rank.ranktype!=0">
14
+            and err.ranktype=#{rank.ranktype}
15
+        </if>
16
+    </select>
17
+</mapper>

+ 16
- 0
sexam/src/main/resources/mapper/report/EReportGenerateMapper.xml View File

@@ -33,4 +33,20 @@
33 33
         where ecs.examid=#{examid} and ecs.examid!=er.examid and er.rsid is not null group by er.studentid,er.subjectid)a
34 34
         left join e_rstudent er on a.rsid=er.rsid
35 35
     </select>
36
+    <!--学生违纪行为-->
37
+    <select id="listBadActionByExamId" resultType="java.util.Map">
38
+        select studentid,classid,subjectid
39
+        ,count(case when bad=1 then epsqid else null end)num
40
+        from e_paper_student_question
41
+        where examid=#{examid} and bad=1
42
+        group by studentid, subjectid, bad
43
+    </select>
44
+    <!--学生优秀行为-->
45
+    <select id="listGoodActionByExamId" resultType="java.util.Map">
46
+        select studentid,classid,subjectid
47
+        ,count(case when good=1 then epsqid else null end)num
48
+        from e_paper_student_question
49
+        where examid=#{examid} and good=1
50
+        group by studentid, subjectid, good
51
+    </select>
36 52
 </mapper>

+ 42
- 0
sexam/src/main/resources/mapper/report/EReportSchoolMapper.xml View File

@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.report.EReportSchoolMapper">
4
+    <!--考试试卷-->
5
+    <select id="listByExamAndSubjectId" resultType="com.xhkjedu.sexam.vo.report.ERPaperVo">
6
+        select ep.subjectid,ep.pscore from e_paper ep where ep.examid=#{examid} and subjectid=#{subjectid}
7
+    </select>
8
+    <!--删除考试等级报告-->
9
+    <delete id="delByExamAndSubjectId">
10
+        delete from e_rclass_rank where examid=#{examid} and subjectid=#{subjectid} and ranktype=#{ranktype};
11
+        delete from e_rrank where examid=#{examid} and subjectid=#{subjectid} and ranktype=#{ranktype};
12
+    </delete>
13
+    <!--行为分析-班级-->
14
+    <select id="listXwBj" resultType="java.util.Map">
15
+        select ec.classname,ca.classid,ca.subjectjson
16
+        from e_rclass_action ca left join e_class ec on ca.examid = ec.examid and ca.classid = ec.classid
17
+        where ca.examid=#{rank.examid} and ca.actiontype=#{rank.actiontype}
18
+        <if test="rank.classid!=null and rank.classid!=0">
19
+            and ca.classid=#{rank.classid}
20
+        </if>
21
+    </select>
22
+    <!--行为分析-学生-->
23
+    <select id="listXwXs" resultType="java.util.Map">
24
+        select ec.classname,sa.classid,sa.studentid,sa.subjectjson,u.username,u.loginname
25
+        from e_rstudent_action sa left join e_class ec on sa.examid = ec.examid and sa.classid = ec.classid
26
+        left join t_user u on sa.studentid=u.userid
27
+        where sa.examid=#{rank.examid} and sa.actiontype=#{rank.actiontype}
28
+        <if test="rank.classid!=null and rank.classid!=0">
29
+            and sa.classid=#{rank.classid}
30
+        </if>
31
+        <if test="rank.createname!=null and rank.createname!=''">
32
+            and (u.username like '%${rank.createname}%' or u.loginname like '%${rank.createname}%')
33
+        </if>
34
+    </select>
35
+    <!--违纪行为分析-详情-->
36
+    <select id="listWjXq" resultType="java.util.Map">
37
+        select s.subjectname,sb.badtype,sb.picpath,sb.createtime
38
+        from e_subject_badstudent sb left join e_subject s on sb.esid=s.esid
39
+        where sb.examid=#{rank.examid} and sb.studentid=#{rank.studentid}
40
+        order by sb.esbsid
41
+    </select>
42
+</mapper>

Loading…
Cancel
Save