|
@@ -1,9 +1,6 @@
|
|
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.HashMap;
|
|
-import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
@@ -15,8 +12,6 @@ import org.slf4j.LoggerFactory;
|
|
import cn.com.qmth.stmms.biz.exam.model.CheckStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.CheckStudent;
|
|
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.ScoreRate;
|
|
|
|
import cn.com.qmth.stmms.biz.exam.service.CheckStudentService;
|
|
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.ExamQuestionService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
@@ -28,7 +23,6 @@ import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
import cn.com.qmth.stmms.biz.report.service.ReportService;
|
|
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.common.enums.CheckType;
|
|
import cn.com.qmth.stmms.common.enums.CheckType;
|
|
import cn.com.qmth.stmms.common.enums.LockType;
|
|
import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
|
|
|
@@ -88,7 +82,6 @@ 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 {
|
|
- checkStudentService.deleteByExamId(examId);
|
|
|
|
int pageNumber = 1;
|
|
int pageNumber = 1;
|
|
int pageSize = 1000;
|
|
int pageSize = 1000;
|
|
List<ExamStudent> list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber,
|
|
List<ExamStudent> list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber,
|
|
@@ -102,14 +95,8 @@ public class ScoreCalculateThread implements Runnable {
|
|
list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber, pageSize);
|
|
list = studentService.findByExamIdAndUploadAndAbsent(examId, true, false, pageNumber, pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
- // 统计各科目下每题得分率,主观题评卷完成才统计
|
|
|
|
- double total = groupService.sumLibraryCount(examId);
|
|
|
|
- double finish = groupService.sumMarkedCount(examId);
|
|
|
|
- if (total == finish) {
|
|
|
|
- statistics();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// 统计识别缺考的试卷
|
|
// 统计识别缺考的试卷
|
|
|
|
+ checkStudentService.deleteByExamId(examId);
|
|
List<ExamStudent> students = studentService.findByExamIdAndUploadAndAbsent(examId, true, true, 1,
|
|
List<ExamStudent> students = studentService.findByExamIdAndUploadAndAbsent(examId, true, true, 1,
|
|
Integer.MAX_VALUE);
|
|
Integer.MAX_VALUE);
|
|
for (ExamStudent examStudent : students) {
|
|
for (ExamStudent examStudent : students) {
|
|
@@ -117,28 +104,7 @@ public class ScoreCalculateThread implements Runnable {
|
|
CheckType.SCAN_ABSENT);
|
|
CheckType.SCAN_ABSENT);
|
|
checkStudentService.save(student);
|
|
checkStudentService.save(student);
|
|
}
|
|
}
|
|
- // 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);
|
|
reportService.generateReportData(examId);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -149,45 +115,45 @@ 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 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) {
|
|
private void calculate(ExamStudent student) {
|
|
try {
|
|
try {
|
|
@@ -205,7 +171,7 @@ public class ScoreCalculateThread implements Runnable {
|
|
|
|
|
|
// 主观题得分统计
|
|
// 主观题得分统计
|
|
// 需要重新从数据库读取一遍考生信息
|
|
// 需要重新从数据库读取一遍考生信息
|
|
- statistics(studentService.findById(student.getId()));
|
|
|
|
|
|
+// statistics(studentService.findById(student.getId()));
|
|
|
|
|
|
// 客观题0分主观题有分的考生
|
|
// 客观题0分主观题有分的考生
|
|
if (student.getObjectiveScore() == 0 && student.getSubjectiveScore() != 0) {
|
|
if (student.getObjectiveScore() == 0 && student.getSubjectiveScore() != 0) {
|
|
@@ -218,40 +184,40 @@ 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 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) {
|
|
private List<ExamQuestion> findQuestionList(String subjectCode, String paperType, boolean objective) {
|
|
if (objective) {
|
|
if (objective) {
|