Browse Source

校级pdf报告

tags/正式版本
雍文秀 2 years ago
parent
commit
e8dfad31da

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

19
 import org.springframework.web.bind.annotation.RestController;
19
 import org.springframework.web.bind.annotation.RestController;
20
 
20
 
21
 import javax.annotation.Resource;
21
 import javax.annotation.Resource;
22
+import java.util.HashMap;
22
 import java.util.List;
23
 import java.util.List;
23
 import java.util.Map;
24
 import java.util.Map;
25
+import java.util.stream.Collectors;
24
 
26
 
25
 /**
27
 /**
26
  * @author ywx
28
  * @author ywx
208
         return new ResultVo(0, "获取成功", pageResult);
210
         return new ResultVo(0, "获取成功", pageResult);
209
     }
211
     }
210
 
212
 
213
+    /**
214
+     * pdf报告
215
+     *
216
+     * @return com.xhkjedu.vo.ResultVo
217
+     * @Param [rank]
218
+     * @Author ywx
219
+     * @Date 2022/10/9 14:45
220
+     **/
221
+    @PostMapping("/pdf")
222
+    public ResultVo toPdf(@RequestBody ERankParamVo rank) {
223
+        Integer examid = rank.getExamid();
224
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
225
+        Map map = new HashMap();
226
+        Map ksgk = eReportSchoolService.getKsGk(examid);
227
+        map.put("ksgk", ksgk);//考试概况
228
+        List<Map> cjfxList = eReportSchoolService.listCjFxBjCj(rank);
229
+        Map<String, List<Map>> cjfx = cjfxList.stream().collect(Collectors.groupingBy(c -> c.get("subjectname").toString()));
230
+        map.put("cjfx", cjfx);//成绩分析
231
+        List<Map> subjects = (List<Map>) ksgk.get("subjects");
232
+        Map<String, String> subjectMap = subjects.stream().collect(Collectors.toMap(s -> s.get("subjectid").toString(),
233
+                s -> s.get("subjectname").toString()));
234
+        List<Map> djfx = eReportSchoolService.listCjFxByExamId(examid);//考试班级等级分析
235
+        for (Map rc : djfx) {
236
+            rc.put("subjectname", subjectMap.get(rc.get("subjectid").toString()));
237
+        }
238
+        map.put("djfx", djfx);//成绩分析-等级分析
239
+        List<Map> xwList = eReportSchoolService.listXwBjByExamId(examid);
240
+        List<Map> wjxw = xwList.stream().filter(x -> x.get("actiontype").toString().equals("1")).collect(Collectors.toList());
241
+        map.put("wjfx", wjxw);//违纪行为分析
242
+        List<Map> yxsj = xwList.stream().filter(x -> x.get("actiontype").toString().equals("2")).collect(Collectors.toList());
243
+        map.put("yxsj", yxsj);//优秀试卷分析
244
+        return new ResultVo(0, "获取成功", map);
245
+    }
211
 }
246
 }

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

33
 
33
 
34
     //已结束考试
34
     //已结束考试
35
     List<Map> listEndExams(@Param("ebase") EBase ebase);
35
     List<Map> listEndExams(@Param("ebase") EBase ebase);
36
+
37
+    //行为分析-班级
38
+    List<Map> listXwBjByExamId(@Param("examid") Integer examid);
39
+
40
+    //考试班级等级分布
41
+    List<Map> listCjFxByExamId(@Param("examid") Integer examid);
42
+
43
+    //考试等级分类
44
+    List<Map> listRankByExamId(@Param("examid") Integer examid);
36
 }
45
 }

+ 25
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportSchoolService.java View File

68
         Map map = eRclassRankMapper.getRank(rank);
68
         Map map = eRclassRankMapper.getRank(rank);
69
         List<Map> ranks = eRclassRankMapper.listByExamId(rank);
69
         List<Map> ranks = eRclassRankMapper.listByExamId(rank);
70
         Integer ranktype = rank.getRanktype();
70
         Integer ranktype = rank.getRanktype();
71
+        setClassRank(map, ranks, ranktype);//处理班级报告等级分布数据
72
+        return map;
73
+    }
74
+
75
+    //处理班级报告等级分布数据
76
+    private void setClassRank(Map map, List<Map> ranks, Integer ranktype) {
71
         if (1 == ranktype) {//等级
77
         if (1 == ranktype) {//等级
72
             Map<Object, List<Map>> collect = ranks.stream().collect(Collectors.groupingBy(r -> r.get("rankname"),
78
             Map<Object, List<Map>> collect = ranks.stream().collect(Collectors.groupingBy(r -> r.get("rankname"),
73
                     LinkedHashMap::new, Collectors.toList()));
79
                     LinkedHashMap::new, Collectors.toList()));
110
             }
116
             }
111
         }
