|
@@ -51,7 +51,6 @@ import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ForkJoinTask;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -325,8 +324,10 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
TBTaskHistory tbTaskHistory = (TBTaskHistory) map.get("tbTaskHistory");
|
|
|
JSONObject jsonObject = Objects.nonNull(tbTaskHistory.getRemark()) ? JSONObject.parseObject(tbTaskHistory.getRemark()) : null;
|
|
|
Integer totalTaskSize = 1, currentTaskSize = 1, jsTotalTaskSize = 0, jsCurrentTaskSize = 0;
|
|
|
- Long cloudMarkExamId = null;
|
|
|
+ //测试
|
|
|
+// Long cloudMarkExamId = 576L;
|
|
|
|
|
|
+ Long cloudMarkExamId = null;
|
|
|
TEExam teExam = teExamService.cacheConvert(examCacheBean);
|
|
|
if (Objects.isNull(tbTaskHistory.getEntityId())) {
|
|
|
cloudMarkExamId = cloudMarkUtil.callExamSaveApi(new SaveExamParams(orgId, null, examCode, examCacheBean.getName(), DateUtil.format(new Date(examCacheBean.getStartTime()), Constants.DEFAULT_DATE_PATTERN)));
|
|
@@ -354,15 +355,26 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
|
|
|
//推送试卷科目
|
|
|
Set<Long> examPaperIdSet = pushExamPaperLogic(map, jsonObject, totalTaskSize, jsCurrentTaskSize, currentTaskSize, cloudMarkExamId);
|
|
|
- if (CollectionUtils.isEmpty(examPaperIdSet)) {
|
|
|
- throw new BusinessException("没有考试试卷信息");
|
|
|
- }
|
|
|
+
|
|
|
+ //测试
|
|
|
+// QueryWrapper<TEExamPaper> teExamPaperQueryWrapper = new QueryWrapper<>();
|
|
|
+// teExamPaperQueryWrapper.lambda().eq(TEExamPaper::getExamId, examId)
|
|
|
+// .gt(TEExamPaper::getTotalSubjectiveScore, 0).orderByAsc(TEExamPaper::getId);
|
|
|
+// List<TEExamPaper> teExamPaperList = teExamPaperService.list(teExamPaperQueryWrapper);
|
|
|
+// if (CollectionUtils.isEmpty(teExamPaperList)) {
|
|
|
+// throw new BusinessException("没有考试试卷");
|
|
|
+// }
|
|
|
+// Set<Long> examPaperIdSet = teExamPaperList.stream().map(s -> s.getId()).collect(Collectors.toSet());
|
|
|
|
|
|
//获取所有待阅卷的考生
|
|
|
List<TEExamStudent> teExamStudentList = getExamStudentNeedMarkAll(map, jsonObject, teExam, examPaperIdSet, jsTotalTaskSize, jsCurrentTaskSize);
|
|
|
+ //测试
|
|
|
+// teExamStudentList = teExamStudentList.stream().filter(s -> s.getId().longValue() == 1607955922658508822L).collect(Collectors.toList());
|
|
|
|
|
|
//获取只有一次考试记录的考生
|
|
|
List<TOeExamRecord> tOeExamRecordList = getExamRecordOnce(map, jsonObject, examPaperIdSet);
|
|
|
+ //测试
|
|
|
+// tOeExamRecordList.clear();
|
|
|
|
|
|
//获取多次考试记录的考试
|
|
|
List<TOeExamRecord> tOeExamRecordManyList = tOeExamRecordService.findExamRecordNeedMarkAll(examId, examPaperIdSet, true);
|
|
@@ -508,8 +520,12 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
Integer totalTaskSize = jsonObject.getInteger("totalTaskSize");
|
|
|
Integer currentTaskSize = jsonObject.getInteger("currentTaskSize");
|
|
|
|
|
|
- Map<Long, TOeExamRecord> tOeExamRecordMap = tOeExamRecordList.stream().collect(
|
|
|
- Collectors.toMap(TOeExamRecord::getExamStudentId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
+// Map<Long, TOeExamRecord> tOeExamRecordMap = tOeExamRecordList.stream().collect(
|
|
|
+// Collectors.toMap(TOeExamRecord::getExamStudentId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
+ LinkedMultiValueMap<Long, TOeExamRecord> tOeExamRecordMap = new LinkedMultiValueMap<>();
|
|
|
+ for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
+ tOeExamRecordMap.add(t.getExamStudentId(), t);
|
|
|
+ }
|
|
|
|
|
|
Map<Long, Map<String, Integer>> paperStructMap = new HashMap<>();
|
|
|
List<File> recordJsonList = new ArrayList<>(teExamStudentList.size());
|
|
@@ -530,35 +546,37 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
continue;
|
|
|
} else {
|
|
|
- TOeExamRecord tOeExamRecord = tOeExamRecordMap.get(t.getId());
|
|
|
- if (Objects.isNull(tOeExamRecord)) {
|
|
|
+ List<TOeExamRecord> tOeExamRecordExamStudentList = tOeExamRecordMap.get(t.getId());
|
|
|
+ if (CollectionUtils.isEmpty(tOeExamRecordExamStudentList)) {
|
|
|
continue;
|
|
|
}
|
|
|
- String courseCode = t.getCourseCode() + SystemConstant.JOINT_MARK + tOeExamRecord.getPaperId();
|
|
|
- cloudMarkUtil.callStudentSaveApi(new SaveStudentParams(orgId, cloudMarkExamId, String.valueOf(tOeExamRecord.getId()),
|
|
|
- t.getIdentity(),
|
|
|
- t.getName(),
|
|
|
- tbOrg.getName(),
|
|
|
- Objects.isNull(t.getClassNo()) ? SystemConstant.VALUE_OF_BLANK_REQUIRED_FIELD : t.getClassNo(),
|
|
|
- SystemConstant.VALUE_OF_BLANK_REQUIRED_FIELD,
|
|
|
- courseCode,
|
|
|
- t.getCourseName()));
|
|
|
- OpenRecordNeedMarkBean openRecordNeedMarkBean = GsonUtil.fromJson(GsonUtil.toJson(tOeExamRecord), OpenRecordNeedMarkBean.class);
|
|
|
- List<OpenRecordAnswerTempBean> answersTemp = examAnswerService.findByExamRecordId(tOeExamRecord.getId());
|
|
|
- openRecordNeedMarkBean = SystemConstant.filterAnswer(openRecordNeedMarkBean, answersTemp, paperStructMap);
|
|
|
- if (!CollectionUtils.isEmpty(openRecordNeedMarkBean.getAnswers())) {
|
|
|
- File fileAnswerJson = new File(SystemConstant.TEMP_FILES_DIR + File.separator + CloudMarkFileUploadTypeEnum.ANSWER.getCode() + File.separator + SystemConstant.getUuid() + SystemConstant.JSON_PREFIX);
|
|
|
- if (!fileAnswerJson.exists()) {
|
|
|
- fileAnswerJson.getParentFile().mkdirs();
|
|
|
- fileAnswerJson.createNewFile();
|
|
|
+ for (TOeExamRecord tOeExamRecord : tOeExamRecordExamStudentList) {
|
|
|
+ String courseCode = t.getCourseCode() + SystemConstant.JOINT_MARK + tOeExamRecord.getPaperId();
|
|
|
+ cloudMarkUtil.callStudentSaveApi(new SaveStudentParams(orgId, cloudMarkExamId, String.valueOf(tOeExamRecord.getId()),
|
|
|
+ t.getIdentity(),
|
|
|
+ t.getName(),
|
|
|
+ tbOrg.getName(),
|
|
|
+ Objects.isNull(t.getClassNo()) ? SystemConstant.VALUE_OF_BLANK_REQUIRED_FIELD : t.getClassNo(),
|
|
|
+ SystemConstant.VALUE_OF_BLANK_REQUIRED_FIELD,
|
|
|
+ courseCode,
|
|
|
+ t.getCourseName()));
|
|
|
+ OpenRecordNeedMarkBean openRecordNeedMarkBean = GsonUtil.fromJson(GsonUtil.toJson(tOeExamRecord), OpenRecordNeedMarkBean.class);
|
|
|
+ List<OpenRecordAnswerTempBean> answersTemp = examAnswerService.findByExamRecordId(tOeExamRecord.getId());
|
|
|
+ openRecordNeedMarkBean = SystemConstant.filterAnswer(openRecordNeedMarkBean, answersTemp, paperStructMap);
|
|
|
+ if (!CollectionUtils.isEmpty(openRecordNeedMarkBean.getAnswers())) {
|
|
|
+ File fileAnswerJson = new File(SystemConstant.TEMP_FILES_DIR + File.separator + CloudMarkFileUploadTypeEnum.ANSWER.getCode() + File.separator + SystemConstant.getUuid() + SystemConstant.JSON_PREFIX);
|
|
|
+ if (!fileAnswerJson.exists()) {
|
|
|
+ fileAnswerJson.getParentFile().mkdirs();
|
|
|
+ fileAnswerJson.createNewFile();
|
|
|
+ }
|
|
|
+ IOUtils.write(JacksonUtil.parseJson(openRecordNeedMarkBean.getAnswers()).getBytes(SystemConstant.CHARSET_NAME), new FileOutputStream(fileAnswerJson));
|
|
|
+ recordJsonList.add(fileAnswerJson);
|
|
|
+ cloudMarkUtil.callFileUploadApi(new FileUploadParams(orgId, cloudMarkExamId, String.valueOf(tOeExamRecord.getId()), fileAnswerJson, CloudMarkFileUploadTypeEnum.JSON));
|
|
|
}
|
|
|
- IOUtils.write(JacksonUtil.parseJson(openRecordNeedMarkBean.getAnswers()).getBytes(SystemConstant.CHARSET_NAME), new FileOutputStream(fileAnswerJson));
|
|
|
- recordJsonList.add(fileAnswerJson);
|
|
|
- cloudMarkUtil.callFileUploadApi(new FileUploadParams(orgId, cloudMarkExamId, String.valueOf(tOeExamRecord.getId()), fileAnswerJson, CloudMarkFileUploadTypeEnum.JSON));
|
|
|
+ jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
+ currentTaskSize++;
|
|
|
+ tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
}
|
|
|
- jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
- currentTaskSize++;
|
|
|
- tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
}
|
|
|
}
|
|
|
progress = new BigDecimal(currentTaskSize).divide(new BigDecimal(totalTaskSize), 2, BigDecimal.ROUND_HALF_UP).multiply(b);
|
|
@@ -629,6 +647,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
//客观分最高,客观分相同则全部提交阅卷
|
|
|
final double score = highestObjectiveScore;
|
|
|
finalResult.addAll(tempResult.stream().filter(bean -> bean.getObjectiveScore() == score).collect(Collectors.toList()));
|
|
|
+ if (finalResult.size() > 1) {
|
|
|
+ TOeExamRecord tOeExamRecord = finalResult.stream().max((p1, p2) -> Long.compare(p1.getFinishTime(), p2.getFinishTime())).get();
|
|
|
+ finalResult.clear();
|
|
|
+ finalResult.add(tOeExamRecord);
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case LATEST:
|