|
@@ -37,7 +37,6 @@ import com.qmth.teachcloud.mark.utils.TaskLock;
|
|
|
import com.qmth.teachcloud.mark.utils.TaskLockUtil;
|
|
|
import io.lettuce.core.GeoArgs.Sort;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -110,9 +109,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void releaseTask(SubmitResult submitResult, Long userId) {
|
|
|
- if (submitResult.getMarkLibrary() != null) {
|
|
|
- TaskLock taskLock = TaskLockUtil.getFormalTask(String.valueOf(userId));
|
|
|
- taskLock.remove(submitResult.getMarkLibrary().getStudentId(), submitResult.getMarkLibrary().getTaskNumber(), userId);
|
|
|
+ if (submitResult.getStudentId() != null) {
|
|
|
+ TaskLock taskLock = TaskLockUtil.getFormalTask(String.valueOf(submitResult.getStudentId()));
|
|
|
+ taskLock.remove(submitResult.getStudentId(), 1, userId);
|
|
|
taskLock.refresh(userId);
|
|
|
}
|
|
|
}
|
|
@@ -341,7 +340,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
markArbitrateHistory.getUpdateUserId(), markResult.getScore(), markResult.getTrackList(), markResult.getSpecialTagList(), markArbitrateHistory.getUpdateTime(), MarkTaskStatus.ARBITRATED);
|
|
|
updateMarkedCount(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(),
|
|
|
markArbitrateHistory.getQuestionId());
|
|
|
- checkStudentGroup(markArbitrateHistory.getStudentId(), markQuestionService.getById(markArbitrateHistory.getQuestionId()));
|
|
|
+ checkStudentGroup(markArbitrateHistory.getStudentId(), markQuestionService.getById(markArbitrateHistory.getQuestionId()), null);
|
|
|
// 评卷质量重新统计
|
|
|
List<MarkUserQuestion> markUserGroups = markUserQuestionService.listByExamIdAndPaperNumberAndQuestionId(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(), markArbitrateHistory.getQuestionId());
|
|
|
markUserGroups.forEach(m -> this.updateQuality(m));
|
|
@@ -357,11 +356,12 @@ public class MarkServiceImpl implements MarkService {
|
|
|
*
|
|
|
* @param studentId
|
|
|
* @param markQuestion
|
|
|
+ * @param result
|
|
|
*/
|
|
|
- private void checkStudentGroup(Long studentId, MarkQuestion markQuestion) {
|
|
|
+ private void checkStudentGroup(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
|
|
|
if (calculateGroup(markQuestion, studentId)) {
|
|
|
//更新考生分组分数
|
|
|
- updateStudentGroupScore(studentId, markQuestion);
|
|
|
+ updateStudentGroupScore(studentId, markQuestion, result);
|
|
|
//未分组的题目
|
|
|
long unGroupQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(
|
|
|
markQuestion.getExamId(), markQuestion.getPaperNumber(), false);
|
|
@@ -417,7 +417,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
private void buildFormalLibrary(MarkQuestion markQuestion) {
|
|
|
int pageSize = 100;
|
|
|
try {
|
|
|
- lockService.watch(LockType.GROUP, markQuestion.getId());
|
|
|
+ lockService.watch(LockType.QUESTION, markQuestion.getId());
|
|
|
// 上锁后重复验证分组状态
|
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(markQuestion.getExamId(), markQuestion.getPaperNumber());
|
|
|
if (MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
|
|
@@ -509,7 +509,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
log.error("build formal markTask error for examId=" + markQuestion.getExamId() + ", paperNumber="
|
|
|
+ markQuestion.getPaperNumber() + ", questionId=" + markQuestion.getId(), e);
|
|
|
} finally {
|
|
|
- lockService.unwatch(LockType.GROUP, markQuestion.getId());
|
|
|
+ lockService.unwatch(LockType.QUESTION, markQuestion.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -562,7 +562,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private void updateStudentGroupScore(Long studentId, MarkQuestion markQuestion) {
|
|
|
+ private void updateStudentGroupScore(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
|
|
|
MarkSubjectiveScore ss = markSubjectiveScoreService.getByStudentIdAndQuestionId(studentId, markQuestion.getId());
|
|
|
if (ss == null) {
|
|
|
ss = new MarkSubjectiveScore();
|
|
@@ -573,7 +573,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
ss.setQuestionId(markQuestion.getId());
|
|
|
ss.setMainNumber(markQuestion.getMainNumber());
|
|
|
ss.setSubNumber(markQuestion.getSubNumber());
|
|
|
- ss.setScore(markQuestion.getMarkScore());
|
|
|
+ ss.setScore(result.getMarkerScore());
|
|
|
ss.setMainScore(0.0);
|
|
|
markSubjectiveScoreService.saveOrUpdateByMultiId(ss);
|
|
|
}
|
|
@@ -636,10 +636,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
dto.setEnableAllZore(false);//是否开启全零分(知学知考阅卷默认false)
|
|
|
dto.setFileServer(null);//图片服务地址
|
|
|
dto.setUserName(user.getRealName());//评卷员名称
|
|
|
- dto.getSubject().setAnswerUrl(StringUtils.isBlank(markPaper.getAnswerFilePath()) ? null
|
|
|
- : teachcloudCommonService.filePreview(markPaper.getAnswerFilePath()));
|
|
|
-// dto.getSubject().setPaperUrl(StringUtils.isBlank(markPaper.getPaperFilePath()) ? null
|
|
|
-// : JSON.toJSONString(teachcloudCommonService.filePreview(JSON.parseArray(markPaper.getPaperFilePath(), String.class), SystemConstant.MARK_JPG_EXPIRE_MINUTE)));
|
|
|
+ dto.getSubject().setAnswerUrl(markQuestionService.previewAnswerFileByExamIdAndPaperNumber(examId, paperNumber));
|
|
|
+ dto.getSubject().setPaperUrl(markQuestionService.previewPaperFileByExamIdAndPaperNumber(examId, paperNumber));
|
|
|
BasicCourse basicCourse = basicCourseService.getById(markPaper.getCourseId());
|
|
|
dto.getSubject().setCode(markPaper.getPaperNumber());
|
|
|
dto.getSubject().setName(basicCourse != null ? basicCourse.getName() : null);
|
|
@@ -695,29 +693,6 @@ public class MarkServiceImpl implements MarkService {
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public List<MarkGroupDto> getGroup(Long userId, Long examId, String paperNumber) {
|
|
|
-// List<MarkUserQuestion> markUserGroups = markUserGroupService.listByExamIdAndPaperNumberAndUserId(examId,
|
|
|
-// paperNumber, userId);
|
|
|
-// List<MarkGroupDto> list = new ArrayList<MarkGroupDto>();
|
|
|
-// for (MarkUserQuestion markUserGroup : markUserGroups) {
|
|
|
-// MarkGroup markGroup = markGroupService.getByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber,
|
|
|
-// markUserGroup.getGroupNumber());
|
|
|
-// markGroup.setQuestionList(markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(examId,
|
|
|
-// paperNumber, markUserGroup.getGroupNumber(), false));
|
|
|
-// MarkGroupDto dto = new MarkGroupDto();
|
|
|
-// dto.setGroupNumber(markUserGroup.getGroupNumber());
|
|
|
-// dto.setTotalCount(markTaskService.countByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber,
|
|
|
-// markUserGroup.getGroupNumber()));
|
|
|
-// dto.setMarkedCount(markTaskService.countByExamIdAndPaperNumberAndGroupNumberAndStatusIn(examId, paperNumber,
|
|
|
-// markUserGroup.getGroupNumber(), Arrays.asList(MarkTaskStatus.MARKED, MarkTaskStatus.ARBITRATED)));
|
|
|
-// dto.setGroupQuestions(markGroup.getGroupQuestions());
|
|
|
-// dto.setTitle(markGroup.getTitle());
|
|
|
-// list.add(dto);
|
|
|
-// }
|
|
|
-// return list;
|
|
|
-// }
|
|
|
-
|
|
|
@Override
|
|
|
public void clear(Long userId, Long examId, String paperNumber) {
|
|
|
String key = String.valueOf(userId);
|
|
@@ -757,34 +732,18 @@ public class MarkServiceImpl implements MarkService {
|
|
|
Long userId = ServletUtil.getRequestUserId();
|
|
|
for (MarkHeaderGroupResult groupResult : markHeaderGroupResultList) {
|
|
|
try {
|
|
|
- lockService.watch(LockType.GROUP, groupResult.getQuestionId());
|
|
|
+ lockService.watch(LockType.QUESTION, groupResult.getQuestionId());
|
|
|
Long currentTime = System.currentTimeMillis();
|
|
|
-// if (groupResult.getTrackList() != null) {
|
|
|
-// for (MarkScoreList scoreList : groupResult.getScore()) {
|
|
|
-// String questionNumber = scoreList.getMainNumber() + "." + scoreList.getSubNumber();
|
|
|
-// markHeaderTrackService.deleteByExamIdAndPaperNumberAndGroupNumberAndStudentIdAndQuestionNumber(
|
|
|
-// markStudent.getExamId(), markStudent.getPaperNumber(), groupResult.getGroupNumber(),
|
|
|
-// groupResult.getStudentId(), questionNumber);
|
|
|
-// }
|
|
|
-// List<MarkHeaderTrack> tracks = groupResult.getTrackList(groupResult, markStudent, userId);
|
|
|
-// markHeaderTrackService.saveOrUpdateBatchByMultiId(tracks);
|
|
|
-// }
|
|
|
-// if (groupResult.getHeaderTagList(groupResult, userId) != null) {
|
|
|
-// markHeaderTagService.deleteByExamIdAndPaperNumberAndGroupNumberAndStudentId(markStudent.getExamId(),
|
|
|
-// markStudent.getPaperNumber(), groupResult.getGroupNumber(), groupResult.getStudentId());
|
|
|
-// List<MarkHeaderTag> tags = groupResult.getHeaderTagList(groupResult, userId);
|
|
|
-// markHeaderTagService.saveOrUpdateBatch(tags);
|
|
|
-// }
|
|
|
updateMarkSubjectScore(markStudent, groupResult);
|
|
|
markTaskService.updateHeaderResult(markStudent.getExamId(), markStudent.getPaperNumber(),
|
|
|
groupResult.getQuestionId(), groupResult.getStudentId(), userId, groupResult.getScore(), groupResult.getTrackList(), groupResult.getSpecialTagList(), currentTime, MarkTaskStatus.MARKED);
|
|
|
updateMarkedCount(markStudent.getExamId(), markStudent.getPaperNumber(), groupResult.getQuestionId());
|
|
|
markStudentService.updateCheckInfo(markStudent.getId(), userId);
|
|
|
- checkStudentGroup(groupResult.getStudentId(), markQuestionService.getById(groupResult.getQuestionId()));
|
|
|
+ checkStudentGroup(groupResult.getStudentId(), markQuestionService.getById(groupResult.getQuestionId()), null);
|
|
|
} catch (ApiException e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
} finally {
|
|
|
- lockService.unwatch(LockType.GROUP, groupResult.getQuestionId());
|
|
|
+ lockService.unwatch(LockType.QUESTION, groupResult.getQuestionId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -823,26 +782,20 @@ public class MarkServiceImpl implements MarkService {
|
|
|
|
|
|
@Override
|
|
|
public IPage<Task> getHistory(Long userId, int pageNumber, int pageSize, Sort sort, String order, Long examId,
|
|
|
- String paperNumber, Integer groupNumber, String secretNumber, Double markerScore) {
|
|
|
+ String paperNumber, String secretNumber, Double markerScore) {
|
|
|
if (!"marker_time".equals(order) && !"marker_score".equals(order)) {
|
|
|
order = "marker_time";
|
|
|
}
|
|
|
-// MarkGroup group = markGroupService.getByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber, groupNumber);
|
|
|
-// if (group == null) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("评卷大题不存在");
|
|
|
-// }
|
|
|
- Page<MarkTask> page = new Page<>(pageNumber, pageSize);
|
|
|
+ Page<Long> page = new Page<>(pageNumber, pageSize);
|
|
|
OrderItem orderItem = new OrderItem(order, sort.equals(Sort.asc));
|
|
|
page.addOrder(orderItem);
|
|
|
- IPage<MarkTask> list = markTaskService.listPageHistory(page, userId, examId, paperNumber, groupNumber,
|
|
|
- secretNumber, markerScore);
|
|
|
- List<Task> recordsDtos = new ArrayList<Task>();
|
|
|
- for (MarkTask task : list.getRecords()) {
|
|
|
- Task dto = taskService.build(task);
|
|
|
- dto.setPrevious(true);
|
|
|
+ IPage<Long> list = markTaskService.listPageHistory(page, userId, examId, paperNumber, secretNumber, markerScore);
|
|
|
+ List<Task> recordsDtos = new ArrayList<>();
|
|
|
+ for (Long studentId : list.getRecords()) {
|
|
|
+ Task dto = taskService.build(studentId);
|
|
|
recordsDtos.add(dto);
|
|
|
}
|
|
|
- IPage<Task> result = new Page<Task>();
|
|
|
+ IPage<Task> result = new Page<>();
|
|
|
result.setCurrent(list.getCurrent());
|
|
|
result.setPages(list.getPages());
|
|
|
result.setRecords(recordsDtos);
|
|
@@ -867,24 +820,24 @@ public class MarkServiceImpl implements MarkService {
|
|
|
// throw ExceptionResultEnum.ERROR.exception("评卷任务被重置,请点击右上角返回按钮,重新在评卷入口菜单点击评卷");
|
|
|
// }
|
|
|
Task task = null;
|
|
|
- List<MarkTask> list;
|
|
|
- Long questionId = null;
|
|
|
+ List<Long> studentIds;
|
|
|
int pageNumber = 1;
|
|
|
while (task == null) {
|
|
|
if (markPaper.getClassMark()) {
|
|
|
- list = markTaskService.findUnMarkedFilterClass(new Page<>(pageNumber, 20), examId, paperNumber, userId, questionModel);
|
|
|
+ studentIds = markTaskService.findUnMarkedFilterClass(new Page<>(pageNumber, 20), examId, paperNumber, userId, questionModel);
|
|
|
} else {
|
|
|
- list = markTaskService.findUnMarked(new Page<>(pageNumber, 20), examId, paperNumber, userId, questionModel);
|
|
|
+ studentIds = markTaskService.findUnMarked(new Page<>(pageNumber, 20), examId, paperNumber, userId, questionModel);
|
|
|
}
|
|
|
- if (list.isEmpty()) {
|
|
|
+ if (studentIds.isEmpty()) {
|
|
|
break;
|
|
|
}
|
|
|
- for (MarkTask t : list) {
|
|
|
- if (this.applyTask(t, userId)) {
|
|
|
- task = taskService.build(t);
|
|
|
- break;
|
|
|
- }
|
|
|
+ for (Long studentId : studentIds) {
|
|
|
+// if (this.applyTask(studentId, userId)) {
|
|
|
+ List<MarkTask> markTaskList = markTaskService.listByStudentIdAndUserId(studentId, userId);
|
|
|
+ task = taskService.build(userId, markTaskList);
|
|
|
+// }
|
|
|
}
|
|
|
+
|
|
|
if (task == null) {
|
|
|
pageNumber++;
|
|
|
}
|
|
@@ -912,10 +865,29 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean hasApplied(MarkTask t, Long userId) {
|
|
|
- String key = t.getExamId() + "_" + t.getPaperNumber() + "_" + t.getQuestionId();
|
|
|
+ public boolean applyTask(Long studentId, Long userId) {
|
|
|
+ // 查询待领取任务时,已经做了多评同一studentId互斥处理
|
|
|
+ String key = String.valueOf(studentId);
|
|
|
+ TaskLock taskLock = TaskLockUtil.getFormalTask(key);
|
|
|
+ boolean lock = taskLock.add(studentId, 1, userId);
|
|
|
+ // 上锁失败直接返回
|
|
|
+ if (!lock) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 重复校验任务状态
|
|
|
+ if (markTaskService.countByStudentIdAndStatus(studentId, MarkTaskStatus.WAITING, MarkTaskStatus.REJECTED) > 0) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ taskLock.remove(studentId, 1, userId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean hasApplied(Long studentId, Long userId) {
|
|
|
+ String key = String.valueOf(studentId);
|
|
|
TaskLock taskLock = TaskLockUtil.getFormalTask(key);
|
|
|
- return taskLock.exist(t.getStudentId(), t.getTaskNumber(), userId);
|
|
|
+ return taskLock.exist(studentId, 1, userId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -960,20 +932,17 @@ public class MarkServiceImpl implements MarkService {
|
|
|
|
|
|
@Override
|
|
|
public SubmitResult saveTask(Long examId, String paperNumber, Long userId, MarkResult result) {
|
|
|
-// MarkUserQuestion markUserGroup = markUserQuestionService.getByExamIdAndPaperNumberAndQuestionIdAndUserId(examId,
|
|
|
-// paperNumber, groupNumber, userId);
|
|
|
-// if (markUserGroup == null) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("评卷员未绑定该评卷任务");
|
|
|
-// }
|
|
|
-// MarkGroup group = markGroupService.getByExamIdAndPaperNumberAndGroupNumber(markUserGroup.getExamId(),
|
|
|
-// markUserGroup.getPaperNumber(), markUserGroup.getGroupNumber());
|
|
|
-// if (group == null) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("评卷分组不存在");
|
|
|
-// }
|
|
|
+ for (MarkResultQuestion question : result.getQuestionList()) {
|
|
|
+ MarkUserQuestion markUserQuestion = markUserQuestionService.getByExamIdAndPaperNumberAndQuestionIdAndUserId(examId, paperNumber, question.getQuestionId(), userId);
|
|
|
+ if (markUserQuestion == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("评卷员未绑定题目" + question.getMainNumber() + "-" + question.getSubNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SubmitResult sr = null;
|
|
|
try {
|
|
|
lockService.watch(LockType.EXAM_SUBJECT, examId, paperNumber);
|
|
|
- lockService.watch(LockType.MARK_USER_GROUP, userId);
|
|
|
+ lockService.watch(LockType.MARK_USER_QUESTION, userId);
|
|
|
lockService.waitlock(LockType.STUDENT, result.getStudentId());
|
|
|
sr = submitResult(examId, paperNumber, userId, result);
|
|
|
if (sr.isSuccess()) {
|
|
@@ -983,7 +952,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
log.error("save task error", e);
|
|
|
} finally {
|
|
|
lockService.unlock(LockType.STUDENT, result.getStudentId());
|
|
|
- lockService.unwatch(LockType.MARK_USER_GROUP, userId);
|
|
|
+ lockService.unwatch(LockType.MARK_USER_QUESTION, userId);
|
|
|
lockService.unwatch(LockType.EXAM_SUBJECT, examId, paperNumber);
|
|
|
}
|
|
|
|
|
@@ -996,36 +965,42 @@ public class MarkServiceImpl implements MarkService {
|
|
|
private SubmitResult submitResult(Long examId, String paperNumber, Long userId, MarkResult result) {
|
|
|
int spentAvg = result.getSpent() / result.getQuestionList().size();
|
|
|
for (MarkResultQuestion markResultQuestion : result.getQuestionList()) {
|
|
|
- markResultQuestion.setSpent(spentAvg);
|
|
|
- MarkUserQuestion markUserQuestion = markUserQuestionService.getByExamIdAndPaperNumberAndQuestionIdAndUserId(examId, paperNumber, markResultQuestion.getQuestionId(), userId);
|
|
|
- MarkQuestion markQuestion = markQuestionService.getById(markResultQuestion.getQuestionId());
|
|
|
- MarkTask task = markTaskService.getById(markResultQuestion.getTaskId());
|
|
|
- if (task != null && task.getExamId().equals(markUserQuestion.getExamId())
|
|
|
- && task.getPaperNumber().equals(markUserQuestion.getPaperNumber())
|
|
|
- && task.getQuestionId().equals(markUserQuestion.getQuestionId())) {
|
|
|
- // 问题卷
|
|
|
- Long now = System.currentTimeMillis();
|
|
|
- if (markResultQuestion.isProblem()) {
|
|
|
- // 状态更新
|
|
|
- if (markTaskService.updateProblemResult(task.getId(), userId, now, markResultQuestion.getSpent())) {
|
|
|
- saveProblemHistory(markResultQuestion, task, userId);
|
|
|
- updateMarkedCount(markUserQuestion.getExamId(), markUserQuestion.getPaperNumber(), markUserQuestion.getQuestionId());
|
|
|
- // 未评完
|
|
|
- resetStudentGroup(task.getStudentId());
|
|
|
- return SubmitResult.success(task);
|
|
|
+ try {
|
|
|
+ lockService.watch(LockType.QUESTION, markResultQuestion.getQuestionId());
|
|
|
+ markResultQuestion.setSpent(spentAvg);
|
|
|
+ MarkUserQuestion markUserQuestion = markUserQuestionService.getByExamIdAndPaperNumberAndQuestionIdAndUserId(examId, paperNumber, markResultQuestion.getQuestionId(), userId);
|
|
|
+ MarkQuestion markQuestion = markQuestionService.getById(markResultQuestion.getQuestionId());
|
|
|
+ MarkTask task = markTaskService.getById(markResultQuestion.getTaskId());
|
|
|
+ if (task != null && task.getExamId().equals(markUserQuestion.getExamId())
|
|
|
+ && task.getPaperNumber().equals(markUserQuestion.getPaperNumber())
|
|
|
+ && task.getQuestionId().equals(markUserQuestion.getQuestionId())) {
|
|
|
+ // 问题卷
|
|
|
+ Long now = System.currentTimeMillis();
|
|
|
+ if (markResultQuestion.isProblem()) {
|
|
|
+ // 状态更新
|
|
|
+ if (markTaskService.updateProblemResult(task.getId(), userId, now, markResultQuestion.getSpent())) {
|
|
|
+ saveProblemHistory(markResultQuestion, task, userId);
|
|
|
+ updateMarkedCount(markUserQuestion.getExamId(), markUserQuestion.getPaperNumber(), markUserQuestion.getQuestionId());
|
|
|
+ // 未评完
|
|
|
+ resetStudentGroup(task.getStudentId());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (markResultQuestion.getMarkerScore() <= markQuestion.getTotalScore()) {//阅卷分是否小于等于该组总分
|
|
|
- if (submitTask(task, userId, markQuestion, markUserQuestion, markResultQuestion)) {
|
|
|
- updateMarkedCount(markUserQuestion.getExamId(), markUserQuestion.getPaperNumber(),
|
|
|
- markUserQuestion.getQuestionId());
|
|
|
- return SubmitResult.success(task);
|
|
|
+ if (markResultQuestion.getMarkerScore() <= markQuestion.getTotalScore()) {//阅卷分是否小于等于该组总分
|
|
|
+ if (submitTask(task, userId, markQuestion, markResultQuestion)) {
|
|
|
+ updateMarkedCount(markUserQuestion.getExamId(), markUserQuestion.getPaperNumber(),
|
|
|
+ markUserQuestion.getQuestionId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
+ } finally {
|
|
|
+ lockService.unwatch(LockType.QUESTION, markResultQuestion.getQuestionId());
|
|
|
}
|
|
|
}
|
|
|
+ return SubmitResult.success(result.getStudentId());
|
|
|
|
|
|
- return SubmitResult.faile();
|
|
|
+// return SubmitResult.faile();
|
|
|
}
|
|
|
|
|
|
private void saveProblemHistory(MarkResultQuestion result, MarkTask task, Long userId) {
|
|
@@ -1052,12 +1027,12 @@ public class MarkServiceImpl implements MarkService {
|
|
|
markProblemHistoryService.save(history);
|
|
|
}
|
|
|
|
|
|
- private boolean submitTask(MarkTask task, Long userId, MarkQuestion markQuestion, MarkUserQuestion markUserQuestion, MarkResultQuestion result) {
|
|
|
+ private boolean submitTask(MarkTask task, Long userId, MarkQuestion markQuestion, MarkResultQuestion result) {
|
|
|
// 非本人领取的待评任务
|
|
|
- if ((task.getStatus() == MarkTaskStatus.WAITING || task.getStatus() == MarkTaskStatus.REJECTED)
|
|
|
- && !hasApplied(task, markUserQuestion.getId())) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+// if ((task.getStatus() == MarkTaskStatus.WAITING || task.getStatus() == MarkTaskStatus.REJECTED)
|
|
|
+// && !hasApplied(task.getStudentId(), userId)) {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
// 非本人的回评任务
|
|
|
if ((task.getStatus() == MarkTaskStatus.MARKED) && !task.getUserId().equals(userId)) {
|
|
|
return false;
|
|
@@ -1076,17 +1051,6 @@ public class MarkServiceImpl implements MarkService {
|
|
|
// 条件不符更新失败,直接返回
|
|
|
return false;
|
|
|
}
|
|
|
-// // 保存阅卷轨迹
|
|
|
-// // int unansweredCount = 0;
|
|
|
-// if (result.getTrackList() != null && !result.isUnselective()) {
|
|
|
-// markTrackService.deleteByTaskId(task.getId());
|
|
|
-// markTrackService.saveBatch(result.getTrackList(task, userId));
|
|
|
-// }
|
|
|
-// // 保存特殊标记
|
|
|
-// if (result.getSpecialTagList() != null && !result.isUnselective()) {
|
|
|
-// markSpecialTagService.deleteByTaskId(task.getId());
|
|
|
-// markSpecialTagService.saveBatch(result.getSpecialTagList(task));
|
|
|
-// }
|
|
|
// 判断多评模式下是否需要仲裁
|
|
|
MarkArbitrateHistory history = null;
|
|
|
if (markQuestion.getArbitrateThreshold() != null && markQuestion.getArbitrateThreshold() > 0) {
|
|
@@ -1113,7 +1077,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
resetStudentGroup(task.getStudentId());
|
|
|
} else {
|
|
|
// 判断当前分组是否已完成评卷
|
|
|
- checkStudentGroup(task.getStudentId(), markQuestion);
|
|
|
+ checkStudentGroup(task.getStudentId(), markQuestion, result);
|
|
|
}
|
|
|
return true;
|
|
|
}
|