117
         }
112
         map.put("ranks", ranks);
118
         map.put("ranks", ranks);
113
-        return map;
114
     }
119
     }
115
 
120
 
116
     //成绩分析-等级统计设置
121
     //成绩分析-等级统计设置
145
     }
150
     }
146
 
151
 
147
     //校级报告--已结束考试列表
152
     //校级报告--已结束考试列表
148
-    public List<Map> listEndExams(EBase eBase){
153
+    public List<Map> listEndExams(EBase eBase) {
149
         return eReportSchoolMapper.listEndExams(eBase);
154
         return eReportSchoolMapper.listEndExams(eBase);
150
     }
155
     }
151
 
156
 
157
+    //行为分析-班级
158
+    public List<Map> listXwBjByExamId(Integer examid) {
159
+        return eReportSchoolMapper.listXwBjByExamId(examid);
160
+    }
161
+
162
+    //考试班级等级分析
163
+    public List<Map> listCjFxByExamId(Integer examid) {
164
+        List<Map> ranks = eReportSchoolMapper.listRankByExamId(examid);
165
+        List<Map> list = eReportSchoolMapper.listCjFxByExamId(examid);
166
+        for (Map map : ranks) {
167
+            Integer ranktype = (Integer) map.get("ranktype");
168
+            Object subjectid = map.get("subjectid");
169
+            List<Map> list2 = list.stream().filter(l -> l.get("ranktype").equals(ranktype)
170
+                    && l.get("subjectid").equals(subjectid)).collect(Collectors.toList());
171
+            setClassRank(map, list2, ranktype);
172
+        }
173
+        return ranks;
174
+    }
152
 }
175
 }

+ 5
- 2
sexam/src/main/resources/mapper/report/ERclassMapper.xml View File

4
     <!--校级报告-成绩分析-->
4
     <!--校级报告-成绩分析-->
5
     <select id="listByExamId" resultType="java.util.Map">
5
     <select id="listByExamId" resultType="java.util.Map">
6
         select er.allscore,er.classmaxscore,er.classminscore,er.classavgscore,er.schoolmaxscore,er.schoolavgscore
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,er.qkbzc
7
+        ,er.stunum,er.missnum,er.yxrate,er.lhrate,er.jgrate,er.dfrate,er.bzc,er.qkbzc,er.subjectname
8
         ,er.classid,(case when er.classid=0 then '全部班级' else ec.classname end)classname
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
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}
10
+        where er.examid=#{rank.examid}
11
+        <if test="rank.subjectid!=null and rank.subjectid!=''">
12
+            and er.subjectid=#{rank.subjectid}
13
+        </if>
11
         <if test="rank.classid!=null and rank.classid!=0">
14
         <if test="rank.classid!=null and rank.classid!=0">
12
             and er.classid=#{rank.classid}
15
             and er.classid=#{rank.classid}
13
         </if>
16
         </if>

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

83
         </if>
83
         </if>
84
         order by e.examdate desc, s.esid asc
84
         order by e.examdate desc, s.esid asc
85
     </select>
85
     </select>
86
+    <!--行为分析-班级-->
87
+    <select id="listXwBjByExamId" resultType="java.util.Map">
88
+        select ec.classname,ca.classid,ca.subjectjson,ca.actiontype
89
+        from e_rclass_action ca left join e_class ec on ca.examid = ec.examid and ca.classid = ec.classid
90
+        where ca.examid=#{examid}
91
+    </select>
92
+    <!--考试班级等级分布-->
93
+    <select id="listCjFxByExamId" resultType="java.util.Map">
94
+        select err.ranktype,err.rankname,err.rankrange,err.stunum,err.sturate,err.subjectid
95
+        ,(case when err.ranktype>=3 then err.stujson else '' end)stujson
96
+        ,err.classid,(case when err.classid=0 then '全部班级' else ec.classname end)classname
97
+        from e_rclass_rank err left join e_class ec on err.examid = ec.examid and err.classid = ec.classid
98
+        where err.examid=#{examid}
99
+    </select>
100
+    <!--考试等级分类-->
101
+    <select id="listRankByExamId" resultType="java.util.Map">
102
+        select rankname,maxscore,minscore,linescore,floatscore,subjectid,ranktype
103
+        from e_rrank where examid=#{examid}
104
+        group by subjectid,ranktype order by rankid
105
+    </select>
86
 </mapper>
106
 </mapper>

Loading…
Cancel
Save