|
@@ -1,62 +1,28 @@
|
|
|
package cn.com.qmth.stmms.biz.mark.service.Impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
-
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Sort;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import cn.com.qmth.stmms.biz.exam.dao.ExamQuestionDao;
|
|
|
-import cn.com.qmth.stmms.biz.exam.dao.MarkGroupDao;
|
|
|
-import cn.com.qmth.stmms.biz.exam.dao.MarkGroupStudentDao;
|
|
|
-import cn.com.qmth.stmms.biz.exam.dao.MarkerDao;
|
|
|
-import cn.com.qmth.stmms.biz.exam.dao.SubjectiveScoreDao;
|
|
|
-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.ExamSubject;
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.MarkGroupStudent;
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.Marker;
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.SubjectiveScore;
|
|
|
+import cn.com.qmth.stmms.biz.exam.dao.*;
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.*;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.ArbitrateHistoryDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.MarkLibraryDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.MarkSpecialTagDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.MarkTrackDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.ProblemHistoryDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.TrialHistoryDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.TrialLibraryDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.TrialTagDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.dao.TrialTrackDao;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.ArbitrateHistory;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.MarkLibrary;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.MarkResult;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.MarkTrack;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.ProblemHistory;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.TrialHistory;
|
|
|
-import cn.com.qmth.stmms.biz.mark.model.TrialLibrary;
|
|
|
+import cn.com.qmth.stmms.biz.mark.dao.*;
|
|
|
+import cn.com.qmth.stmms.biz.mark.model.*;
|
|
|
import cn.com.qmth.stmms.biz.mark.query.MarkLibrarySearchQuery;
|
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
|
import cn.com.qmth.stmms.biz.utils.ScoreItem;
|
|
|
import cn.com.qmth.stmms.biz.utils.TaskLock;
|
|
|
import cn.com.qmth.stmms.biz.utils.TaskLockUtil;
|
|
|
-import cn.com.qmth.stmms.common.enums.HistoryStatus;
|
|
|
-import cn.com.qmth.stmms.common.enums.LibraryStatus;
|
|
|
-import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
|
-import cn.com.qmth.stmms.common.enums.ScorePolicy;
|
|
|
-import cn.com.qmth.stmms.common.enums.SubjectiveStatus;
|
|
|
-import cn.com.qmth.stmms.common.enums.ThirdPolicy;
|
|
|
+import cn.com.qmth.stmms.common.enums.*;
|
|
|
import cn.com.qmth.stmms.common.utils.BigDecimalUtils;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
/**
|
|
|
* 与评卷相关的所有修改操作(非传播性的新增操作除外),全部汇总到这里进行集中控制
|
|
@@ -121,8 +87,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 某个评卷分组已申请的评卷任务数量
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
* @return int
|
|
|
*/
|
|
|
@Override
|
|
@@ -141,8 +106,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 某个评卷员已申请的评卷任务数量
|
|
|
*
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return int
|
|
|
*/
|
|
|
@Override
|
|
@@ -166,8 +130,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 某个评卷员已完成的评卷任务数量
|
|
|
*
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return long
|
|
|
*/
|
|
|
@Override
|
|
@@ -180,8 +143,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
return trialHistoryDao.countByMarkerId(marker.getId());
|
|
|
} else {
|
|
|
- return libraryDao.countByMarkerAndStatus(marker.getId(), LibraryStatus.MARKED,
|
|
|
- LibraryStatus.ARBITRATED, LibraryStatus.INSPECTED);
|
|
|
+ return libraryDao.countByMarkerAndStatus(marker.getId(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED,
|
|
|
+ LibraryStatus.INSPECTED);
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
@@ -190,8 +153,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 释放某个评卷分组的锁定任务
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
public void releaseByGroup(MarkGroup group) {
|
|
@@ -207,8 +169,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 重置某个评卷分组的所有评卷任务
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -219,8 +180,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 删除某个评卷分组
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -266,9 +226,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
studentService.updateSubjectiveStatusAndScoreAndInspectorId(group.getExamId(), group.getSubjectCode(),
|
|
|
SubjectiveStatus.UNMARK, 0, null, null, null);
|
|
|
} else {
|
|
|
- List<Integer> studentList = studentService.findIdByExamIdAndSubjectCodeAndSubjectiveStatus(
|
|
|
- group.getExamId(), group.getSubjectCode(), SubjectiveStatus.UNMARK, SubjectiveStatus.MARKED,
|
|
|
- SubjectiveStatus.INSPECTED);
|
|
|
+ List<Integer> studentList = studentService
|
|
|
+ .findIdByExamIdAndSubjectCodeAndSubjectiveStatus(group.getExamId(), group.getSubjectCode(),
|
|
|
+ SubjectiveStatus.UNMARK, SubjectiveStatus.MARKED, SubjectiveStatus.INSPECTED);
|
|
|
for (Integer studentId : studentList) {
|
|
|
checkStudentSubjective(studentId, groupCount);
|
|
|
}
|
|
@@ -278,8 +238,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 修改某个评卷分组给分步骤,并重置评卷任务
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -303,31 +262,33 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 评卷员申请领取某个正式评卷任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 正评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean applyLibrary(MarkLibrary library, Marker marker) {
|
|
|
// 查询待领取任务时,已经做了多评同一studentId互斥处理
|
|
|
- // 首先判断多评情况下,同一个studentId是否已被该评卷员处理过
|
|
|
- // if (libraryDao.countByStudentIdAndMarkerId(library.getStudentId(),
|
|
|
- // marker.getId()) > 0) {
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // return FormalTaskUtil.add(marker, getApplyTaskId(library));
|
|
|
+ String taskId = getApplyTaskId(library);
|
|
|
TaskLock taskLock = TaskLockUtil.getFormalTask(getGroupKey(marker));
|
|
|
- return taskLock.add(getApplyTaskId(library), library.getTaskNumber(), marker.getId());
|
|
|
+ boolean lock = taskLock.add(taskId, library.getTaskNumber(), marker.getId());
|
|
|
+ // 上锁失败直接返回
|
|
|
+ if (!lock) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 重复校验任务状态
|
|
|
+ if (libraryDao.countByIdAndStatus(library.getId(), library.getStatus()) == 1) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ taskLock.remove(taskId, library.getTaskNumber(), marker.getId());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 评卷员申请领取某个试评评卷任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 试评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 试评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return boolean
|
|
|
*/
|
|
|
@Override
|
|
@@ -339,10 +300,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 评卷员是否已领取了某个正式评卷任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 正评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return boolean
|
|
|
*/
|
|
|
@Override
|
|
@@ -354,10 +313,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 评卷员是否已领取了某个试评评卷任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 试评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 试评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return boolean
|
|
|
*/
|
|
|
@Override
|
|
@@ -369,10 +326,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 释放某个评卷员已领取的正评任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 正评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
public void releaseLibrary(MarkLibrary library, Marker marker) {
|
|
@@ -384,10 +339,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 释放某个评卷员已领取的试评任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 试评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param library - 试评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
public void releaseLibrary(TrialLibrary library, Marker marker) {
|
|
@@ -398,8 +351,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 释放某个评卷员的所有锁定任务
|
|
|
*
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
public void releaseByMarker(Marker marker) {
|
|
@@ -410,8 +362,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 重置某个评卷员
|
|
|
*
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -473,8 +424,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 根据考生删除评卷任务
|
|
|
*
|
|
|
- * @param student
|
|
|
- * - 考生
|
|
|
+ * @param student - 考生
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -499,10 +449,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 评卷员提交评卷任务
|
|
|
*
|
|
|
- * @param result
|
|
|
- * - 评卷结果
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param result - 评卷结果
|
|
|
+ * @param marker - 评卷员
|
|
|
* @return boolean
|
|
|
*/
|
|
|
@Override
|
|
@@ -510,8 +458,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
public boolean submitTask(MarkResult result, Marker marker) {
|
|
|
// 判断评卷分组是否存在/评卷是否结束
|
|
|
MarkGroup group = groupDao.findOne(marker.getExamId(), marker.getSubjectCode(), marker.getGroupNumber());
|
|
|
- if (group == null || group.getStatus() == MarkStatus.FINISH
|
|
|
- || group.getStatus().getValue() != result.getStatusValue()) {
|
|
|
+ if (group == null || group.getStatus() == MarkStatus.FINISH || group.getStatus().getValue() != result
|
|
|
+ .getStatusValue()) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -529,10 +477,10 @@ public class MarkServiceImpl implements MarkService {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- if (library != null && library.getExamId().equals(group.getExamId())
|
|
|
- && library.getSubjectCode().equals(group.getSubjectCode())
|
|
|
- && library.getGroupNumber().equals(group.getNumber())
|
|
|
- && result.getTotalScore() <= group.getTotalScore() && StringUtils.isNotBlank(result.getScoreList())) {
|
|
|
+ if (library != null && library.getExamId().equals(group.getExamId()) && library.getSubjectCode()
|
|
|
+ .equals(group.getSubjectCode()) && library.getGroupNumber().equals(group.getNumber())
|
|
|
+ && result.getTotalScore() <= group.getTotalScore() && StringUtils
|
|
|
+ .isNotBlank(result.getScoreList())) {
|
|
|
if (submitLibrary(library, marker, group, result)) {
|
|
|
updateMarkedCount(group);
|
|
|
releaseLibrary(library, marker);
|
|
@@ -541,10 +489,10 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
} else if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
TrialLibrary library = trialLibraryDao.findOne(result.getLibraryId());
|
|
|
- if (library != null && library.getExamId().equals(group.getExamId())
|
|
|
- && library.getSubjectCode().equals(group.getSubjectCode())
|
|
|
- && library.getGroupNumber().equals(group.getNumber())
|
|
|
- && result.getTotalScore() <= group.getTotalScore() && StringUtils.isNotBlank(result.getScoreList())) {
|
|
|
+ if (library != null && library.getExamId().equals(group.getExamId()) && library.getSubjectCode()
|
|
|
+ .equals(group.getSubjectCode()) && library.getGroupNumber().equals(group.getNumber())
|
|
|
+ && result.getTotalScore() <= group.getTotalScore() && StringUtils
|
|
|
+ .isNotBlank(result.getScoreList())) {
|
|
|
TrialHistory history = new TrialHistory();
|
|
|
history.setExamId(library.getExamId());
|
|
|
history.setSubjectCode(library.getSubjectCode());
|
|
@@ -596,14 +544,10 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 评卷员提交某个正评任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
- * @param result
|
|
|
- * - 评卷结果
|
|
|
+ * @param library - 正评任务
|
|
|
+ * @param marker - 评卷员
|
|
|
+ * @param group - 评卷分组
|
|
|
+ * @param result - 评卷结果
|
|
|
*/
|
|
|
private boolean submitLibrary(MarkLibrary library, Marker marker, MarkGroup group, MarkResult result) {
|
|
|
// 非本人领取的待评任务
|
|
@@ -611,8 +555,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
return false;
|
|
|
}
|
|
|
// 非本人的回评任务
|
|
|
- if ((library.getStatus() == LibraryStatus.MARKED || library.getStatus() == LibraryStatus.INSPECTED)
|
|
|
- && !library.getMarkerId().equals(marker.getId())) {
|
|
|
+ if ((library.getStatus() == LibraryStatus.MARKED || library.getStatus() == LibraryStatus.INSPECTED) && !library
|
|
|
+ .getMarkerId().equals(marker.getId())) {
|
|
|
return false;
|
|
|
}
|
|
|
// 是否多评情况下已处理过该考生评卷任务
|
|
@@ -622,9 +566,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
// 尝试提交评卷结果
|
|
|
Date now = new Date();
|
|
|
- if (libraryDao.updateMarkerResult(library.getId(), LibraryStatus.MARKED, marker.getId(),
|
|
|
- result.getTotalScore(), result.getScoreList(), now, result.getSpent(), LibraryStatus.WAITING,
|
|
|
- LibraryStatus.MARKED, LibraryStatus.INSPECTED) == 0) {
|
|
|
+ if (libraryDao.updateMarkerResult(library.getId(), LibraryStatus.MARKED, marker.getId(), result.getTotalScore(),
|
|
|
+ result.getScoreList(), now, result.getSpent(), LibraryStatus.WAITING, LibraryStatus.MARKED,
|
|
|
+ LibraryStatus.INSPECTED) == 0) {
|
|
|
// 条件不符更新失败,直接返回
|
|
|
return false;
|
|
|
}
|
|
@@ -645,8 +589,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
ArbitrateHistory history = null;
|
|
|
if (group.getArbitrateThreshold() != null && group.getArbitrateThreshold() > 0) {
|
|
|
// 多评模式
|
|
|
- List<MarkLibrary> list = libraryDao.findByStudentIdAndGroupNumberAndStatus(library.getStudentId(),
|
|
|
- library.getGroupNumber(), LibraryStatus.MARKED, LibraryStatus.INSPECTED);
|
|
|
+ List<MarkLibrary> list = libraryDao
|
|
|
+ .findByStudentIdAndGroupNumberAndStatus(library.getStudentId(), library.getGroupNumber(),
|
|
|
+ LibraryStatus.MARKED, LibraryStatus.INSPECTED);
|
|
|
for (MarkLibrary other : list) {
|
|
|
if (other.getId().equals(library.getId()) || other.getHeaderScore() != null) {
|
|
|
// 本评卷任务或组长已打分,则跳过该任务
|
|
@@ -656,12 +601,13 @@ public class MarkServiceImpl implements MarkService {
|
|
|
if (Math.abs(other.getMarkerScore() - result.getTotalScore()) > group.getArbitrateThreshold()) {
|
|
|
// 开启三评
|
|
|
if (group.getThirdPolicy().equals(ThirdPolicy.LOW_DIFF_HIGH_AVG)) {
|
|
|
- if (libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber()) == 2) {
|
|
|
+ if (libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber())
|
|
|
+ == 2) {
|
|
|
buildThirdLibrary(library, group);
|
|
|
} else {
|
|
|
// 两两比较,触发仲裁
|
|
|
- List<MarkLibrary> libraries = libraryDao.findByStudentIdAndGroupNumber(
|
|
|
- library.getStudentId(), library.getGroupNumber());
|
|
|
+ List<MarkLibrary> libraries = libraryDao
|
|
|
+ .findByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber());
|
|
|
history = buildArbitrateHistory(libraries, group.getArbitrateThreshold(), now);
|
|
|
}
|
|
|
} else {
|
|
@@ -742,8 +688,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
* 管理员/组长打回某个评卷任务<br>
|
|
|
* 暂时不用到BACKED状态,直接等同于重置该评卷任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
+ * @param library - 正评任务
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -758,13 +703,14 @@ public class MarkServiceImpl implements MarkService {
|
|
|
specialTagDao.deleteByLibraryId(library.getId());
|
|
|
resetStudentGroup(library.getStudentId(), library.getExamId(), library.getSubjectCode(),
|
|
|
library.getGroupNumber());
|
|
|
- problemHistoryDao.resetByLibraryId(library.getId(), HistoryStatus.WAITING, userId, HistoryStatus.BACK,
|
|
|
- new Date());
|
|
|
+ problemHistoryDao
|
|
|
+ .resetByLibraryId(library.getId(), HistoryStatus.WAITING, userId, HistoryStatus.BACK, new Date());
|
|
|
// 开启三评时,打回1,2任务则删除第3条任务
|
|
|
long count = libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber());
|
|
|
if (library.getTaskNumber() != 3 && count == 3) {
|
|
|
- MarkLibrary third = libraryDao.findByStudentIdAndGroupNumberAndTaskNumber(library.getStudentId(),
|
|
|
- library.getGroupNumber(), 3);
|
|
|
+ MarkLibrary third = libraryDao
|
|
|
+ .findByStudentIdAndGroupNumberAndTaskNumber(library.getStudentId(), library.getGroupNumber(),
|
|
|
+ 3);
|
|
|
trackDao.deleteByLibraryId(third.getId());
|
|
|
specialTagDao.deleteByLibraryId(third.getId());
|
|
|
problemHistoryDao.deleteByLibraryId(third.getId());
|
|
@@ -781,8 +727,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 管理员/组长重置某个试评任务
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 试评任务
|
|
|
+ * @param library - 试评任务
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -800,8 +745,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 管理员/组长处理仲裁卷
|
|
|
*
|
|
|
- * @param history
|
|
|
- * - 仲裁卷
|
|
|
+ * @param history - 仲裁卷
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -912,12 +856,12 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
return -1;
|
|
|
});
|
|
|
- Double score1 = list.get(0).getHeaderScore() != null ? list.get(0).getHeaderScore() : list.get(0)
|
|
|
- .getMarkerScore();
|
|
|
- Double score2 = list.get(1).getHeaderScore() != null ? list.get(1).getHeaderScore() : list.get(1)
|
|
|
- .getMarkerScore();
|
|
|
- Double score3 = list.get(2).getHeaderScore() != null ? list.get(2).getHeaderScore() : list.get(2)
|
|
|
- .getMarkerScore();
|
|
|
+ Double score1 =
|
|
|
+ list.get(0).getHeaderScore() != null ? list.get(0).getHeaderScore() : list.get(0).getMarkerScore();
|
|
|
+ Double score2 =
|
|
|
+ list.get(1).getHeaderScore() != null ? list.get(1).getHeaderScore() : list.get(1).getMarkerScore();
|
|
|
+ Double score3 =
|
|
|
+ list.get(2).getHeaderScore() != null ? list.get(2).getHeaderScore() : list.get(2).getMarkerScore();
|
|
|
if ((score3 - score2) <= (score2 - score1)) {
|
|
|
list.remove(0);
|
|
|
} else {
|
|
@@ -989,8 +933,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 更新某个评卷分组已评任务数量
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -998,7 +941,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
if (group.getStatus() == MarkStatus.FORMAL || group.getStatus() == MarkStatus.FINISH) {
|
|
|
groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(), (int) libraryDao
|
|
|
.countByExamIdAndSubjectCodeAndGroupNumberAndStatus(group.getExamId(), group.getSubjectCode(),
|
|
|
- group.getNumber(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED, LibraryStatus.INSPECTED));
|
|
|
+ group.getNumber(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED,
|
|
|
+ LibraryStatus.INSPECTED));
|
|
|
} else if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
(int) trialLibraryDao.countMarked(group.getExamId(), group.getSubjectCode(), group.getNumber()));
|
|
@@ -1008,20 +952,21 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 更新某个评卷分组评卷任务总量
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateLibraryCount(MarkGroup group) {
|
|
|
if (group.getStatus() == MarkStatus.FORMAL || group.getStatus() == MarkStatus.FINISH) {
|
|
|
- group.setLibraryCount((int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
- group.getSubjectCode(), group.getNumber()));
|
|
|
+ group.setLibraryCount((int) libraryDao
|
|
|
+ .countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
+ group.getNumber()));
|
|
|
groupDao.updateLibraryCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
group.getLibraryCount());
|
|
|
} else if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
- group.setLibraryCount((int) trialLibraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
- group.getSubjectCode(), group.getNumber()));
|
|
|
+ group.setLibraryCount((int) trialLibraryDao
|
|
|
+ .countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
+ group.getNumber()));
|
|
|
groupDao.updateLibraryCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
group.getLibraryCount());
|
|
|
}
|
|
@@ -1030,10 +975,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 更新某个科目所有评卷分组评卷任务数量
|
|
|
*
|
|
|
- * @param examId
|
|
|
- * - 考试ID
|
|
|
- * @param subjectCode
|
|
|
- * - 科目代码
|
|
|
+ * @param examId - 考试ID
|
|
|
+ * @param subjectCode - 科目代码
|
|
|
*/
|
|
|
@Transactional
|
|
|
@Override
|
|
@@ -1048,12 +991,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 根据考生、学习中心、评卷分组构造正式评卷任务
|
|
|
*
|
|
|
- * @param student
|
|
|
- * - 考生
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
- * @param subject
|
|
|
- * - 科目
|
|
|
+ * @param student - 考生
|
|
|
+ * @param group - 评卷分组
|
|
|
+ * @param subject - 科目
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -1079,14 +1019,15 @@ public class MarkServiceImpl implements MarkService {
|
|
|
} else {
|
|
|
double studentCount = subject.getUploadCount();
|
|
|
double libraryCount = group.getLibraryCount();
|
|
|
- double doubleCount = libraryDao.countByExamIdAndSubjectCodeAndGroupNumberAndTaskNumber(
|
|
|
- group.getExamId(), group.getSubjectCode(), group.getNumber(), 2);
|
|
|
+ double doubleCount = libraryDao
|
|
|
+ .countByExamIdAndSubjectCodeAndGroupNumberAndTaskNumber(group.getExamId(),
|
|
|
+ group.getSubjectCode(), group.getNumber(), 2);
|
|
|
int expectCount = (int) (studentCount * group.getDoubleRate());
|
|
|
// 随机数判断加入当前已经生成双评任务的比例加权
|
|
|
// 实际双评任务数小于理论生成数 &&(剩余未生成双评的考生数量小于剩余应生成的数量||随机比例)
|
|
|
- needDouble = doubleCount < expectCount
|
|
|
- && ((studentCount - libraryCount + doubleCount) <= (expectCount - doubleCount) || Math
|
|
|
- .random() < group.getDoubleRate() + 0.1);
|
|
|
+ needDouble = doubleCount < expectCount && (
|
|
|
+ (studentCount - libraryCount + doubleCount) <= (expectCount - doubleCount)
|
|
|
+ || Math.random() < group.getDoubleRate() + 0.1);
|
|
|
}
|
|
|
if (needDouble) {
|
|
|
library = new MarkLibrary();
|
|
@@ -1111,10 +1052,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 根据考生、学习中心、评卷分组构造试评评卷任务
|
|
|
*
|
|
|
- * @param student
|
|
|
- * - 考生
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param student - 考生
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -1136,8 +1075,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
* 领取正式评卷任务时,用来区分的唯一标识<br/>
|
|
|
* 多评时同一个考生的多份任务不能被同一位评卷员领取
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 正评任务
|
|
|
+ * @param library - 正评任务
|
|
|
*/
|
|
|
private String getApplyTaskId(MarkLibrary library) {
|
|
|
return library.getStudentId() + "_" + library.getGroupNumber();
|
|
@@ -1146,8 +1084,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 领取试评评卷任务时,用来区分的唯一标识
|
|
|
*
|
|
|
- * @param library
|
|
|
- * - 试评任务
|
|
|
+ * @param library - 试评任务
|
|
|
*/
|
|
|
private String getApplyTaskId(TrialLibrary library, Marker marker) {
|
|
|
return library.getId() + "_" + marker.getId();
|
|
@@ -1164,8 +1101,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 重置评卷分组的连带操作
|
|
|
*
|
|
|
- * @param group
|
|
|
- * - 评卷分组
|
|
|
+ * @param group - 评卷分组
|
|
|
*/
|
|
|
private void resetGroup(MarkGroup group) {
|
|
|
if (group.getStatus() == MarkStatus.FORMAL) {
|
|
@@ -1178,8 +1114,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
group.getNumber());
|
|
|
libraryDao.resetByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
group.getNumber(), LibraryStatus.WAITING);
|
|
|
- libraryDao.deleteByExamIdAndSubjectCodeAndGroupNumberAndTaskNumber(group.getExamId(),
|
|
|
- group.getSubjectCode(), group.getNumber(), 3);
|
|
|
+ libraryDao
|
|
|
+ .deleteByExamIdAndSubjectCodeAndGroupNumberAndTaskNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
+ group.getNumber(), 3);
|
|
|
markerDao.resetByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
group.getNumber());
|
|
|
resetStudentGroup(group.getExamId(), group.getSubjectCode(), group.getNumber());
|
|
@@ -1198,8 +1135,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
/**
|
|
|
* 计算并更新指定评卷员的评卷质量指标
|
|
|
*
|
|
|
- * @param marker
|
|
|
- * - 评卷员
|
|
|
+ * @param marker - 评卷员
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -1322,8 +1258,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
groupStudentDao.updateStatusByExamIdAndSubjectCodeAndGroupNumber(examId, subjectCode, groupNumber,
|
|
|
SubjectiveStatus.UNMARK);
|
|
|
scoreDao.deleteByExamIdAndSubjectCodeAndGroupNumber(examId, subjectCode, groupNumber);
|
|
|
- studentService.updateSubjectiveStatusAndScoreAndInspectorId(examId, subjectCode, SubjectiveStatus.UNMARK, 0,
|
|
|
- null, null, null);
|
|
|
+ studentService
|
|
|
+ .updateSubjectiveStatusAndScoreAndInspectorId(examId, subjectCode, SubjectiveStatus.UNMARK, 0, null,
|
|
|
+ null, null);
|
|
|
}
|
|
|
|
|
|
private void updateStudentGroupStatus(Integer studentId, Integer examId, String subjectCode, Integer groupNumber,
|
|
@@ -1340,8 +1277,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
private void updateStudentGroupScore(Integer studentId, Integer examId, String subjectCode, Integer groupNumber,
|
|
|
double score, List<ScoreItem> scoreList) {
|
|
|
// scoreDao.deleteByStudentIdAndGroupNumber(studentId, groupNumber);
|
|
|
- List<ExamQuestion> questions = questionDao.findByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(examId,
|
|
|
- subjectCode, false, groupNumber);
|
|
|
+ List<ExamQuestion> questions = questionDao
|
|
|
+ .findByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(examId, subjectCode, false, groupNumber);
|
|
|
for (int i = 0; i < scoreList.size(); i++) {
|
|
|
ScoreItem item = scoreList.get(i);
|
|
|
ExamQuestion question = questions.get(i);
|
|
@@ -1369,8 +1306,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
List<MarkLibrary> list = libraryDao.findByStudentIdAndGroupNumber(student.getId(), groupNumber);
|
|
|
int count = 0;
|
|
|
for (MarkLibrary library : list) {
|
|
|
- if (libraryDao.resetById(library.getId(), LibraryStatus.WAITING, LibraryStatus.MARKED,
|
|
|
- LibraryStatus.PROBLEM, LibraryStatus.INSPECTED) > 0) {
|
|
|
+ if (libraryDao
|
|
|
+ .resetById(library.getId(), LibraryStatus.WAITING, LibraryStatus.MARKED, LibraryStatus.PROBLEM,
|
|
|
+ LibraryStatus.INSPECTED) > 0) {
|
|
|
count++;
|
|
|
trackDao.deleteByLibraryId(library.getId());
|
|
|
specialTagDao.deleteByLibraryId(library.getId());
|
|
@@ -1387,8 +1325,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
if (count > 0) {
|
|
|
updateMarkedCount(group);
|
|
|
resetStudentGroup(student.getId(), group.getExamId(), group.getSubjectCode(), group.getNumber());
|
|
|
- studentService.updateSubjectiveStatusAndTimeAndInspectorId(student.getId(), SubjectiveStatus.UNMARK, null,
|
|
|
- null);
|
|
|
+ studentService
|
|
|
+ .updateSubjectiveStatusAndTimeAndInspectorId(student.getId(), SubjectiveStatus.UNMARK, null, null);
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|