|
@@ -1,6 +1,7 @@
|
|
|
package com.qmth.teachcloud.report.business.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.Answer;
|
|
@@ -63,11 +64,20 @@ public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {
|
|
|
sum = sum.add(tbPaperStruct.getFullScore());
|
|
|
}
|
|
|
if (totalScore.compareTo(sum) != 0) {
|
|
|
- String paperNumber = courseCode.substring(0,courseCode.length() - tbPaper.getPaperType().length());
|
|
|
- throw ExceptionResultEnum.ERROR.exception("试卷总分和试卷结构中各个题目分数之和不一致," +
|
|
|
- "请试卷编号为: 【" + paperNumber + "】的命题老师在知学知考教研分析板块下按照如下操作重新配置试卷总分和及格分:" +
|
|
|
+ String paperNumber = courseCode.substring(0, courseCode.length() - tbPaper.getPaperType().length());
|
|
|
+ String paperType = tbPaper.getPaperType();
|
|
|
+ final String regex = "T";
|
|
|
+ String errorMessage = "试卷总分和试卷结构中各个题目分数之和不一致," +
|
|
|
+ "请试卷编号为: 【" + paperNumber + "】" + regex + "的命题老师在知学知考教研分析板块下按照如下操作重新配置试卷总分和及格分:" +
|
|
|
"数据初始化 -> 基础配置 -> 诊断规则定义 -> 更新满分,及格分,并检查满分为命题蓝图设置中各个题目分数之和 -> 保存。" +
|
|
|
- "之后管理员再重新计算该分析批次。");
|
|
|
+ "之后管理员再重新计算该分析批次。";
|
|
|
+ if (SystemConstant.strNotNull(paperType)) {
|
|
|
+ // 试卷类型不为空 替换T
|
|
|
+ errorMessage = errorMessage.replaceAll(regex, ",试卷类型为: (" + paperType + ")");
|
|
|
+ } else {
|
|
|
+ errorMessage = errorMessage.replaceAll(regex, "");
|
|
|
+ }
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(errorMessage);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -75,26 +85,26 @@ public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {
|
|
|
@Override
|
|
|
public void checkExamStudentAnswer(Long schoolId, Long examId, String courseCode) {
|
|
|
TBPaper tbPaper = tbPaperService.getOne(new QueryWrapper<TBPaper>().lambda()
|
|
|
- .eq(TBPaper::getExamId,examId)
|
|
|
- .eq(TBPaper::getCourseCode,courseCode));
|
|
|
- if (Objects.isNull(tbPaper)){
|
|
|
+ .eq(TBPaper::getExamId, examId)
|
|
|
+ .eq(TBPaper::getCourseCode, courseCode));
|
|
|
+ if (Objects.isNull(tbPaper)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到试卷信息");
|
|
|
}
|
|
|
Long paperId = tbPaper.getId();
|
|
|
// 试卷结构蓝图
|
|
|
List<TBPaperStruct> tbPaperStructList = tbPaperStructService.list(new QueryWrapper<TBPaperStruct>().lambda()
|
|
|
- .eq(TBPaperStruct::getPaperId,paperId));
|
|
|
+ .eq(TBPaperStruct::getPaperId, paperId));
|
|
|
|
|
|
- List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getPaperId,paperId));
|
|
|
- if (tbExamRecordList.isEmpty()){
|
|
|
+ List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getPaperId, paperId));
|
|
|
+ if (tbExamRecordList.isEmpty()) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("没有找到考生成绩记录");
|
|
|
}
|
|
|
List<Long> examStudentIdList = tbExamRecordList.stream().map(TBExamRecord::getExamStudentId).collect(Collectors.toList());
|
|
|
|
|
|
// 考生(不缺考的)
|
|
|
List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>()
|
|
|
- .lambda()
|
|
|
- .in(TBExamStudent::getId,examStudentIdList))
|
|
|
+ .lambda()
|
|
|
+ .in(TBExamStudent::getId, examStudentIdList))
|
|
|
.stream()
|
|
|
.filter(e -> !e.getAbsent())
|
|
|
.collect(Collectors.toList());
|
|
@@ -102,22 +112,22 @@ public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {
|
|
|
// 有效的考生成绩记录
|
|
|
List<TBExamRecord> effectTBExamRecordList = tbExamRecordList.stream().filter(e -> effectStudentIdList.contains(e.getExamStudentId())).collect(Collectors.toList());
|
|
|
List<Long> effectRecordIdList = effectTBExamRecordList.stream().map(TBExamRecord::getId).collect(Collectors.toList());
|
|
|
- if (effectRecordIdList.isEmpty()){
|
|
|
+ if (effectRecordIdList.isEmpty()) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("缺少有效的考生");
|
|
|
}
|
|
|
|
|
|
// 作答
|
|
|
// 1.考生人数对应检查 - 本地试卷结构数量 * 考生数 =? 考生作答总记录数
|
|
|
- List<TBAnswer> tbAnswerList = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId,effectRecordIdList));
|
|
|
- Map<Integer,Long> recordAnswerCountCheckMap = new HashMap<>();
|
|
|
- Map<Long,List<TBAnswer>> recordAnswerMap = new HashMap<>();
|
|
|
+ List<TBAnswer> tbAnswerList = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId, effectRecordIdList));
|
|
|
+ Map<Integer, Long> recordAnswerCountCheckMap = new HashMap<>();
|
|
|
+ Map<Long, List<TBAnswer>> recordAnswerMap = new HashMap<>();
|
|
|
for (Long effectRecordId : effectRecordIdList) {
|
|
|
List<TBAnswer> cell = tbAnswerList.stream().filter(e -> Objects.equals(e.getExamRecordId(), effectRecordId)).collect(Collectors.toList());
|
|
|
- recordAnswerMap.put(effectRecordId,cell);
|
|
|
- recordAnswerCountCheckMap.put(cell.size(),effectRecordId);
|
|
|
+ recordAnswerMap.put(effectRecordId, cell);
|
|
|
+ recordAnswerCountCheckMap.put(cell.size(), effectRecordId);
|
|
|
}
|
|
|
|
|
|
- if (recordAnswerCountCheckMap.keySet().size() > 1){
|
|
|
+ if (recordAnswerCountCheckMap.keySet().size() > 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("同一个试卷不同考生作答记录数量不一致");
|
|
|
}
|
|
|
|
|
@@ -138,12 +148,21 @@ public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {
|
|
|
answer.setSubNumber(e.getSmallQuestionNumber());
|
|
|
return Stream.of(answer);
|
|
|
}).collect(Collectors.toList());
|
|
|
- if (!Answer.matchTwoAnswerList(al1,al2)){
|
|
|
- String paperNumber = courseCode.substring(0,courseCode.length() - tbPaper.getPaperType().length());
|
|
|
- throw ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.exception("考生作答中的试卷结构和分析参数中配置的试卷结构不一致(检查内容 : 题目类型(主观题、客观题),大题号,小题号)," +
|
|
|
- "请试卷编号为: 【" + paperNumber + "】的命题老师在知学知考教研分析板块下按照如下操作重新配置试卷结构:" +
|
|
|
+ if (!Answer.matchTwoAnswerList(al1, al2)) {
|
|
|
+ String paperNumber = courseCode.substring(0, courseCode.length() - tbPaper.getPaperType().length());
|
|
|
+ String paperType = tbPaper.getPaperType();
|
|
|
+ final String regex = "T";
|
|
|
+ String errorMessage = "考生作答中的试卷结构和分析参数中配置的试卷结构不一致(检查内容 : 题目类型(主观题、客观题),大题号,小题号)," +
|
|
|
+ "请试卷编号为: 【" + paperNumber + "】" + regex + "的命题老师在知学知考教研分析板块下按照如下操作重新配置试卷结构:" +
|
|
|
"数据初始化 -> 基础配置 -> 命题蓝图设置 -> 更新试卷结构 -> 保存。" +
|
|
|
- "之后管理员再重新计算该分析批次。(" + ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.getCode() + ")");
|
|
|
+ "之后管理员再重新计算该分析批次。[" + ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.getCode() + "]";
|
|
|
+ if (SystemConstant.strNotNull(paperType)) {
|
|
|
+ // 试卷类型不为空 替换T
|
|
|
+ errorMessage = errorMessage.replaceAll(regex, ",试卷类型为: (" + paperType + ")");
|
|
|
+ } else {
|
|
|
+ errorMessage = errorMessage.replaceAll(regex, "");
|
|
|
+ }
|
|
|
+ throw ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.exception(errorMessage);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -173,7 +192,7 @@ public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {
|
|
|
List<String> needRepeatCourseCodeList = new ArrayList<>();
|
|
|
for (String courseCode : courseCodeList) {
|
|
|
// 新增
|
|
|
- if (analyzeDataGetAndEditService.dataGetAndEdit(examId, courseCode, schoolId)){
|
|
|
+ if (analyzeDataGetAndEditService.dataGetAndEdit(examId, courseCode, schoolId)) {
|
|
|
// 如果要重算 则记录该课程
|
|
|
needRepeatCourseCodeList.add(courseCode);
|
|
|
// 检查
|