Browse Source

班级报告-成绩等级分析科目排序

学生报告-报告概况-成绩单提交情况
班级报告-单科概况-等级统计
tags/正式版本
雍文秀 2 years ago
parent
commit
140796f0a7

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

@@ -20,4 +20,7 @@ public interface ERclassRankMapper extends TkMapper<ERclassRank> {
20 20
 
21 21
     //获取等级分类
22 22
     Map getRank(@Param("rank") ERankParamVo rank);
23
+
24
+    //获取科目集合
25
+    List<Map> listSubjectByIds(@Param("subjectids") List<String> subjectids);
23 26
 }

+ 20
- 5
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportClassService.java View File

@@ -17,10 +17,7 @@ import org.springframework.stereotype.Service;
17 17
 import org.springframework.transaction.annotation.Transactional;
18 18
 
19 19
 import javax.annotation.Resource;
20
-import java.util.ArrayList;
21
-import java.util.HashMap;
22
-import java.util.List;
23
-import java.util.Map;
20
+import java.util.*;
24 21
 import java.util.stream.Collectors;
25 22
 
26 23
 /**
@@ -58,7 +55,25 @@ public class EReportClassService {
58 55
 
59 56
     //成绩分析-搜索
60 57
     public List<Map> listCjFxForSearch(ERankParamVo rank) {
61
-        return eRclassRankMapper.listByExamAndClassId(rank);
58
+        List<Map> list = eRclassRankMapper.listByExamAndClassId(rank);
59
+        if (N_Utils.isListEmpty(list)) return list;
60
+        //结果按照科目排序
61
+        List<String> subjectids = list.stream().map(m -> m.get("subjectid").toString()).distinct().collect(Collectors.toList());
62
+        List<Map> subjects = eRclassRankMapper.listSubjectByIds(subjectids);
63
+        Map<Object, Map> smap = subjects.stream().collect(Collectors.toMap(s -> s.get("subjectid"), s -> s));
64
+        if (smap == null) smap = new HashMap<>();
65
+        Map zf = new HashMap();
66
+        zf.put("subjectid", "zf");
67
+        zf.put("subjectname", "总分");
68
+        zf.put("subjectorder", 0);
69
+        smap.put("zf", zf);
70
+        for (Map map : list) {
71
+            Map s = smap.get(map.get("subjectid"));
72
+            map.put("subjectname", s.get("subjectname"));
73
+            map.put("subjectorder", s.get("subjectorder"));
74
+        }
75
+        list = list.stream().sorted(Comparator.comparing(s -> (int) s.get("subjectorder"))).collect(Collectors.toList());
76
+        return list;
62 77
     }
63 78
 
64 79
     //成绩分析-设置

+ 10
- 3
sexam/src/main/resources/mapper/report/ERclassRankMapper.xml View File

@@ -24,8 +24,7 @@
24 24
     <select id="listByExamAndClassId" resultType="java.util.Map">
25 25
         select err.ranktype,err.rankname,err.rankrange,err.stunum,err.stujson,err.sturate
26 26
         ,err.classid,(case when err.classid=0 then '全部班级' else ec.classname end)classname
27
-        ,(case when err.subjectid='zf' then '总分' else (select s.subjectname from t_subject s where
28
-        err.subjectid=s.subjectid) end)subjectname
27
+        ,err.subjectid
29 28
         from e_rclass_rank err left join e_class ec on err.examid = ec.examid and err.classid = ec.classid
30 29
         where err.examid=#{rank.examid} and err.classid=#{rank.classid}
31 30
         <if test="rank.ranktype!=null and rank.ranktype!=0">
@@ -37,7 +36,7 @@
37 36
     </select>
38 37
     <!--班级报告-单科概况-等级统计-->
39 38
     <select id="listDkGkDjTj" resultType="java.util.Map">
40
-        select err.ranktype,err.rankname,err.stunum,err.stujson,err.sturate
39
+        select err.ranktype,err.rankname,err.stunum,err.stujson,err.sturate,er.minscore,er.maxscore
41 40
         ,(case when er.linescore is null then '' else concat(er.linescore,'-',er.floatscore) end)rankrange
42 41
         from e_rclass_rank err left join e_rrank er on err.examid = er.examid and err.subjectid = er.subjectid
43 42
         and er.ranktype=1 and er.rankname=err.rankname
@@ -56,4 +55,12 @@
56 55
         </if>
57 56
         limit 1
58 57
     </select>
58
+    <!--获取科目集合-->
59
+    <select id="listSubjectByIds" resultType="java.util.Map">
60
+        select subjectid,subjectname,subjectorder
61
+        from t_subject where subjectid in
62
+        <foreach collection="subjectids" item="subjectid" open="(" separator="," close=")">
63
+            #{subjectid}
64
+        </foreach>
65
+    </select>
59 66
 </mapper>

+ 7
- 2
sexam/src/main/resources/mapper/report/ERstudentMapper.xml View File

@@ -39,8 +39,13 @@
39 39
 
40 40
     <!--学生报告-报告概况-获取学生单次考试情况-->
41 41
     <select id="getStudentScoreByExamid" resultType="java.util.Map">
42
-        select rs.* from e_rstudent rs
43
-                             left join t_subject s on rs.subjectid=s.subjectid
42
+        select rs.*,eps.device,eps.submittype,eps.endtime
43
+        ,(case when rs.subjectid='zf' then (select (
44
+        case when count(eps2.epsid)=count(case when eps2.sstate=3 then eps2.epsid else null end) then 3 else 2 end)
45
+        from e_paper_student eps2 where eps2.examid=rs.examid and eps2.studentid=rs.studentid)
46
+        else eps.sstate end)sstate
47
+        from e_rstudent rs left join t_subject s on rs.subjectid=s.subjectid
48
+        left join e_paper_student eps on rs.examid=eps.examid and rs.subjectid=eps.subjectid and rs.studentid=eps.studentid
44 49
         where rs.examid=#{examid} and rs.studentid=#{studentid} order by s.subjectorder
45 50
     </select>
46 51
     <!--学生报告-报告概况-获取学生单次考试情况(学生无报告)-->

Loading…
Cancel
Save