|
@@ -14,6 +14,7 @@ import com.xhkjedu.sexam.mapper.report.ERsubjectMapper;
|
14
|
14
|
import com.xhkjedu.sexam.mapper.reportclass.*;
|
15
|
15
|
import com.xhkjedu.sexam.mapper.reportstu.*;
|
16
|
16
|
import com.xhkjedu.sexam.mapper.system.UserMapper;
|
|
17
|
+import com.xhkjedu.sexam.model.exam.EClass;
|
17
|
18
|
import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
|
18
|
19
|
import com.xhkjedu.sexam.model.report.ERbase;
|
19
|
20
|
import com.xhkjedu.sexam.model.report.ERrank;
|
|
@@ -28,6 +29,7 @@ import com.xhkjedu.sexam.vo.report.ERPointStuScoreVo;
|
28
|
29
|
import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
|
29
|
30
|
import com.xhkjedu.sexam.vo.system.UserVo;
|
30
|
31
|
import com.xhkjedu.utils.N_Utils;
|
|
32
|
+import lombok.extern.slf4j.Slf4j;
|
31
|
33
|
import org.springframework.stereotype.Service;
|
32
|
34
|
import org.springframework.transaction.annotation.Transactional;
|
33
|
35
|
|
|
@@ -44,6 +46,7 @@ import java.util.stream.Collectors;
|
44
|
46
|
* @date 2022/8/8 10:04
|
45
|
47
|
**/
|
46
|
48
|
@Service
|
|
49
|
+@Slf4j
|
47
|
50
|
public class EReportGenerateService {
|
48
|
51
|
@Resource
|
49
|
52
|
private EReportGenerateMapper eReportGenerateMapper;
|
|
@@ -1726,7 +1729,9 @@ public class EReportGenerateService {
|
1726
|
1729
|
String key2 = "";
|
1727
|
1730
|
String key3 = "";
|
1728
|
1731
|
|
1729
|
|
- for (int i = 0; i < classStu.size(); i++) {
|
|
1732
|
+ Double qscore = q.getQscore();
|
|
1733
|
+ int stunum = classStu.size();
|
|
1734
|
+ for (int i = 0; i < stunum; i++) {
|
1730
|
1735
|
EPaperStudentQuestion sq = classStu.get(i);
|
1731
|
1736
|
String stuanswer = sq.getStuanswer();
|
1732
|
1737
|
if (q.getCtype() == 1 || q.getCtype() == 2 || q.getCtype() == 4 || q.getCtype() == 5 || q.getCtype() == 6) {
|
|
@@ -1761,9 +1766,9 @@ public class EReportGenerateService {
|
1761
|
1766
|
if (i == 0) {
|
1762
|
1767
|
answermap = new LinkedHashMap<>();
|
1763
|
1768
|
//处理分数分段对应,用于分数段[0,50%) [50%,80%), [80%,100%]
|
1764
|
|
- score8 = ExamUtil.getScoreRateScore(q.getQscore(), 0.8);
|
1765
|
|
- score5 = ExamUtil.getScoreRateScore(q.getQscore(), 0.5);
|
1766
|
|
- String str10 = N_Utils.formatDouble(q.getQscore());
|
|
1769
|
+ score8 = ExamUtil.getScoreRateScore(qscore, 0.8);
|
|
1770
|
+ score5 = ExamUtil.getScoreRateScore(qscore, 0.5);
|
|
1771
|
+ String str10 = N_Utils.formatDouble(qscore);
|
1767
|
1772
|
String str8 = N_Utils.formatDouble(score8);
|
1768
|
1773
|
String str5 = N_Utils.formatDouble(score5);
|
1769
|
1774
|
key1 = str8 + "-" + str10;
|
|
@@ -1819,8 +1824,24 @@ public class EReportGenerateService {
|
1819
|
1824
|
}
|
1820
|
1825
|
}
|
1821
|
1826
|
|
|
1827
|
+ List<Map> dafblist = new ArrayList<>();//答案分布
|
|
1828
|
+ Map<String, Map> dafbmap = new HashMap<>();//答案分布
|
|
1829
|
+ for (Map.Entry<String, List<Map>> entry : answermap.entrySet()) {
|
|
1830
|
+ String key = entry.getKey();
|
|
1831
|
+ List<Map> students = entry.getValue();
|
|
1832
|
+ Map dafb = new HashMap();
|
|
1833
|
+ int num = students.size();
|
|
1834
|
+ dafb.put("students", students);
|
|
1835
|
+ dafb.put("num", num);
|
|
1836
|
+ dafb.put("numrate", N_Utils.getIntegerDivideAndMulitiply(num, stunum));
|
|
1837
|
+ dafbmap.put(key, dafb);
|
|
1838
|
+ }
|
|
1839
|
+
|
1822
|
1840
|
Map rtnmap = new HashMap();
|
1823
|
|
- rtnmap.put("answerlist", JSON.toJSONString(answermap));
|
|
1841
|
+ rtnmap.put("answerlist", JSON.toJSONString(dafbmap));
|
|
1842
|
+ long fullscorenum = classStu.stream().filter(c -> qscore.equals(c.getStuscore())).count();
|
|
1843
|
+ rtnmap.put("fullscorenum", fullscorenum);
|
|
1844
|
+ rtnmap.put("dafbjson", JSON.toJSONString(dafblist));
|
1824
|
1845
|
rtnmap.put("goodlist", JSON.toJSONString(goodlist));
|
1825
|
1846
|
rtnmap.put("badlist", JSON.toJSONString(badlist));
|
1826
|
1847
|
rtnmap.put("erroroption",erroroption);
|
|
@@ -1905,6 +1926,7 @@ public class EReportGenerateService {
|
1905
|
1926
|
ercq.setGradesrate(qgsrate);
|
1906
|
1927
|
//处理单选题选项情况
|
1907
|
1928
|
Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
|
|
1929
|
+ ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
|
1908
|
1930
|
ercq.setAnswerjson(stuansmap.get("answerlist").toString());
|
1909
|
1931
|
if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
|
1910
|
1932
|
ercq.setGoodstujson(stuansmap.get("goodlist").toString());
|
|
@@ -2136,6 +2158,7 @@ public class EReportGenerateService {
|
2136
|
2158
|
ercq.setGradesrate(N_Utils.getDoubleDivideAndMulitiply(qgstuscore,qgscore));
|
2137
|
2159
|
//处理单选题选项情况
|
2138
|
2160
|
Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
|
|
2161
|
+ ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
|
2139
|
2162
|
ercq.setAnswerjson(stuansmap.get("answerlist").toString());
|
2140
|
2163
|
if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
|
2141
|
2164
|
ercq.setGoodstujson(stuansmap.get("goodlist").toString());
|
|
@@ -2441,4 +2464,50 @@ public class EReportGenerateService {
|
2441
|
2464
|
}
|
2442
|
2465
|
}
|
2443
|
2466
|
}
|
|
2467
|
+
|
|
2468
|
+ //处理班级试题作答详情和满分
|
|
2469
|
+ public void handleAnswerjson() {
|
|
2470
|
+ List<ERclassQuestion> list = eReportGenerateMapper.listAnswerJson();//获取未处理的学生作答情况
|
|
2471
|
+ List<Integer> examids = list.stream().map(l -> l.getExamid()).distinct().collect(Collectors.toList());
|
|
2472
|
+ List<EClass> classes = eReportGenerateMapper.listClassByExamIds(examids);//获取考试班级集合
|
|
2473
|
+ Map<String, Integer> classMap = classes.stream().collect(Collectors.toMap(
|
|
2474
|
+ c -> c.getExamid() + "_" + c.getClassid(), c -> c.getClassnum()));
|
|
2475
|
+ for (ERclassQuestion q : list) {
|
|
2476
|
+ new Thread(()->{
|
|
2477
|
+ try {
|
|
2478
|
+ updateClassQuestion(classMap, q);
|
|
2479
|
+ }catch (Exception e){
|
|
2480
|
+ log.error("处理单个班级试题重试:" + e.getMessage());
|
|
2481
|
+ try {
|
|
2482
|
+ updateClassQuestion(classMap, q);
|
|
2483
|
+ }catch (Exception se){
|
|
2484
|
+ log.error("处理单个班级试题重试出错:" + se.getMessage());
|
|
2485
|
+ }
|
|
2486
|
+ }
|
|
2487
|
+ }).start();
|
|
2488
|
+ }
|
|
2489
|
+ }
|
|
2490
|
+
|
|
2491
|
+ //处理单个班级试题
|
|
2492
|
+ private void updateClassQuestion(Map<String, Integer> classMap, ERclassQuestion q) {
|
|
2493
|
+ if (N_Utils.isEmptyInteger(q.getEptqid())) {
|
|
2494
|
+ Integer fullscorenum = eReportGenerateMapper.getFullscorenum(q);
|
|
2495
|
+ q.setFullscorenum(fullscorenum);
|
|
2496
|
+ }
|
|
2497
|
+ Integer stunum = classMap.get(q.getExamid() + "_" + q.getClassid());
|
|
2498
|
+ Map<String, Map> dafbmap = new HashMap<>();//答案分布
|
|
2499
|
+ Map<String, List<Map>> answer = JSON.parseObject(q.getAnswerjson(), Map.class);
|
|
2500
|
+ for (Map.Entry<String, List<Map>> entry : answer.entrySet()) {
|
|
2501
|
+ String key = entry.getKey();
|
|
2502
|
+ List<Map> students = entry.getValue();
|
|
2503
|
+ int num = students.size();
|
|
2504
|
+ Map dafb = new HashMap();
|
|
2505
|
+ dafb.put("students", students);
|
|
2506
|
+ dafb.put("num", num);
|
|
2507
|
+ dafb.put("numrate", N_Utils.getIntegerDivideAndMulitiply(num, stunum));
|
|
2508
|
+ dafbmap.put(key, dafb);
|
|
2509
|
+ }
|
|
2510
|
+ q.setAnswerjson(JSON.toJSONString(dafbmap));
|
|
2511
|
+ eReportGenerateMapper.updateClassQuestion(q);
|
|
2512
|
+ }
|
2444
|
2513
|
}
|