|
@@ -9,7 +9,6 @@ import com.qmth.distributed.print.business.bean.dto.ExamPaperObjectiveStructureD
|
|
|
import com.qmth.distributed.print.business.bean.dto.ExamPaperSubjectiveStructureDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.SyncExamCardDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto;
|
|
|
-import com.qmth.distributed.print.business.bean.marking.EvaluationParameters;
|
|
|
import com.qmth.distributed.print.business.bean.params.SyncDataParam;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
|
|
@@ -17,6 +16,7 @@ import com.qmth.distributed.print.business.enums.ExamPrintPlanSyncStatusEnum;
|
|
|
import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.GroupDetailDTO;
|
|
|
+import com.qmth.teachcloud.common.bean.dto.stmms.PicConfig;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.QuestionBaseDTO;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.QuestionDTO;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
@@ -389,9 +389,13 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
for (ExamPaperGroup examPaperGroup : examPaperGroups) {
|
|
|
GroupDetailDTO groupDetailDTO = new GroupDetailDTO();
|
|
|
groupDetailDTO.setNumber(examPaperGroup.getGroupNumber());
|
|
|
- groupDetailDTO.setPicList(null);
|
|
|
-// groupDetailDTO.setDoubleRate();
|
|
|
-// groupDetailDTO.setArbitrateThreshold(examPaperGroup.getArbitrateThreshold());
|
|
|
+ String picListString = examPaperGroup.getPictureConfig();
|
|
|
+ if (StringUtils.isNotBlank(picListString)) {
|
|
|
+ List<PicConfig> picConfigs = JSONObject.parseArray(picListString, PicConfig.class);
|
|
|
+ groupDetailDTO.setPicList(picConfigs);
|
|
|
+ }
|
|
|
+ groupDetailDTO.setDoubleRate(examPaperGroup.getDoubleRate());
|
|
|
+ groupDetailDTO.setArbitrateThreshold(examPaperGroup.getArbitrateThreshold());
|
|
|
groupDetailDTO.setScorePolicy(examPaperGroup.getScorePolicy().getValue());
|
|
|
// groupDetailDTO.setEnableAllZero();
|
|
|
groupDetailDTO.setMarkMode("");
|
|
@@ -415,7 +419,7 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
for (ExamPaperGroup examPaperGroup : examPaperGroups) {
|
|
|
List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
|
|
|
for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
|
|
|
- stmmsUtils.saveMarkerGroup(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
|
|
|
+ stmmsUtils.saveMarker(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -427,6 +431,118 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void doSyncAnswerFile(ExamPaperStructure examPaperStructure) {
|
|
|
+ // 开始同步
|
|
|
+ examPaperStructureService.updateStatusById(examPaperStructure.getId(), ExamPaperStructureStatusEnum.START_SYNC);
|
|
|
+ ExamPaperStructureStatusEnum status = ExamPaperStructureStatusEnum.UPLOAD_FINISH;
|
|
|
+ try {
|
|
|
+ String paperTypes = examPaperStructure.getPaperType();
|
|
|
+ if (StringUtils.isBlank(paperTypes)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("没有可同步的试卷类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long schoolId = examPaperStructure.getSchoolId();
|
|
|
+ // 云阅卷考试ID
|
|
|
+ String examId = String.valueOf(examPaperStructure.getThirdRelateId());
|
|
|
+ // 科目代码(课程代码+卷型+课程序号)
|
|
|
+ String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
|
|
|
+
|
|
|
+ // 同步试卷
|
|
|
+ String paperAnswer = examPaperStructure.getPaperAnswer();
|
|
|
+ if (StringUtils.isNotBlank(paperAnswer)) {
|
|
|
+ List<JSONObject> paperAnswerJsons = JSONObject.parseArray(paperAnswer, JSONObject.class);
|
|
|
+ for (JSONObject paperAnswerJson : paperAnswerJsons) {
|
|
|
+ if (paperAnswerJson.containsKey("paperType") && paperAnswerJson.containsKey("paper")) {
|
|
|
+ String paperType = paperAnswerJson.getString("paperType");
|
|
|
+ String paper = paperAnswerJson.getString("paper");
|
|
|
+ if (StringUtils.isAnyBlank(paperType, paper)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步试卷文件
|
|
|
+ File paperFile = downFileFromFss(paper, paperType, SyncFileTypeEnum.PAPER);
|
|
|
+ String syncPaperFileUrl = stmmsUtils.syncFile(schoolId, examId, subjectCode, SyncFileTypeEnum.PAPER, paperFile);
|
|
|
+ // 试卷文件保存url
|
|
|
+ paperAnswerJson.put("paperUrl", syncPaperFileUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ status = ExamPaperStructureStatusEnum.PAPER_FINISH;
|
|
|
+ examPaperStructure.setPaperAnswer(JSONObject.toJSONString(paperAnswerJsons));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步标答
|
|
|
+ if (StringUtils.isNotBlank(paperAnswer)) {
|
|
|
+ List<JSONObject> paperAnswerJsons = JSONObject.parseArray(paperAnswer, JSONObject.class);
|
|
|
+ for (JSONObject paperAnswerJson : paperAnswerJsons) {
|
|
|
+ if (paperAnswerJson.containsKey("paperType") && paperAnswerJson.containsKey("answer")) {
|
|
|
+ String paperType = paperAnswerJson.getString("paperType");
|
|
|
+ String answer = paperAnswerJson.getString("answer");
|
|
|
+ if (StringUtils.isAnyBlank(paperType, answer)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 同步标答文件
|
|
|
+ File answerFile = downFileFromFss(answer, paperType, SyncFileTypeEnum.ANSWER);
|
|
|
+ String syncAnswerFileUrl = stmmsUtils.syncFile(schoolId, examId, subjectCode, SyncFileTypeEnum.ANSWER, answerFile);
|
|
|
+ // 标答文件保存url
|
|
|
+ paperAnswerJson.put("answerUrl", syncAnswerFileUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ examPaperStructure.setPaperAnswer(JSONObject.toJSONString(paperAnswerJsons));
|
|
|
+ }
|
|
|
+ status = ExamPaperStructureStatusEnum.ANSWER_FINISH;
|
|
|
+
|
|
|
+ } catch (ApiException e) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷结构同步失败:" + e.getMessage());
|
|
|
+ } finally {
|
|
|
+ examPaperStructure.setStatus(status);
|
|
|
+ examPaperStructureService.updateById(examPaperStructure);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void doSyncObjectiveStructure(ExamPaperStructure examPaperStructure) {
|
|
|
+ // 开始同步
|
|
|
+ examPaperStructureService.updateStatusById(examPaperStructure.getId(), ExamPaperStructureStatusEnum.START_SYNC);
|
|
|
+ ExamPaperStructureStatusEnum status = ExamPaperStructureStatusEnum.UPLOAD_FINISH;
|
|
|
+ try {
|
|
|
+ String paperTypes = examPaperStructure.getPaperType();
|
|
|
+ if (StringUtils.isBlank(paperTypes)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("没有可同步的试卷类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步客观题
|
|
|
+ String objectiveStructure = examPaperStructure.getObjectiveStructure();
|
|
|
+ if (StringUtils.isNotBlank(objectiveStructure)) {
|
|
|
+ List<JSONObject> objectiveJsons = JSONObject.parseArray(objectiveStructure, JSONObject.class);
|
|
|
+ for (JSONObject objectiveJson : objectiveJsons) {
|
|
|
+ if (objectiveJson.containsKey("paperType") && objectiveJson.containsKey("content")) {
|
|
|
+ String objectivePaperType = objectiveJson.getString("paperType");
|
|
|
+ String objectiveContent = objectiveJson.getString("content");
|
|
|
+ if (StringUtils.isAnyBlank(objectivePaperType, objectiveContent)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<ExamPaperObjectiveStructureDto> objectiveStructureDtos = JSONObject.parseArray(objectiveContent, ExamPaperObjectiveStructureDto.class);
|
|
|
+ List<QuestionDTO> syncObjectiveStructureDatas = objectiveStructureDtos.stream().map(m -> {
|
|
|
+ QuestionDTO syncStructureData = new QuestionDTO();
|
|
|
+ syncStructureData.setMainNumber(Integer.valueOf(m.getMainNumber()));
|
|
|
+ syncStructureData.setSubNumber(m.getSubNumber());
|
|
|
+ syncStructureData.setMainTitle(m.getMainName());
|
|
|
+ syncStructureData.setTotalScore(Double.valueOf(m.getScore()));
|
|
|
+ syncStructureData.setAnswer(m.getAnswer());
|
|
|
+ return syncStructureData;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ stmmsUtils.syncPaperStructure(examPaperStructure.getSchoolId(), String.valueOf(examPaperStructure.getThirdRelateId()), examPaperStructure.getPaperNumberId() + objectivePaperType, true, null, syncObjectiveStructureDatas);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ status = ExamPaperStructureStatusEnum.OBJECTIVE_FINISH;
|
|
|
+ } catch (ApiException e) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷结构同步失败:" + e.getMessage());
|
|
|
+ } finally {
|
|
|
+ examPaperStructure.setStatus(status);
|
|
|
+ examPaperStructureService.updateById(examPaperStructure);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 同步核心方法
|
|
|
*
|