|
@@ -20,22 +20,25 @@ import com.xhkjedu.sexam.model.report.ERsubject;
|
20
|
20
|
import com.xhkjedu.sexam.model.reportclass.ERclass;
|
21
|
21
|
import com.xhkjedu.sexam.model.reportclass.ERclassQtype;
|
22
|
22
|
import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
|
23
|
|
-import com.xhkjedu.sexam.model.reportclass.ERclassQuestionError;
|
24
|
|
-import com.xhkjedu.sexam.model.reportclass.ERclassQuestionPoint;
|
25
|
23
|
import com.xhkjedu.sexam.model.reportstu.ERstudent;
|
26
|
24
|
import com.xhkjedu.sexam.utils.ExamUtil;
|
27
|
25
|
import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
|
28
|
|
-import com.xhkjedu.sexam.vo.paper.EPaperQsVo;
|
29
|
26
|
import com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo;
|
30
|
27
|
import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
|
31
|
28
|
import com.xhkjedu.sexam.vo.report.ERClassScoreVo;
|
32
|
29
|
import com.xhkjedu.sexam.vo.report.ERPaperVo;
|
33
|
30
|
import com.xhkjedu.utils.N_Utils;
|
34
|
|
-
|
35
|
31
|
import org.springframework.beans.BeanUtils;
|
36
|
32
|
import org.springframework.stereotype.Service;
|
|
33
|
+import org.springframework.transaction.annotation.Transactional;
|
|
34
|
+
|
37
|
35
|
import javax.annotation.Resource;
|
38
|
|
-import java.util.*;
|
|
36
|
+import java.util.ArrayList;
|
|
37
|
+import java.util.Comparator;
|
|
38
|
+import java.util.DoubleSummaryStatistics;
|
|
39
|
+import java.util.HashMap;
|
|
40
|
+import java.util.List;
|
|
41
|
+import java.util.Map;
|
39
|
42
|
import java.util.stream.Collectors;
|
40
|
43
|
|
41
|
44
|
/**
|
|
@@ -77,7 +80,13 @@ public class EReportGenerateService {
|
77
|
80
|
|
78
|
81
|
|
79
|
82
|
//生成考试报告
|
|
83
|
+ @Transactional(rollbackFor = Exception.class)
|
80
|
84
|
public void generateExamReport(Integer examid) {
|
|
85
|
+ //生成前先删除以前的考试报告
|
|
86
|
+ eReportGenerateMapper.deleteExamReport(examid);
|
|
87
|
+ //学生上次考试排名及目标
|
|
88
|
+ List<ERstudent> stuRankGoals = eReportGenerateMapper.listStuRankAndGoal(examid);
|
|
89
|
+
|
81
|
90
|
List<Map> classes = eClassMapper.listByExamId(examid);
|
82
|
91
|
List<Map> subjects = eReportGenerateMapper.listSubject(examid);
|
83
|
92
|
List<ERPaperVo> papers = eReportGenerateMapper.listPaper(examid);
|
|
@@ -159,10 +168,6 @@ public class EReportGenerateService {
|
159
|
168
|
Map<String, List<ERstudent>> subCollect = students.stream().collect(Collectors.groupingBy(s -> s.getSubjectid()));
|
160
|
169
|
List<ERsubject> subjectList = new ArrayList<>();//考试报告科目情况
|
161
|
170
|
List<ERclass> classList = new ArrayList<>();//考试报告班级情况
|
162
|
|
- List<ERclassQtype> qtypeList = new ArrayList<>();//考试报告班级题型情况
|
163
|
|
- List<ERclassQuestion> questionList = new ArrayList<>();//考试报告班级试题情况
|
164
|
|
- List<ERclassQuestionError> errorList = new ArrayList<>();//考试报告班级高频错题情况
|
165
|
|
- List<ERclassQuestionPoint> pointList = new ArrayList<>();//考试报告班级试题知识点情况
|
166
|
171
|
for (Map.Entry<String, List<ERstudent>> ssEntry : subCollect.entrySet()) {
|
167
|
172
|
subjectid = ssEntry.getKey();
|
168
|
173
|
subjectname = subjectMap.get(subjectid);
|
|
@@ -246,30 +251,6 @@ public class EReportGenerateService {
|
246
|
251
|
rc.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
|
247
|
252
|
rc.setBzc(ExamUtil.standardDiviation(scores));
|
248
|
253
|
classList.add(rc);
|
249
|
|
- List<EPaperQsVo> typelist = JSON.parseArray(rp.getQnumjson(), EPaperQsVo.class);
|
250
|
|
- for (EPaperQsVo t : typelist) {
|
251
|
|
- ERclassQtype rt = new ERclassQtype();
|
252
|
|
- rt.setExamid(examid);
|
253
|
|
- rt.setClassid(classid);
|
254
|
|
- rt.setSubjectid(subjectid);
|
255
|
|
- rt.setQtypename(t.getQtname());
|
256
|
|
- rt.setScore(t.getScore());
|
257
|
|
- rt.setNum(t.getNum());
|
258
|
|
- rt.setSrate(t.getSrate());
|
259
|
|
- qtypeList.add(rt);
|
260
|
|
- }
|
261
|
|
-
|
262
|
|
- List<Map> points = JSON.parseArray(rp.getQnumjson(), Map.class);
|
263
|
|
- for (Map p : points) {
|
264
|
|
- ERclassQuestionPoint rqp = new ERclassQuestionPoint();
|
265
|
|
- rqp.setExamid(examid);
|
266
|
|
- rqp.setClassid(classid);
|
267
|
|
- rqp.setSubjectid(subjectid);
|
268
|
|
- rqp.setPointname(p.get("pointname").toString());
|
269
|
|
- rqp.setScore((Double) p.get("score"));
|
270
|
|
- rqp.setSrate((Double) p.get("srate"));
|
271
|
|
- pointList.add(rqp);
|
272
|
|
- }
|
273
|
254
|
}
|
274
|
255
|
}
|
275
|
256
|
|
|
@@ -286,9 +267,11 @@ public class EReportGenerateService {
|
286
|
267
|
cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
|
287
|
268
|
cs.setClassmaxscore(classStatistics.getMax());
|
288
|
269
|
cs.setClassavgscore(classStatistics.getAverage());
|
289
|
|
- cs.setSchoolrank(schoolStuRank.get(studentid));
|
|
270
|
+ Integer schoolrank = schoolStuRank.get(studentid);
|
|
271
|
+ cs.setSchoolrank(schoolrank);
|
290
|
272
|
cs.setSchoolmaxscore(schoolStatisticsMax);
|
291
|
273
|
cs.setSchoolavgscore(schoolStatisticsAverage);
|
|
274
|
+ setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
|
292
|
275
|
}
|
293
|
276
|
eRstudentMapper.insertList(classStudents);
|
294
|
277
|
|
|
@@ -300,11 +283,30 @@ public class EReportGenerateService {
|
300
|
283
|
cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
|
301
|
284
|
cs.setClassmaxscore(cSStatistics.getMax());
|
302
|
285
|
cs.setClassavgscore(cSStatistics.getAverage());
|
303
|
|
- cs.setSchoolrank(schoolSubStuRank.get(subjectid + "_" + studentid));
|
|
286
|
+ Integer schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
|
|
287
|
+ cs.setSchoolrank(schoolrank);
|
304
|
288
|
cs.setSchoolmaxscore(sSStatistics.getMax());
|
305
|
289
|
cs.setSchoolavgscore(sSStatistics.getAverage());
|
|
290
|
+ setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
|
306
|
291
|
}
|
307
|
292
|
eRstudentMapper.insertList(classSubjectStudents);
|
|
293
|
+
|
|
294
|
+ setClassQuestion(examid, subjects, classes);//题型试题
|
|
295
|
+ }
|
|
296
|
+
|
|
297
|
+ //设置学生目标
|
|
298
|
+ private void setStuGoal(List<ERstudent> stuRankGoals, ERstudent cs, Integer schoolrank) {
|
|
299
|
+ String goalparam = "0.2";
|
|
300
|
+ ERstudent rg = stuRankGoals.stream().filter(s -> s.getStudentid().equals(cs.getStudentid())
|
|
301
|
+ && s.getSubjectid().equals(cs.getSubjectid())).findFirst().orElse(null);
|
|
302
|
+ Integer goal = 0;
|
|
303
|
+ Integer nextgoal = 0;
|
|
304
|
+ if (rg != null) {
|
|
305
|
+ goal = rg.getNextgoal();
|
|
306
|
+ nextgoal = ExamUtil.getUserGroupGoalByParam(schoolrank, goalparam);
|
|
307
|
+ }
|
|
308
|
+ cs.setGoal(goal);
|
|
309
|
+ cs.setNextgoal(nextgoal);
|
308
|
310
|
}
|
309
|
311
|
|
310
|
312
|
//分数排名
|