|
@@ -450,6 +450,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
|
|
|
//推送试卷科目
|
|
|
Set<Long> examPaperIdSet = pushExamPaperLogic(map, jsonObject, totalTaskSize, jsCurrentTaskSize, currentTaskSize, cloudMarkExamId);
|
|
|
+ if (CollectionUtils.isEmpty(examPaperIdSet)) {
|
|
|
+ throw new BusinessException("没有考试试卷信息");
|
|
|
+ }
|
|
|
|
|
|
//获取所有待阅卷的考生
|
|
|
List<TEExamStudent> teExamStudentList = getExamStudentNeedMarkAll(map, jsonObject, teExam, examPaperIdSet, jsTotalTaskSize, jsCurrentTaskSize);
|
|
@@ -806,64 +809,90 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
jsonObject.put("totalTaskSize", totalTaskSize);
|
|
|
jsonObject.put("examPaperSize", teExamPaperList.size());
|
|
|
tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
- Set<Long> examPaperIdSet = new HashSet<>(teExamPaperList.size());
|
|
|
+ Set<Long> examPaperIdSet = null;
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(teExamPaperList)) {
|
|
|
paperJsonList = new ArrayList<>(teExamPaperList.size());
|
|
|
map.put("paperJsonList", paperJsonList);
|
|
|
- for (int i = 0; i < teExamPaperList.size(); i++) {
|
|
|
- TEExamPaper t = teExamPaperList.get(i);
|
|
|
- examPaperIdSet.add(t.getId());
|
|
|
- if (jsCurrentTaskSize.intValue() > 0 && currentTaskSize.intValue() < jsCurrentTaskSize.intValue()) {
|
|
|
- jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
- currentTaskSize++;
|
|
|
- tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- String courseCode = t.getCourseCode() + SystemConstant.JOINT_MARK + t.getId();
|
|
|
- cloudMarkUtil.callSubjectSaveApi(new SaveSubjectParams(orgId, cloudMarkExamId, courseCode, t.getName()));
|
|
|
- //解析试卷JSON文件
|
|
|
- JSONObject paperResult = JSONObject.parseObject(new String(ossUtil.download(false, t.getPaperViewPath()), StandardCharsets.UTF_8));
|
|
|
- paperResult.put(SystemConstant.ID, t.getId());
|
|
|
- paperResult.put("code", t.getCode());
|
|
|
- paperResult.put(SystemConstant.NAME, t.getName());
|
|
|
- if (Objects.nonNull(t.getAnswerPath())) {
|
|
|
- JSONArray detailCollection = new JSONArray();
|
|
|
- JSONArray paperDetails = paperResult.getJSONArray("details");
|
|
|
- //解析答案JSON文件
|
|
|
- JSONObject answerJson = JSONObject.parseObject(new String(ossUtil.download(false, t.getAnswerPath()), StandardCharsets.UTF_8));
|
|
|
- JSONArray answerDetails = answerJson.getJSONArray("details");
|
|
|
- for (int j = 0; j < paperDetails.size(); j++) {
|
|
|
- //遍历所有大题
|
|
|
- JSONObject paperDetail = paperDetails.getJSONObject(j);
|
|
|
- JSONObject answerDetail = findJsonObject(answerDetails, paperDetail.getIntValue("number"));
|
|
|
- //按条件过滤需要的小题同时合并答案
|
|
|
- JSONArray questionCollection = filterQuestions(paperDetail.getJSONArray("questions"),
|
|
|
- Objects.nonNull(answerDetail) ? answerDetail.getJSONArray("questions") : null, true,
|
|
|
- true);
|
|
|
- //有小题的情况下,本大题才需要被包含
|
|
|
- if (questionCollection.size() > 0) {
|
|
|
- paperDetail.put("questions", questionCollection);
|
|
|
- detailCollection.add(paperDetail);
|
|
|
+ examPaperIdSet = new HashSet<>(teExamPaperList.size());
|
|
|
+
|
|
|
+ BigDecimal progress = new BigDecimal(0);
|
|
|
+ BigDecimal b = new BigDecimal(100);
|
|
|
+
|
|
|
+ int min = 0;
|
|
|
+ int max = SystemConstant.MAX_IMPORT_SIZE, size = teExamPaperList.size();
|
|
|
+ if (max >= size) {
|
|
|
+ max = size;
|
|
|
+ }
|
|
|
+ while (max <= size) {
|
|
|
+ List<TEExamPaper> subList = teExamPaperList.subList(min, max);
|
|
|
+ for (int y = 0; y < subList.size(); y++) {
|
|
|
+ TEExamPaper t = subList.get(y);
|
|
|
+ examPaperIdSet.add(t.getId());
|
|
|
+ if (jsCurrentTaskSize.intValue() > 0 && currentTaskSize.intValue() < jsCurrentTaskSize.intValue()) {
|
|
|
+ jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
+ currentTaskSize++;
|
|
|
+ tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ String courseCode = t.getCourseCode() + SystemConstant.JOINT_MARK + t.getId();
|
|
|
+ cloudMarkUtil.callSubjectSaveApi(new SaveSubjectParams(orgId, cloudMarkExamId, courseCode, t.getName()));
|
|
|
+ //解析试卷JSON文件
|
|
|
+ JSONObject paperResult = JSONObject.parseObject(new String(ossUtil.download(false, t.getPaperViewPath()), StandardCharsets.UTF_8));
|
|
|
+ paperResult.put(SystemConstant.ID, t.getId());
|
|
|
+ paperResult.put("code", t.getCode());
|
|
|
+ paperResult.put(SystemConstant.NAME, t.getName());
|
|
|
+ if (Objects.nonNull(t.getAnswerPath())) {
|
|
|
+ JSONArray detailCollection = new JSONArray();
|
|
|
+ JSONArray paperDetails = paperResult.getJSONArray("details");
|
|
|
+ //解析答案JSON文件
|
|
|
+ JSONObject answerJson = JSONObject.parseObject(new String(ossUtil.download(false, t.getAnswerPath()), StandardCharsets.UTF_8));
|
|
|
+ JSONArray answerDetails = answerJson.getJSONArray("details");
|
|
|
+ for (int j = 0; j < paperDetails.size(); j++) {
|
|
|
+ //遍历所有大题
|
|
|
+ JSONObject paperDetail = paperDetails.getJSONObject(j);
|
|
|
+ JSONObject answerDetail = findJsonObject(answerDetails, paperDetail.getIntValue("number"));
|
|
|
+ //按条件过滤需要的小题同时合并答案
|
|
|
+ JSONArray questionCollection = filterQuestions(paperDetail.getJSONArray("questions"),
|
|
|
+ Objects.nonNull(answerDetail) ? answerDetail.getJSONArray("questions") : null, true,
|
|
|
+ true);
|
|
|
+ //有小题的情况下,本大题才需要被包含
|
|
|
+ if (questionCollection.size() > 0) {
|
|
|
+ paperDetail.put("questions", questionCollection);
|
|
|
+ detailCollection.add(paperDetail);
|
|
|
+ }
|
|
|
}
|
|
|
+ paperResult.put("details", detailCollection);
|
|
|
}
|
|
|
- paperResult.put("details", detailCollection);
|
|
|
- }
|
|
|
|
|
|
- File filePaperJson = new File(SystemConstant.TEMP_FILES_DIR + File.separator + CloudMarkFileUploadTypeEnum.PAPER.getCode() + File.separator + SystemConstant.getUuid() + ".json");
|
|
|
- if (!filePaperJson.exists()) {
|
|
|
- filePaperJson.getParentFile().mkdirs();
|
|
|
- filePaperJson.createNewFile();
|
|
|
+ File filePaperJson = new File(SystemConstant.TEMP_FILES_DIR + File.separator + CloudMarkFileUploadTypeEnum.PAPER.getCode() + File.separator + SystemConstant.getUuid() + ".json");
|
|
|
+ if (!filePaperJson.exists()) {
|
|
|
+ filePaperJson.getParentFile().mkdirs();
|
|
|
+ filePaperJson.createNewFile();
|
|
|
+ }
|
|
|
+ IOUtils.write(paperResult.toJSONString().getBytes(SystemConstant.CHARSET_NAME), new FileOutputStream(filePaperJson));
|
|
|
+ paperJsonList.add(filePaperJson);
|
|
|
+ FileUploadParams fileUploadParamsPaperJson = new FileUploadParams(orgId, cloudMarkExamId, courseCode, CloudMarkFileUploadTypeEnum.PAPER, filePaperJson);
|
|
|
+ fileUploadParamsPaperJson.setFormat(CloudMarkFileUploadTypeEnum.JSON.getCode());
|
|
|
+ cloudMarkUtil.callFileUploadApi(fileUploadParamsPaperJson);
|
|
|
+
|
|
|
+ jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
+ currentTaskSize++;
|
|
|
+ tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
}
|
|
|
- IOUtils.write(paperResult.toJSONString().getBytes(SystemConstant.CHARSET_NAME), new FileOutputStream(filePaperJson));
|
|
|
- paperJsonList.add(filePaperJson);
|
|
|
- FileUploadParams fileUploadParamsPaperJson = new FileUploadParams(orgId, cloudMarkExamId, courseCode, CloudMarkFileUploadTypeEnum.PAPER, filePaperJson);
|
|
|
- fileUploadParamsPaperJson.setFormat(CloudMarkFileUploadTypeEnum.JSON.getCode());
|
|
|
- cloudMarkUtil.callFileUploadApi(fileUploadParamsPaperJson);
|
|
|
-
|
|
|
- jsonObject.put("currentTaskSize", currentTaskSize);
|
|
|
- currentTaskSize++;
|
|
|
- tbTaskHistory.setRemark(jsonObject.toJSONString());
|
|
|
+ }
|
|
|
+ progress = new BigDecimal(currentTaskSize).divide(new BigDecimal(totalTaskSize), 2, BigDecimal.ROUND_HALF_UP).multiply(b);
|
|
|
+ if (Objects.isNull(tbTaskHistory.getProgress()) || (Objects.nonNull(tbTaskHistory.getProgress()) && tbTaskHistory.getProgress().doubleValue() < progress.doubleValue())) {
|
|
|
+ tbTaskHistory.setProgress(progress.doubleValue());
|
|
|
+ tbTaskHistoryService.updateById(tbTaskHistory);
|
|
|
+ }
|
|
|
+ if (max == size) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ min = max;
|
|
|
+ max += SystemConstant.MAX_IMPORT_SIZE;
|
|
|
+ if (max >= size) {
|
|
|
+ max = size;
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("currentTaskSize", currentTaskSize);
|