|
@@ -2,6 +2,8 @@ package com.xhkjedu.smarking.service.report.reportother;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
4
|
import com.xhkjedu.smarking.mapper.exam.*;
|
|
5
|
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectMapper;
|
|
6
|
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassTopMapper;
|
5
|
7
|
import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
|
6
|
8
|
import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
|
7
|
9
|
import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
|
|
@@ -10,12 +12,15 @@ import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
|
10
|
12
|
import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
|
11
|
13
|
import com.xhkjedu.smarking.model.exam.*;
|
12
|
14
|
import com.xhkjedu.smarking.model.paper.MsPaper;
|
|
15
|
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubject;
|
|
16
|
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassTop;
|
13
|
17
|
import com.xhkjedu.smarking.model.report.reportother.MsrExam;
|
14
|
18
|
import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
|
15
|
19
|
import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
|
16
|
20
|
import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
|
17
|
21
|
import com.xhkjedu.smarking.model.report.reportsubject.MsrSubjectClass;
|
18
|
22
|
import com.xhkjedu.smarking.utils.MarkingUtil;
|
|
23
|
+import com.xhkjedu.smarking.vo.report.reportclass.ClassTopVo;
|
19
|
24
|
import com.xhkjedu.smarking.vo.report.reportother.StuRankVo;
|
20
|
25
|
import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
|
21
|
26
|
import com.xhkjedu.utils.N_Utils;
|
|
@@ -52,6 +57,11 @@ public class MsrExamService {
|
52
|
57
|
private MsrReportparamMapper msrReportparamMapper;
|
53
|
58
|
@Resource
|
54
|
59
|
private MsrSubjectClassMapper msrSubjectClassMapper;
|
|
60
|
+ @Resource
|
|
61
|
+ private MsrClassSubjectMapper msrClassSubjectMapper;
|
|
62
|
+ @Resource
|
|
63
|
+ private MsrClassTopMapper msrClassTopMapper;
|
|
64
|
+
|
55
|
65
|
|
56
|
66
|
/**
|
57
|
67
|
* @Description 生成报告
|
|
@@ -248,14 +258,28 @@ public class MsrExamService {
|
248
|
258
|
msrStudents.addAll(classSubjectStudents);
|
249
|
259
|
if (N_Utils.isListNotEmpty(msrStudents)) msrStudentMapper.insertList(msrStudents);
|
250
|
260
|
|
251
|
|
- //科目班级分数分布区间分析
|
|
261
|
+ //科目班级分数分布区间分析、班级学科分析
|
252
|
262
|
//区间参数
|
253
|
|
- List<MsrReportparam> qjParams = msrReportparamMapper.listReportparamByRpbelong(examid, "scoresection", "");
|
|
263
|
+ List<MsrReportparam> qjParams = msrReportparamMapper.listReportparamByRpbelong(examid, "scoresection", "xk");
|
254
|
264
|
Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
|
255
|
265
|
for (MsrReportparam param : qjParams) {
|
256
|
266
|
qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
|
257
|
267
|
}
|
258
|
|
- List<MsrSubjectClass> msrSubjectClasses = new ArrayList<>();
|
|
268
|
+ List<MsrSubjectClass> msrSubjectClasses = new ArrayList<>();//科目班级分数分布区间分析
|
|
269
|
+ List<MsrClassSubject> msrClassSubjects = new ArrayList<>();//班级学科分析
|
|
270
|
+ List<MsrClassTop> msrClassTops = new ArrayList<>();//班级学科前60分析
|
|
271
|
+ Map<String, ClassTopVo> lsMap = new HashMap<>();//处于年级60%得分map
|
|
272
|
+ for (MsrSubject subject : msrSubjects) {
|
|
273
|
+ Double lsscore = subject.getLsscore();
|
|
274
|
+ String subjectid1 = subject.getSubjectid();
|
|
275
|
+ List<MsrStudent> lsstudents = msrStudents.stream().filter(s -> s.getSubjectid().equals(subjectid1) && s.getStuscore().compareTo(lsscore) >= 0).collect(Collectors.toList());
|
|
276
|
+ ClassTopVo classTopVo = new ClassTopVo();
|
|
277
|
+ classTopVo.setSubjectid(subjectid1);
|
|
278
|
+ classTopVo.setLsscore(lsscore);
|
|
279
|
+ classTopVo.setXtnum(lsstudents.size());
|
|
280
|
+ double average = lsstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
|
|
281
|
+ classTopVo.setXtavgscore(N_Utils.formatDouble(average, 2));
|
|
282
|
+ }
|
259
|
283
|
Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
|
260
|
284
|
for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
|
261
|
285
|
String key = entry.getKey();
|
|
@@ -263,17 +287,62 @@ public class MsrExamService {
|
263
|
287
|
subjectid = key.split("_")[1];
|
264
|
288
|
List<SzJsonVo> list = qjMap.get(subjectid);
|
265
|
289
|
List<MsrStudent> studentList = entry.getValue();
|
266
|
|
- for (SzJsonVo vo : list) {
|
267
|
|
- Object djvalue = vo.getDjvalue();
|
|
290
|
+ totalnum = studentList.size();//区间总人数
|
|
291
|
+ Double fullscore1 = studentList.get(0).getFullscore();
|
|
292
|
+ List<int[]> fdScore = MarkingUtil.fdScore(fullscore1, N_Utils.obj2Int(list.get(0).getDjvalue()));
|
|
293
|
+ for (int[] scores : fdScore) {
|
|
294
|
+ int minscore = scores[0];
|
|
295
|
+ int maxscore = scores[1];
|
|
296
|
+ String qjname = "[" + minscore + "," + maxscore;
|
|
297
|
+ double min = MarkingUtil.objToDouble(minscore);
|
|
298
|
+ double max = MarkingUtil.objToDouble(maxscore);
|
|
299
|
+ List<MsrStudent> qjstudents;
|
|
300
|
+ if (fullscore1.compareTo(max) == 0) {
|
|
301
|
+ qjname += "]";
|
|
302
|
+ qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0).collect(Collectors.toList());
|
|
303
|
+ } else {
|
|
304
|
+ qjname += ")";
|
|
305
|
+ qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0 && s.getStuscore().compareTo(max) < 0).collect(Collectors.toList());
|
|
306
|
+ }
|
|
307
|
+ int qjnum = qjstudents.size();
|
268
|
308
|
MsrSubjectClass msrSubjectClass = new MsrSubjectClass();
|
269
|
309
|
msrSubjectClass.setExamid(examid);
|
270
|
|
- msrSubjectClass.setClassid(classid);
|
271
|
310
|
msrSubjectClass.setSubjectid(subjectid);
|
272
|
|
- msrSubjectClass.setQjname(vo.getDjkey());
|
|
311
|
+ msrSubjectClass.setClassid(classid);
|
|
312
|
+ msrSubjectClass.setQjname(qjname);
|
|
313
|
+ msrSubjectClass.setQjnum(qjnum);
|
|
314
|
+ msrSubjectClass.setQjrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
|
|
315
|
+ double qjavg = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
|
|
316
|
+ msrSubjectClass.setQjavgrate(N_Utils.getDoubleDivideAndMulitiply(qjavg, fullscore1));
|
273
|
317
|
msrSubjectClasses.add(msrSubjectClass);
|
274
|
318
|
}
|
|
319
|
+
|
|
320
|
+ MsrClassSubject msrClassSubject = new MsrClassSubject();
|
|
321
|
+ msrClassSubject.setExamid(examid);
|
|
322
|
+ msrClassSubject.setSubjectid(subjectid);
|
|
323
|
+ msrClassSubject.setClassid(classid);
|
|
324
|
+ msrClassSubject.setFullscore(fullscore1);
|
|
325
|
+ msrClassSubjects.add(msrClassSubject);
|
|
326
|
+
|
|
327
|
+ MsrClassTop msrClassTop = new MsrClassTop();
|
|
328
|
+ msrClassTop.setExamid(examid);
|
|
329
|
+ msrClassTop.setClassid(classid);
|
|
330
|
+ msrClassTop.setSubjectid(subjectid);
|
|
331
|
+ msrClassTop.setStunum(totalnum);
|
|
332
|
+ ClassTopVo classTopVo = lsMap.get(subjectid);//处于年级60%得分
|
|
333
|
+ Double lsscore = classTopVo.getLsscore();
|
|
334
|
+ List<MsrStudent> lsstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(lsscore) >= 0).collect(Collectors.toList());
|
|
335
|
+ msrClassTop.setBtnum(lsstudents.size());
|
|
336
|
+ msrClassTop.setBtrate(N_Utils.getIntegerDivideAndMulitiply(msrClassTop.getBtnum(), totalnum));
|
|
337
|
+ double average = lsstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
|
|
338
|
+ msrClassTop.setBtavgscore(N_Utils.formatDouble(average, 2));
|
|
339
|
+ msrClassTop.setXtnum(classTopVo.getXtnum());
|
|
340
|
+ msrClassTop.setXtavgscore(classTopVo.getXtavgscore());
|
|
341
|
+ msrClassTops.add(msrClassTop);
|
275
|
342
|
}
|
276
|
343
|
msrSubjectClassMapper.insertList(msrSubjectClasses);
|
|
344
|
+ msrClassSubjectMapper.insertList(msrClassSubjects);
|
|
345
|
+ msrClassTopMapper.insertList(msrClassTops);
|
277
|
346
|
|
278
|
347
|
examMapper.updateExamState(examid, 3);
|
279
|
348
|
}
|