|
@@ -1,32 +1,23 @@
|
|
package cn.com.qmth.stmms.admin.thread;
|
|
package cn.com.qmth.stmms.admin.thread;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.HashSet;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Set;
|
|
|
|
-
|
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ScoreRate;
|
|
import cn.com.qmth.stmms.biz.exam.model.ScoreRate;
|
|
-import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.ScoreRateService;
|
|
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.*;
|
|
import cn.com.qmth.stmms.biz.lock.LockService;
|
|
import cn.com.qmth.stmms.biz.lock.LockService;
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
|
|
+import cn.com.qmth.stmms.biz.report.service.ReportService;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreCalculateUtil;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreCalculateUtil;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreInfo;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreInfo;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreItem;
|
|
import cn.com.qmth.stmms.biz.utils.ScoreItem;
|
|
import cn.com.qmth.stmms.common.enums.LockType;
|
|
import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
public class ScoreCalculateThread implements Runnable {
|
|
public class ScoreCalculateThread implements Runnable {
|
|
|
|
|
|
@@ -48,6 +39,8 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
|
|
|
private LockService lockService;
|
|
private LockService lockService;
|
|
|
|
|
|
|
|
+ private ReportService reportService;
|
|
|
|
+
|
|
private Map<String, List<ExamQuestion>> objectiveMap;
|
|
private Map<String, List<ExamQuestion>> objectiveMap;
|
|
|
|
|
|
private Map<String, List<ExamQuestion>> subjectiveMap;
|
|
private Map<String, List<ExamQuestion>> subjectiveMap;
|
|
@@ -57,8 +50,8 @@ public class ScoreCalculateThread implements Runnable {
|
|
private Map<String, Double> scoreRateMap;
|
|
private Map<String, Double> scoreRateMap;
|
|
|
|
|
|
public ScoreCalculateThread(int examId, LockService lockService, ExamStudentService studentService,
|
|
public ScoreCalculateThread(int examId, LockService lockService, ExamStudentService studentService,
|
|
- ExamQuestionService questionService, ExamSubjectService subjectService, ScoreRateService scoreRateService,
|
|
|
|
- MarkService markService, MarkGroupService groupService) {
|
|
|
|
|
|
+ ExamQuestionService questionService, ExamSubjectService subjectService, ScoreRateService scoreRateService,
|
|
|
|
+ MarkService markService, MarkGroupService groupService, ReportService reportService) {
|
|
this.examId = examId;
|
|
this.examId = examId;
|
|
this.lockService = lockService;
|
|
this.lockService = lockService;
|
|
this.studentService = studentService;
|
|
this.studentService = studentService;
|
|
@@ -67,6 +60,7 @@ public class ScoreCalculateThread implements Runnable {
|
|
this.scoreRateService = scoreRateService;
|
|
this.scoreRateService = scoreRateService;
|
|
this.markService = markService;
|
|
this.markService = markService;
|
|
this.groupService = groupService;
|
|
this.groupService = groupService;
|
|
|
|
+ this.reportService = reportService;
|
|
this.objectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
this.objectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
this.subjectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
this.subjectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
this.scoreRateMap = new HashMap<String, Double>();
|
|
this.scoreRateMap = new HashMap<String, Double>();
|
|
@@ -77,25 +71,27 @@ public class ScoreCalculateThread implements Runnable {
|
|
public void run() {
|
|
public void run() {
|
|
log.info("start calculate for examId=" + examId);
|
|
log.info("start calculate for examId=" + examId);
|
|
try {
|
|
try {
|
|
- int pageNumber = 1;
|
|
|
|
- int pageSize = 1000;
|
|
|
|
- List<ExamStudent> list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber,
|
|
|
|
- pageSize);
|
|
|
|
- while (list != null && list.size() > 0) {
|
|
|
|
- for (ExamStudent student : list) {
|
|
|
|
- calculate(student);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- pageNumber++;
|
|
|
|
- list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber, pageSize);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 统计各科目下每题得分率,主观题评卷完成才统计
|
|
|
|
- double total = groupService.sumLibraryCount(examId);
|
|
|
|
- double finish = groupService.sumMarkedCount(examId);
|
|
|
|
- if (total == finish) {
|
|
|
|
- statistics();
|
|
|
|
- }
|
|
|
|
|
|
+// int pageNumber = 1;
|
|
|
|
+// int pageSize = 1000;
|
|
|
|
+// List<ExamStudent> list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber,
|
|
|
|
+// pageSize);
|
|
|
|
+// while (list != null && list.size() > 0) {
|
|
|
|
+// for (ExamStudent student : list) {
|
|
|
|
+// calculate(student);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// pageNumber++;
|
|
|
|
+// list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber, pageSize);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// // 统计各科目下每题得分率,主观题评卷完成才统计
|
|
|
|
+// double total = groupService.sumLibraryCount(examId);
|
|
|
|
+// double finish = groupService.sumMarkedCount(examId);
|
|
|
|
+// if (total == finish) {
|
|
|
|
+// statistics();
|
|
|
|
+// }
|
|
|
|
+ //生成报表数据
|
|
|
|
+ reportService.generateReportData(examId);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("calculate exception for examId=" + examId, e);
|
|
log.error("calculate exception for examId=" + examId, e);
|
|
} finally {
|
|
} finally {
|