|
@@ -3,7 +3,6 @@ package cn.com.qmth.stmms.admin.thread;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -15,9 +14,6 @@ import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.CheckStudentService;
|
|
|
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.lock.LockService;
|
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
|
import cn.com.qmth.stmms.biz.report.service.ReportService;
|
|
@@ -34,14 +30,8 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
|
|
|
private ExamQuestionService questionService;
|
|
|
|
|
|
- private ExamSubjectService subjectService;
|
|
|
-
|
|
|
private MarkService markService;
|
|
|
|
|
|
- private MarkGroupService groupService;
|
|
|
-
|
|
|
- private ScoreRateService scoreRateService;
|
|
|
-
|
|
|
private int examId;
|
|
|
|
|
|
private LockService lockService;
|
|
@@ -52,30 +42,21 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
|
|
|
private Map<String, List<ExamQuestion>> subjectiveMap;
|
|
|
|
|
|
- private Map<String, Set<String>> campusNameMap;
|
|
|
-
|
|
|
- private Map<String, Double> scoreRateMap;
|
|
|
-
|
|
|
private CheckStudentService checkStudentService;
|
|
|
|
|
|
public ScoreCalculateThread(int examId, LockService lockService, ExamStudentService studentService,
|
|
|
- ExamQuestionService questionService, ExamSubjectService subjectService, ScoreRateService scoreRateService,
|
|
|
- MarkService markService, MarkGroupService groupService, CheckStudentService checkStudentService,
|
|
|
+ ExamQuestionService questionService,
|
|
|
+ MarkService markService, CheckStudentService checkStudentService,
|
|
|
ReportService reportService) {
|
|
|
this.examId = examId;
|
|
|
this.lockService = lockService;
|
|
|
this.studentService = studentService;
|
|
|
this.questionService = questionService;
|
|
|
- this.subjectService = subjectService;
|
|
|
- this.scoreRateService = scoreRateService;
|
|
|
this.markService = markService;
|
|
|
- this.groupService = groupService;
|
|
|
this.checkStudentService = checkStudentService;
|
|
|
this.reportService = reportService;
|
|
|
this.objectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
|
this.subjectiveMap = new HashMap<String, List<ExamQuestion>>();
|
|
|
- this.scoreRateMap = new HashMap<String, Double>();
|
|
|
- this.campusNameMap = new HashMap<String, Set<String>>();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -115,46 +96,6 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// private void statistics() {
|
|
|
-// List<ExamSubject> examSubjects = subjectService.list(examId);
|
|
|
-// for (ExamSubject examSubject : examSubjects) {
|
|
|
-// Set<String> campusNameList = campusNameMap.get(examSubject.getCode());
|
|
|
-// if (campusNameList == null) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// for (String campusName : campusNameList) {
|
|
|
-// List<ExamQuestion> questions = this.findQuestionList(examSubject.getCode(), null, false);
|
|
|
-// Long count = studentService.countByExamIdAndSubjectCodeAndCampus(examId, examSubject.getCode(),
|
|
|
-// campusName, true, false);
|
|
|
-// for (ExamQuestion examQuestion : questions) {
|
|
|
-// ScoreRate scoreRate = scoreRateService.findOne(examId, examSubject.getCode(), campusName, false,
|
|
|
-// examQuestion.getMainNumber(), examQuestion.getSubNumber());
|
|
|
-// if (scoreRate == null) {
|
|
|
-// scoreRate = new ScoreRate();
|
|
|
-// scoreRate.setExamId(examId);
|
|
|
-// scoreRate.setCampusName(campusName);
|
|
|
-// scoreRate.setSubjectCode(examSubject.getCode());
|
|
|
-// scoreRate.setMainNumber(examQuestion.getMainNumber());
|
|
|
-// scoreRate.setSubNumber(examQuestion.getSubNumber());
|
|
|
-// scoreRate.setObjective(examQuestion.isObjective());
|
|
|
-// scoreRate.setMainTitle(examQuestion.getMainTitle());
|
|
|
-// scoreRate.setTotalScore(examQuestion.getTotalScore());
|
|
|
-// }
|
|
|
-// String key = getKey(examSubject.getCode(), campusName, examQuestion.getQuestionNumber());
|
|
|
-// BigDecimal bg = new BigDecimal(scoreRateMap.get(key) * 1.00 / count);
|
|
|
-// double avgScore = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
-// if (scoreRate.getAvgScore() == null || scoreRate.getAvgScore() != avgScore) {
|
|
|
-// scoreRate.setAvgScore(avgScore);
|
|
|
-// }
|
|
|
-// if (scoreRate.getTotalScore() != examQuestion.getTotalScore()) {
|
|
|
-// scoreRate.setTotalScore(examQuestion.getTotalScore());
|
|
|
-// }
|
|
|
-// scoreRateService.save(scoreRate);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
private void calculate(ExamStudent student) {
|
|
|
try {
|
|
|
ScoreCalculateUtil util = ScoreCalculateUtil.instance(student);
|
|
@@ -169,10 +110,6 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
// 增加主观题总分统计
|
|
|
markService.scoreCalculate(student.getExamId(), student.getSubjectCode(), student.getId());
|
|
|
|
|
|
- // 主观题得分统计
|
|
|
- // 需要重新从数据库读取一遍考生信息
|
|
|
-// statistics(studentService.findById(student.getId()));
|
|
|
-
|
|
|
// 客观题0分主观题有分的考生
|
|
|
if (student.getObjectiveScore() == 0 && student.getSubjectiveScore() != 0) {
|
|
|
CheckStudent cs = new CheckStudent(student.getId(), examId, student.getSubjectCode(),
|
|
@@ -184,41 +121,6 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// private void statistics(ExamStudent student) {
|
|
|
-// List<ScoreItem> items = student.getScoreList(false);
|
|
|
-// if (items.isEmpty()) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// List<ExamQuestion> list = this.findQuestionList(student.getSubjectCode(), student.getPaperType(), false);
|
|
|
-// int count = list.size();
|
|
|
-// for (int i = 0; i < count; i++) {
|
|
|
-// ScoreItem scoreItem = items.size() > i ? items.get(i) : null;
|
|
|
-// if (scoreItem != null) {
|
|
|
-// String key = getKey(student.getSubjectCode(), student.getCampusName(), list.get(i).getQuestionNumber());
|
|
|
-// Double totalScore = scoreRateMap.get(key);
|
|
|
-// if (totalScore == null) {
|
|
|
-// scoreRateMap.put(key, scoreItem.getScore());
|
|
|
-// } else {
|
|
|
-// scoreRateMap.put(key, totalScore + scoreItem.getScore());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// Set<String> campusNames = campusNameMap.get(student.getSubjectCode());
|
|
|
-// if (campusNames == null) {
|
|
|
-// campusNames = new HashSet<>();
|
|
|
-// campusNameMap.put(student.getSubjectCode(), campusNames);
|
|
|
-// }
|
|
|
-// campusNames.add(student.getCampusName());
|
|
|
-// }
|
|
|
-
|
|
|
-// private String getKey(String subjectCode, String campusName, String questionNumber) {
|
|
|
-// List<String> list = new ArrayList<String>();
|
|
|
-// list.add(subjectCode);
|
|
|
-// list.add(campusName);
|
|
|
-// list.add(questionNumber);
|
|
|
-// return StringUtils.join(list, "-");
|
|
|
-// }
|
|
|
-
|
|
|
private List<ExamQuestion> findQuestionList(String subjectCode, String paperType, boolean objective) {
|
|
|
if (objective) {
|
|
|
String key = subjectCode + "_" + StringUtils.trimToEmpty(paperType);
|