|
@@ -1,23 +1,20 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
-import com.qmth.teachcloud.common.entity.BasicOperationLog;
|
|
|
import com.qmth.teachcloud.common.entity.MarkQuestion;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
-import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
|
|
|
import com.qmth.teachcloud.common.enums.mark.*;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.service.BasicOperationLogService;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
-import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.MarkStudentVo;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.manage.Task;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.mark.MarkSettingDto;
|
|
@@ -93,7 +90,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
TaskService taskService;
|
|
|
|
|
|
@Resource
|
|
|
- TeachcloudCommonService teachcloudCommonService;
|
|
|
+ private MarkHeaderHistoryService markHeaderHistoryService;
|
|
|
@Resource
|
|
|
private SysUserService sysUserService;
|
|
|
@Resource
|
|
@@ -149,7 +146,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
@Override
|
|
|
public void releaseByMarkUserGroup(MarkUserQuestion markUserGroup) {
|
|
|
TaskLock taskLock = TaskLockUtil.getFormalTask(getGroupKey(markUserGroup));
|
|
|
- taskLock.clear(markUserGroup.getId());
|
|
|
+ taskLock.clear(markUserGroup.getUserId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -340,15 +337,14 @@ 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()), null);
|
|
|
+ checkStudentQuestion(markArbitrateHistory.getStudentId(), markQuestionService.getById(markArbitrateHistory.getQuestionId()), null);
|
|
|
// 评卷质量重新统计
|
|
|
List<MarkUserQuestion> markUserGroups = markUserQuestionService.listByExamIdAndPaperNumberAndQuestionId(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(), markArbitrateHistory.getQuestionId());
|
|
|
markUserGroups.forEach(m -> this.updateQuality(m));
|
|
|
}
|
|
|
|
|
|
private String getGroupKey(MarkUserQuestion markUserGroup) {
|
|
|
-// return markUserGroup.getExamId() + "_" + markUserGroup.getPaperNumber() + "_" + markUserGroup.getId();
|
|
|
- return String.valueOf(markUserGroup.getId());
|
|
|
+ return markUserGroup.getExamId() + "_" + markUserGroup.getPaperNumber();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -358,23 +354,23 @@ public class MarkServiceImpl implements MarkService {
|
|
|
* @param markQuestion
|
|
|
* @param result
|
|
|
*/
|
|
|
- private void checkStudentGroup(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
|
|
|
+ private void checkStudentQuestion(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
|
|
|
if (calculateQuestionId(markQuestion, studentId)) {
|
|
|
//更新考生分组分数
|
|
|
updateStudentQuestionScore(studentId, markQuestion, result);
|
|
|
- //未分组的题目
|
|
|
- long unGroupQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(
|
|
|
- markQuestion.getExamId(), markQuestion.getPaperNumber(), false);
|
|
|
- checkStudentSubjective(studentId, unGroupQuestionCount);
|
|
|
+ checkStudentSubjective(studentId, markQuestion.getExamId(), markQuestion.getPaperNumber());
|
|
|
} else {
|
|
|
markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void checkStudentSubjective(Long studentId, long unGroupQuestionCount) {
|
|
|
- // todo 所有任务是否已完成
|
|
|
- if (unGroupQuestionCount == 0) {
|
|
|
+ public void checkStudentSubjective(Long studentId, Long examId, String paperNumber) {
|
|
|
+ long unBindMarkerQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
|
|
|
+ long questionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
|
|
|
+ long subjectiveScoreCount = markSubjectiveScoreService.countByStudentId(studentId);
|
|
|
+ // 主观题数大于0,主观题全部绑定了评卷员,考生小题分数数量等于主观题数量
|
|
|
+ if (questionCount > 0 && unBindMarkerQuestionCount == 0 && questionCount == subjectiveScoreCount) {
|
|
|
scoreCalculate(studentId);
|
|
|
} else {//否则更新该学生主观题状态为未阅卷
|
|
|
markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
|
|
@@ -547,7 +543,6 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
|
|
|
private boolean calculateQuestionId(MarkQuestion markQuestion, Long studentId) {
|
|
|
- // 未设置算分策略的情况下,默认取平均分
|
|
|
List<MarkTask> list = markTaskService.listByExamIdAndPaperNumberAndQuestionIdAndStudentId(markQuestion.getExamId(),
|
|
|
markQuestion.getPaperNumber(), markQuestion.getId(), studentId);
|
|
|
if (list.isEmpty()) {
|
|
@@ -584,7 +579,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
Map<Integer, Double> scoreMap = new HashMap<>();
|
|
|
|
|
|
// 循环所有主观得分明细
|
|
|
- List<MarkSubjectiveScore> list = markSubjectiveScoreService.listByStudentIdAndQuestionId(studentId, null);
|
|
|
+ List<MarkSubjectiveScore> list = markSubjectiveScoreService.listByStudentId(studentId);
|
|
|
// list.sort(null);
|
|
|
for (MarkSubjectiveScore ss : list) {
|
|
|
List<MarkSubjectiveScore> mainScoreList = mainScoreMap.get(ss.getMainNumber());
|
|
@@ -730,12 +725,12 @@ public class MarkServiceImpl implements MarkService {
|
|
|
try {
|
|
|
lockService.watch(LockType.QUESTION, groupResult.getQuestionId());
|
|
|
Long currentTime = System.currentTimeMillis();
|
|
|
- updateMarkSubjectScore(markStudent, groupResult);
|
|
|
+ updateMarkSubjectScore(markStudent, groupResult, userId);
|
|
|
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()), null);
|
|
|
+ checkStudentQuestion(groupResult.getStudentId(), markQuestionService.getById(groupResult.getQuestionId()), null);
|
|
|
} catch (ApiException e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
} finally {
|
|
@@ -744,32 +739,42 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
|
|
|
// 未分组的题目
|
|
|
- long unGroupQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(
|
|
|
- markStudent.getExamId(), markStudent.getPaperNumber(), false);
|
|
|
- checkStudentSubjective(markStudent.getId(), unGroupQuestionCount);
|
|
|
+// checkStudentSubjective(markStudent.getId(), markStudent.getExamId(), markStudent.getPaperNumber());
|
|
|
}
|
|
|
|
|
|
- private void updateMarkSubjectScore(MarkStudent markStudent, MarkHeaderGroupResult groupResult) {
|
|
|
- List<MarkSubjectiveScore> markSubjectiveScoreList = markSubjectiveScoreService.listByStudentIdAndQuestionId(markStudent.getId(), groupResult.getQuestionId());
|
|
|
- markSubjectiveScoreList.sort(Comparator.comparing(MarkSubjectiveScore::getMainNumber)
|
|
|
- .thenComparingInt(MarkSubjectiveScore::getSubNumber));
|
|
|
+ private void updateMarkSubjectScore(MarkStudent markStudent, MarkHeaderGroupResult groupResult, Long userId) {
|
|
|
// 记录修改日志(按小题)
|
|
|
- List<BasicOperationLog> basicOperationLogs = new ArrayList<>();
|
|
|
- MarkSubjectiveScore markSubjectiveScore = markSubjectiveScoreList.get(0);
|
|
|
+// List<BasicOperationLog> basicOperationLogs = new ArrayList<>();
|
|
|
+ MarkSubjectiveScore markSubjectiveScore = markSubjectiveScoreService.getByStudentIdAndQuestionId(markStudent.getId(), groupResult.getQuestionId());
|
|
|
double score = markSubjectiveScore.getScore();
|
|
|
// 分数有变动,记录日志
|
|
|
if (groupResult.getScore() != score) {
|
|
|
- MarkStudentVo markStudentVo = markStudentService.getDetailById(markStudent.getId());
|
|
|
- String detail = String.format("%s(%s)课程%s试卷编号下,将%s(%s)的%s题从%s分修改为%s分", markStudentVo.getCourseName(), markStudentVo.getCourseCode(), markStudentVo.getPaperNumber(), markStudentVo.getStudentName(), markStudentVo.getStudentCode(), markSubjectiveScore.getMainNumber() + "-" + markSubjectiveScore.getSubNumber(), markSubjectiveScore.getScore(), score);
|
|
|
- basicOperationLogs.add(new BasicOperationLog(Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString()), ServletUtil.getCurrentPrivilegeId(), OperationTypeEnum.SUBJECTIVE, OperationTypeEnum.SUBJECTIVE.getName(), ServletUtil.getRequest().getServletPath(), detail, String.valueOf(groupResult.getScore()), "成功", ServletUtil.getRequestUserId()));
|
|
|
+// MarkStudentVo markStudentVo = markStudentService.getDetailById(markStudent.getId());
|
|
|
+// String detail = String.format("%s(%s)课程%s试卷编号下,将%s(%s)的%s题从%s分修改为%s分", markStudentVo.getCourseName(), markStudentVo.getCourseCode(), markStudentVo.getPaperNumber(), markStudentVo.getStudentName(), markStudentVo.getStudentCode(), markSubjectiveScore.getMainNumber() + "-" + markSubjectiveScore.getSubNumber(), markSubjectiveScore.getScore(), score);
|
|
|
+// basicOperationLogs.add(new BasicOperationLog(Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString()), ServletUtil.getCurrentPrivilegeId(), OperationTypeEnum.SUBJECTIVE, OperationTypeEnum.SUBJECTIVE.getName(), ServletUtil.getRequest().getServletPath(), detail, String.valueOf(groupResult.getScore()), "成功", ServletUtil.getRequestUserId()));
|
|
|
+ MarkHeaderHistory headerHistory = new MarkHeaderHistory();
|
|
|
+ headerHistory.setId(SystemConstant.getDbUuid());
|
|
|
+ headerHistory.setExamId(markStudent.getExamId());
|
|
|
+ headerHistory.setPaperNumber(markStudent.getPaperNumber());
|
|
|
+ headerHistory.setStudentId(markStudent.getId());
|
|
|
+ headerHistory.setQuestionId(markSubjectiveScore.getQuestionId());
|
|
|
+ headerHistory.setMainNumber(markSubjectiveScore.getMainNumber());
|
|
|
+ headerHistory.setSubNumber(markSubjectiveScore.getSubNumber());
|
|
|
+ headerHistory.setUserId(userId);
|
|
|
+ headerHistory.setScore(score);
|
|
|
+ headerHistory.setTrackList(JSON.toJSONString(groupResult.getTrackList()));
|
|
|
+ headerHistory.setOriginalScore(markSubjectiveScore.getScore());
|
|
|
+// headerHistory.setOriginalTrackList();
|
|
|
+ headerHistory.setCreateTime(System.currentTimeMillis());
|
|
|
+ markHeaderHistoryService.save(headerHistory);
|
|
|
}
|
|
|
markSubjectiveScore.setScore(score);
|
|
|
markSubjectiveScoreService.saveOrUpdateByMultiId(markSubjectiveScore);
|
|
|
|
|
|
// 记录日志
|
|
|
- if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
|
|
|
- basicOperationLogService.saveBatch(basicOperationLogs);
|
|
|
- }
|
|
|
+// if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
|
|
|
+// basicOperationLogService.saveBatch(basicOperationLogs);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private String getKey(MarkStudent student) {
|
|
@@ -1079,7 +1084,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
resetStudentGroup(task.getStudentId());
|
|
|
} else {
|
|
|
// 判断当前分组是否已完成评卷
|
|
|
- checkStudentGroup(task.getStudentId(), markQuestion, result);
|
|
|
+ checkStudentQuestion(task.getStudentId(), markQuestion, result);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -1110,7 +1115,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
public void checkStudentSubjectiveScore(Long examId, String coursePaperId, long unGroupQuestionCount) {
|
|
|
List<MarkStudent> markStudentList = markStudentService.listByExamIdAndCoursePaperId(examId, coursePaperId);
|
|
|
for (MarkStudent markStudent : markStudentList) {
|
|
|
- checkStudentSubjective(markStudent.getId(), unGroupQuestionCount);
|
|
|
+// checkStudentSubjective(markStudent.getId(), unGroupQuestionCount, markQuestion.getPaperNumber());
|
|
|
}
|
|
|
}
|
|
|
|