|
@@ -2,7 +2,6 @@ package com.xhkjedu.sexam.service.report;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
4
|
import com.xhkjedu.sexam.mapper.exam.EClassMapper;
|
5
|
|
-import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
|
6
|
5
|
import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
|
7
|
6
|
import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
|
8
|
7
|
import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
|
|
@@ -14,28 +13,31 @@ import com.xhkjedu.sexam.mapper.reportclass.ERclassQtypeMapper;
|
14
|
13
|
import com.xhkjedu.sexam.mapper.reportclass.ERclassQuestionMapper;
|
15
|
14
|
import com.xhkjedu.sexam.mapper.reportclass.ERclassQuestionPointMapper;
|
16
|
15
|
import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
|
17
|
|
-import com.xhkjedu.sexam.model.paper.EPaperAnalyze;
|
18
|
16
|
import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
|
19
|
17
|
import com.xhkjedu.sexam.model.report.ERbase;
|
20
|
18
|
import com.xhkjedu.sexam.model.report.ERsubject;
|
21
|
19
|
import com.xhkjedu.sexam.model.reportclass.ERclass;
|
22
|
20
|
import com.xhkjedu.sexam.model.reportclass.ERclassQtype;
|
23
|
21
|
import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
|
24
|
|
-import com.xhkjedu.sexam.model.reportclass.ERclassQuestionPoint;
|
25
|
22
|
import com.xhkjedu.sexam.model.reportstu.ERstudent;
|
26
|
23
|
import com.xhkjedu.sexam.utils.ExamUtil;
|
27
|
24
|
import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
|
28
|
|
-import com.xhkjedu.sexam.vo.paper.EPaperQsVo;
|
29
|
25
|
import com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo;
|
30
|
26
|
import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
|
31
|
27
|
import com.xhkjedu.sexam.vo.report.ERClassScoreVo;
|
32
|
28
|
import com.xhkjedu.sexam.vo.report.ERPaperVo;
|
33
|
29
|
import com.xhkjedu.utils.N_Utils;
|
34
|
|
-
|
35
|
30
|
import org.springframework.beans.BeanUtils;
|
36
|
31
|
import org.springframework.stereotype.Service;
|
|
32
|
+import org.springframework.transaction.annotation.Transactional;
|
|
33
|
+
|
37
|
34
|
import javax.annotation.Resource;
|
38
|
|
-import java.util.*;
|
|
35
|
+import java.util.ArrayList;
|
|
36
|
+import java.util.Comparator;
|
|
37
|
+import java.util.DoubleSummaryStatistics;
|
|
38
|
+import java.util.HashMap;
|
|
39
|
+import java.util.List;
|
|
40
|
+import java.util.Map;
|
39
|
41
|
import java.util.stream.Collectors;
|
40
|
42
|
|
41
|
43
|
/**
|
|
@@ -56,8 +58,7 @@ public class EReportGenerateService {
|
56
|
58
|
private EPaperQtypeMapper ePaperQtypeMapper;
|
57
|
59
|
@Resource
|
58
|
60
|
private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
|
59
|
|
- @Resource
|
60
|
|
- private EPaperAnalyzeMapper ePaperAnalyzeMapper;
|
|
61
|
+
|
61
|
62
|
|
62
|
63
|
@Resource
|
63
|
64
|
private ERbaseMapper eRbaseMapper;
|
|
@@ -76,7 +77,13 @@ public class EReportGenerateService {
|
76
|
77
|
|
77
|
78
|
|
78
|
79
|
//生成考试报告
|
|
80
|
+ @Transactional(rollbackFor = Exception.class)
|
79
|
81
|
public void generateExamReport(Integer examid) {
|
|
82
|
+ //生成前先删除以前的考试报告
|
|
83
|
+ eReportGenerateMapper.deleteExamReport(examid);
|
|
84
|
+ //学生上次考试排名及目标
|
|
85
|
+ List<ERstudent> stuRankGoals = eReportGenerateMapper.listStuRankAndGoal(examid);
|
|
86
|
+
|
80
|
87
|
List<Map> classes = eClassMapper.listByExamId(examid);
|
81
|
88
|
List<Map> subjects = eReportGenerateMapper.listSubject(examid);
|
82
|
89
|
List<ERPaperVo> papers = eReportGenerateMapper.listPaper(examid);
|
|
@@ -158,9 +165,6 @@ public class EReportGenerateService {
|
158
|
165
|
Map<String, List<ERstudent>> subCollect = students.stream().collect(Collectors.groupingBy(s -> s.getSubjectid()));
|
159
|
166
|
List<ERsubject> subjectList = new ArrayList<>();//考试报告科目情况
|
160
|
167
|
List<ERclass> classList = new ArrayList<>();//考试报告班级情况
|
161
|
|
- List<ERclassQtype> qtypeList = new ArrayList<>();//考试报告班级题型情况
|
162
|
|
- List<ERclassQuestion> questionList = new ArrayList<>();//考试报告班级试题情况
|
163
|
|
- List<ERclassQuestionPoint> pointList = new ArrayList<>();//考试报告班级试题知识点情况
|
164
|
168
|
for (Map.Entry<String, List<ERstudent>> ssEntry : subCollect.entrySet()) {
|
165
|
169
|
subjectid = ssEntry.getKey();
|
166
|
170
|
subjectname = subjectMap.get(subjectid);
|
|
@@ -244,30 +248,6 @@ public class EReportGenerateService {
|
244
|
248
|
rc.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
|
245
|
249
|
rc.setBzc(ExamUtil.standardDiviation(scores));
|
246
|
250
|
classList.add(rc);
|
247
|
|
- List<EPaperQsVo> typelist = JSON.parseArray(rp.getQnumjson(), EPaperQsVo.class);
|
248
|
|
- for (EPaperQsVo t : typelist) {
|
249
|
|
- ERclassQtype rt = new ERclassQtype();
|
250
|
|
- rt.setExamid(examid);
|
251
|
|
- rt.setClassid(classid);
|
252
|
|
- rt.setSubjectid(subjectid);
|
253
|
|
- rt.setQtypename(t.getQtname());
|
254
|
|
- rt.setScore(t.getScore());
|
255
|
|
- rt.setNum(t.getNum());
|
256
|
|
- rt.setSrate(t.getSrate());
|
257
|
|
- qtypeList.add(rt);
|
258
|
|
- }
|
259
|
|
-
|
260
|
|
- List<Map> points = JSON.parseArray(rp.getQnumjson(), Map.class);
|
261
|
|
- for (Map p : points) {
|
262
|
|
- ERclassQuestionPoint rqp = new ERclassQuestionPoint();
|
263
|
|
- rqp.setExamid(examid);
|
264
|
|
- rqp.setClassid(classid);
|
265
|
|
- rqp.setSubjectid(subjectid);
|
266
|
|
- rqp.setPointname(p.get("pointname").toString());
|
267
|
|
- rqp.setScore((Double) p.get("score"));
|
268
|
|
- rqp.setSrate((Double) p.get("srate"));
|
269
|
|
- pointList.add(rqp);
|
270
|
|
- }
|
271
|
251
|
}
|
272
|
252
|
}
|
273
|
253
|
|
|
@@ -284,9 +264,11 @@ public class EReportGenerateService {
|
284
|
264
|
cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
|
285
|
265
|
cs.setClassmaxscore(classStatistics.getMax());
|
286
|
266
|
cs.setClassavgscore(classStatistics.getAverage());
|
287
|
|
- cs.setSchoolrank(schoolStuRank.get(studentid));
|
|
267
|
+ Integer schoolrank = schoolStuRank.get(studentid);
|
|
268
|
+ cs.setSchoolrank(schoolrank);
|
288
|
269
|
cs.setSchoolmaxscore(schoolStatisticsMax);
|
289
|
270
|
cs.setSchoolavgscore(schoolStatisticsAverage);
|
|
271
|
+ setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
|
290
|
272
|
}
|
291
|
273
|
eRstudentMapper.insertList(classStudents);
|
292
|
274
|
|
|
@@ -298,11 +280,30 @@ public class EReportGenerateService {
|
298
|
280
|
cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
|
299
|
281
|
cs.setClassmaxscore(cSStatistics.getMax());
|
300
|
282
|
cs.setClassavgscore(cSStatistics.getAverage());
|
301
|
|
- cs.setSchoolrank(schoolSubStuRank.get(subjectid + "_" + studentid));
|
|
283
|
+ Integer schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
|
|
284
|
+ cs.setSchoolrank(schoolrank);
|
302
|
285
|
cs.setSchoolmaxscore(sSStatistics.getMax());
|
303
|
286
|
cs.setSchoolavgscore(sSStatistics.getAverage());
|
|
287
|
+ setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
|
304
|
288
|
}
|
305
|
289
|
eRstudentMapper.insertList(classSubjectStudents);
|
|
290
|
+
|
|
291
|
+ setClassQuestion(examid, subjects, classes);//题型试题
|
|
292
|
+ }
|
|
293
|
+
|
|
294
|
+ //设置学生目标
|
|
295
|
+ private void setStuGoal(List<ERstudent> stuRankGoals, ERstudent cs, Integer schoolrank) {
|
|
296
|
+ String goalparam = "0.2";
|
|
297
|
+ ERstudent rg = stuRankGoals.stream().filter(s -> s.getStudentid().equals(cs.getStudentid())
|
|
298
|
+ && s.getSubjectid().equals(cs.getSubjectid())).findFirst().orElse(null);
|
|
299
|
+ Integer goal = 0;
|
|
300
|
+ Integer nextgoal = 0;
|
|
301
|
+ if (rg != null) {
|
|
302
|
+ goal = rg.getNextgoal();
|
|
303
|
+ nextgoal = ExamUtil.getUserGroupGoalByParam(schoolrank, goalparam);
|
|
304
|
+ }
|
|
305
|
+ cs.setGoal(goal);
|
|
306
|
+ cs.setNextgoal(nextgoal);
|
306
|
307
|
}
|
307
|
308
|
|
308
|
309
|
//分数排名
|
|
@@ -334,7 +335,7 @@ public class EReportGenerateService {
|
334
|
335
|
}
|
335
|
336
|
}
|
336
|
337
|
|
337
|
|
- //试卷题型、试题、知识点
|
|
338
|
+ //题型试题
|
338
|
339
|
private void setClassQuestion(Integer examid,List<Map> subjects,List<Map> classes){
|
339
|
340
|
//考试所有学生提交试卷情况
|
340
|
341
|
List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid);
|
|
@@ -460,26 +461,6 @@ public class EReportGenerateService {
|
460
|
461
|
rtypelist.add(eRclassQtype);
|
461
|
462
|
}
|
462
|
463
|
}
|
463
|
|
-
|
464
|
|
- if(ptype == 1){
|
465
|
|
- //获取试卷只是分析
|
466
|
|
- Map epa = ePaperAnalyzeMapper.getPaperAnalzyeByEpid(epid);
|
467
|
|
- String pointjson = epa.get("pointjson").toString();
|
468
|
|
- List<Map> pointlist = JSON.parseArray(pointjson,Map.class);
|
469
|
|
- //遍历知识点处理年级班级知识点情况
|
470
|
|
- for(int j=0;j<pointlist.size();j++){
|
471
|
|
- Map pointmap = pointlist.get(j);
|
472
|
|
- String pointname = pointmap.get("pointname").toString();
|
473
|
|
- Double score = Double.parseDouble(pointmap.get("score").toString());
|
474
|
|
- Double scorerate = Double.parseDouble(pointmap.get("scorerate").toString());
|
475
|
|
- String order = pointmap.get("order").toString();
|
476
|
|
-
|
477
|
|
-
|
478
|
|
- }
|
479
|
|
-
|
480
|
|
- }
|
481
|
|
-
|
482
|
|
-
|
483
|
464
|
}
|
484
|
465
|
eRclassQtypeMapper.insertList(rtypelist);
|
485
|
466
|
eRclassQuestionMapper.insertList(rqlist);
|