|
@@ -9,11 +9,11 @@ import com.qmth.distributed.print.business.service.ExamStudentService;
|
|
import com.qmth.distributed.print.business.service.ExamTaskDetailService;
|
|
import com.qmth.distributed.print.business.service.ExamTaskDetailService;
|
|
import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
|
+import com.qmth.teachcloud.common.entity.MarkQuestion;
|
|
import com.qmth.teachcloud.common.enums.UploadFileEnum;
|
|
import com.qmth.teachcloud.common.enums.UploadFileEnum;
|
|
import com.qmth.teachcloud.common.util.ExamTaskUtil;
|
|
import com.qmth.teachcloud.common.util.ExamTaskUtil;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
-import com.qmth.teachcloud.common.entity.MarkQuestion;
|
|
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
|
|
import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
|
|
import com.qmth.teachcloud.mark.enums.CardSource;
|
|
import com.qmth.teachcloud.mark.enums.CardSource;
|
|
@@ -77,12 +77,16 @@ public class PrintFinishServiceImpl implements PrintFinishService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void insertMarkPaper(Long examId, String courseCode, String courseName, String paperNumber, String packageCode, Long userId, String paperType) {
|
|
public void insertMarkPaper(Long examId, String courseCode, String courseName, String paperNumber, String packageCode, Long userId, String paperType) {
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
- if (markPaper != null) {
|
|
|
|
- return;
|
|
|
|
|
|
+ try {
|
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
+ if (markPaper != null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ MarkPaper insertMarkPaper = new MarkPaper(examId, courseCode, courseName, paperNumber, packageCode, userId, paperType);
|
|
|
|
+ markPaperService.save(insertMarkPaper);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.info("同步考试课程失败");
|
|
}
|
|
}
|
|
- MarkPaper insertMarkPaper = new MarkPaper(examId, courseCode, courseName, paperNumber, packageCode, userId, paperType);
|
|
|
|
- markPaperService.save(insertMarkPaper);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@@ -165,13 +169,13 @@ public class PrintFinishServiceImpl implements PrintFinishService {
|
|
try {
|
|
try {
|
|
FileUtils.forceDeleteOnExit(jsonFile);
|
|
FileUtils.forceDeleteOnExit(jsonFile);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- throw new RuntimeException(e);
|
|
|
|
|
|
+ log.info("删除jsonFile失败");
|
|
}
|
|
}
|
|
if (inputStream != null) {
|
|
if (inputStream != null) {
|
|
try {
|
|
try {
|
|
inputStream.close();
|
|
inputStream.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- throw new RuntimeException(e);
|
|
|
|
|
|
+ log.info("关闭inputStream流失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -183,56 +187,60 @@ public class PrintFinishServiceImpl implements PrintFinishService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void insertMarkQuestion(Long examId, String paperNumber, String content) {
|
|
public void insertMarkQuestion(Long examId, String paperNumber, String content) {
|
|
- List<Struct> structList = CardParseUtils.parseCardContent(content);
|
|
|
|
- if (CollectionUtils.isEmpty(structList)) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
- if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
|
- List<MarkQuestion> markQuestions = new ArrayList<>();
|
|
|
|
- for (Struct struct : structList) {
|
|
|
|
- MarkQuestion markQuestion = new MarkQuestion();
|
|
|
|
- markQuestion.setId(SystemConstant.getDbUuid());
|
|
|
|
- markQuestion.setExamId(examId);
|
|
|
|
- markQuestion.setPaperNumber(paperNumber);
|
|
|
|
- markQuestion.setObjective(struct.getObjective());
|
|
|
|
- markQuestion.setMainNumber(struct.getMainNumber());
|
|
|
|
- markQuestion.setSubNumber(struct.getSubNumber());
|
|
|
|
- markQuestion.setMainTitle(struct.getMainTitle());
|
|
|
|
- markQuestion.setQuestionType(struct.getType());
|
|
|
|
- markQuestion.setPaperIndex(struct.getPaperIndex());
|
|
|
|
- markQuestion.setPageIndex(struct.getPageIndex());
|
|
|
|
- markQuestions.add(markQuestion);
|
|
|
|
|
|
+ try {
|
|
|
|
+ List<Struct> structList = CardParseUtils.parseCardContent(content);
|
|
|
|
+ if (CollectionUtils.isEmpty(structList)) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- markQuestionService.saveBatch(markQuestions);
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
- if (CollectionUtils.isNotEmpty(scanAnswerCardList)) {
|
|
|
|
- for (ScanAnswerCard scanAnswerCard : scanAnswerCardList) {
|
|
|
|
- int count = scanPaperService.getCountByExamAndCardNumber(examId, scanAnswerCard.getNumber());
|
|
|
|
- if (count > 0) return;
|
|
|
|
|
|
+ List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
+ if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
|
+ List<MarkQuestion> markQuestions = new ArrayList<>();
|
|
|
|
+ for (Struct struct : structList) {
|
|
|
|
+ MarkQuestion markQuestion = new MarkQuestion();
|
|
|
|
+ markQuestion.setId(SystemConstant.getDbUuid());
|
|
|
|
+ markQuestion.setExamId(examId);
|
|
|
|
+ markQuestion.setPaperNumber(paperNumber);
|
|
|
|
+ markQuestion.setObjective(struct.getObjective());
|
|
|
|
+ markQuestion.setMainNumber(struct.getMainNumber());
|
|
|
|
+ markQuestion.setSubNumber(struct.getSubNumber());
|
|
|
|
+ markQuestion.setMainTitle(struct.getMainTitle());
|
|
|
|
+ markQuestion.setQuestionType(struct.getType());
|
|
|
|
+ markQuestion.setPaperIndex(struct.getPaperIndex());
|
|
|
|
+ markQuestion.setPageIndex(struct.getPageIndex());
|
|
|
|
+ markQuestions.add(markQuestion);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ markQuestionService.saveBatch(markQuestions);
|
|
|
|
+ } else {
|
|
|
|
|
|
- // todo 题卡变动后,结构数据处理逻辑
|
|
|
|
- if (structList.size() == markQuestionList.size()) {
|
|
|
|
- for (int i = 0; i < structList.size(); i++) {
|
|
|
|
- Struct struct = structList.get(i);
|
|
|
|
- MarkQuestion markQuestion = markQuestionList.get(i);
|
|
|
|
- if (markQuestion.getGroupNumber() != null) {
|
|
|
|
- if (struct.getMainNumber() == markQuestion.getMainNumber()
|
|
|
|
- && struct.getSubNumber() == markQuestion.getSubNumber()
|
|
|
|
- && struct.getObjective().equals(markQuestion.getObjective())
|
|
|
|
- && struct.getType() == markQuestion.getQuestionType()
|
|
|
|
- && struct.getMainTitle().equals(markQuestion.getMainTitle())) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(scanAnswerCardList)) {
|
|
|
|
+ for (ScanAnswerCard scanAnswerCard : scanAnswerCardList) {
|
|
|
|
+ int count = scanPaperService.getCountByExamAndCardNumber(examId, scanAnswerCard.getNumber());
|
|
|
|
+ if (count > 0) return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
|
|
|
|
|
|
+ // todo 题卡变动后,结构数据处理逻辑
|
|
|
|
+ if (structList.size() == markQuestionList.size()) {
|
|
|
|
+ for (int i = 0; i < structList.size(); i++) {
|
|
|
|
+ Struct struct = structList.get(i);
|
|
|
|
+ MarkQuestion markQuestion = markQuestionList.get(i);
|
|
|
|
+ if (markQuestion.getGroupNumber() != null) {
|
|
|
|
+ if (struct.getMainNumber() == markQuestion.getMainNumber()
|
|
|
|
+ && struct.getSubNumber() == markQuestion.getSubNumber()
|
|
|
|
+ && struct.getObjective().equals(markQuestion.getObjective())
|
|
|
|
+ && struct.getType() == markQuestion.getQuestionType()
|
|
|
|
+ && struct.getMainTitle().equals(markQuestion.getMainTitle())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.info("同步结构失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|