|
@@ -2,8 +2,7 @@ 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
|
+import com.xhkjedu.smarking.mapper.report.reportclass.*;
|
7
|
6
|
import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
|
8
|
7
|
import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
|
9
|
8
|
import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
|
|
@@ -12,8 +11,7 @@ import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
|
12
|
11
|
import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
|
13
|
12
|
import com.xhkjedu.smarking.model.exam.*;
|
14
|
13
|
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;
|
|
14
|
+import com.xhkjedu.smarking.model.report.reportclass.*;
|
17
|
15
|
import com.xhkjedu.smarking.model.report.reportother.MsrExam;
|
18
|
16
|
import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
|
19
|
17
|
import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
|
|
@@ -60,6 +58,8 @@ public class MsrExamService {
|
60
|
58
|
private MsrClassSubjectMapper msrClassSubjectMapper;
|
61
|
59
|
@Resource
|
62
|
60
|
private MsrClassTopMapper msrClassTopMapper;
|
|
61
|
+ @Resource
|
|
62
|
+ private MsrClassSubjectGradeMapper msrClassSubjectGradeMapper;
|
63
|
63
|
|
64
|
64
|
|
65
|
65
|
/**
|
|
@@ -87,7 +87,7 @@ public class MsrExamService {
|
87
|
87
|
}
|
88
|
88
|
|
89
|
89
|
//等级参数
|
90
|
|
- List<MsrReportparam> djParams = msrReportparamMapper.listReportparamByRpbelong(examid, "subjectshow", "");
|
|
90
|
+ List<MsrReportparam> djParams = msrReportparamMapper.listReportparamByRpbelong(examid, "subjectshow", "all");
|
91
|
91
|
List<SzJsonVo> djList = new ArrayList<>();
|
92
|
92
|
if (N_Utils.isListNotEmpty(djParams)) {
|
93
|
93
|
djList = JSON.parseArray(djParams.get(0).getSzjson(), SzJsonVo.class);
|
|
@@ -259,11 +259,7 @@ public class MsrExamService {
|
259
|
259
|
|
260
|
260
|
//科目班级分数分布区间分析、班级学科分析
|
261
|
261
|
//区间参数
|
262
|
|
- List<MsrReportparam> qjParams = msrReportparamMapper.listReportparamByRpbelong(examid, "scoresection", "xk");
|
263
|
|
- Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
|
264
|
|
- for (MsrReportparam param : qjParams) {
|
265
|
|
- qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
|
266
|
|
- }
|
|
262
|
+ Map<String, List<SzJsonVo>> qjMap = getReportParams(examid, "scoresection", "xk");
|
267
|
263
|
List<MsrSubjectClass> msrSubjectClasses = new ArrayList<>();//科目班级分数分布区间分析
|
268
|
264
|
List<MsrClassSubject> msrClassSubjects = new ArrayList<>();//班级学科分析
|
269
|
265
|
List<MsrClassTop> msrClassTops = new ArrayList<>();//班级学科前60分析
|
|
@@ -349,9 +345,80 @@ public class MsrExamService {
|
349
|
345
|
msrClassSubjectMapper.insertList(msrClassSubjects);
|
350
|
346
|
msrClassTopMapper.insertList(msrClassTops);
|
351
|
347
|
|
|
348
|
+ saveClassSubjectGrade(examid, "scorerate", "zh", msrStudents);//综合报告-班级学科四率等级分析
|
|
349
|
+ saveClassSubjectGrade(examid, "scorerate", "xj", msrStudents);//校级报告-班级学科四率等级分析
|
|
350
|
+
|
352
|
351
|
examMapper.updateExamState(examid, 3);
|
353
|
352
|
}
|
354
|
353
|
|
|
354
|
+ //班级学科四率等级分析
|
|
355
|
+ private void saveClassSubjectGrade(Integer examid, String rpbelong, String reportcode, List<MsrStudent> msrStudents) {
|
|
356
|
+ Map<String, List<SzJsonVo>> qjMap = getReportParams(examid, rpbelong, reportcode);
|
|
357
|
+ List<MsrClassSubjectGrade> msrClassSubjectGrades = new ArrayList<>();//班级学科分析
|
|
358
|
+ String subjectid;
|
|
359
|
+ int totalnum;
|
|
360
|
+ Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
|
|
361
|
+ List<Integer> nums = new ArrayList<>();
|
|
362
|
+ for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
|
|
363
|
+ String key = entry.getKey();
|
|
364
|
+ Integer classid = N_Utils.obj2Int(key.split("_")[0]);
|
|
365
|
+ subjectid = key.split("_")[1];
|
|
366
|
+ List<SzJsonVo> list = qjMap.get(subjectid);
|
|
367
|
+ List<MsrStudent> studentList = entry.getValue();
|
|
368
|
+ totalnum = studentList.size();//区间总人数
|
|
369
|
+ Double fullscore1 = studentList.get(0).getFullscore();
|
|
370
|
+ List<RankGroupVo> fdScore = MarkingUtil.fdScore(fullscore1, N_Utils.obj2Int(list.get(0).getDjvalue()));
|
|
371
|
+ for (RankGroupVo rg : fdScore) {
|
|
372
|
+ int minscore = rg.getMinvalue();
|
|
373
|
+ int maxscore = rg.getMaxvalue();
|
|
374
|
+ String qjname = rg.getGroupname();
|
|
375
|
+ double min = MarkingUtil.objToDouble(minscore);
|
|
376
|
+ double max = MarkingUtil.objToDouble(maxscore);
|
|
377
|
+ List<MsrStudent> qjstudents;
|
|
378
|
+ if (fullscore1.compareTo(max) == 0) {
|
|
379
|
+ qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0).collect(Collectors.toList());
|
|
380
|
+ } else {
|
|
381
|
+ qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0 && s.getStuscore().compareTo(max) < 0).collect(Collectors.toList());
|
|
382
|
+ }
|
|
383
|
+ int qjnum = qjstudents.size();
|
|
384
|
+ MsrClassSubjectGrade classSubjectGrade = new MsrClassSubjectGrade();
|
|
385
|
+ classSubjectGrade.setExamid(examid);
|
|
386
|
+ classSubjectGrade.setSubjectid(subjectid);
|
|
387
|
+ classSubjectGrade.setClassid(classid);
|
|
388
|
+ classSubjectGrade.setReportcode(reportcode);
|
|
389
|
+ classSubjectGrade.setRange(qjname);
|
|
390
|
+ classSubjectGrade.setRangenum(qjnum);
|
|
391
|
+ classSubjectGrade.setRangerate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
|
|
392
|
+ //double qjavg = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
|
|
393
|
+ //classSubjectGrade.setQjavgrate(N_Utils.getDoubleDivideAndMulitiply(qjavg, fullscore1));
|
|
394
|
+ String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
|
|
395
|
+ classSubjectGrade.setStuids(stuids);
|
|
396
|
+ msrClassSubjectGrades.add(classSubjectGrade);
|
|
397
|
+ nums.add(qjnum);
|
|
398
|
+ }
|
|
399
|
+ }
|
|
400
|
+ Map<Integer, Integer> rspm = MarkingUtil.rspm(nums);//人数排名
|
|
401
|
+ for (MsrClassSubjectGrade classSubjectGrade : msrClassSubjectGrades) {
|
|
402
|
+ int rangenum = classSubjectGrade.getRangenum();
|
|
403
|
+ int rank = rspm.get(rangenum);
|
|
404
|
+ classSubjectGrade.setRangenumrank(rank);
|
|
405
|
+ }
|
|
406
|
+ msrClassSubjectGradeMapper.insertList(msrClassSubjectGrades);
|
|
407
|
+ }
|
|
408
|
+
|
|
409
|
+ //获取报告参数
|
|
410
|
+ private Map<String, List<SzJsonVo>> getReportParams(Integer examid, String rpbelong, String reportcode) {
|
|
411
|
+ List<MsrReportparam> list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, reportcode);
|
|
412
|
+ if (N_Utils.isListEmpty(list)) {
|
|
413
|
+ list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, "all");
|
|
414
|
+ }
|
|
415
|
+ Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
|
|
416
|
+ for (MsrReportparam param : list) {
|
|
417
|
+ qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
|
|
418
|
+ }
|
|
419
|
+ return qjMap;
|
|
420
|
+ }
|
|
421
|
+
|
355
|
422
|
//设置科目分析计算参数
|
356
|
423
|
private void setSubject(MsrSubject msrSubject, List<MsrStudent> schoolStudents2) {
|
357
|
424
|
Double avgscore = msrSubject.getAvgscore();
|