|
|
@@ -4648,6 +4648,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
List<String> strings = extractPureText(markdown);
|
|
|
questionReset(strings,major,exam);
|
|
|
}
|
|
|
+
|
|
|
+ Files.delete(Paths.get("result.json"));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -4671,6 +4673,45 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
CourseSubject courseSubject = iCourseSubjectService.getOne(new LambdaQueryWrapper<CourseSubject>().in(CourseSubject::getId, subIds).eq(CourseSubject::getSubjectName, majorName).last("limit 1"));
|
|
|
Long subId = courseSubject.getId();
|
|
|
|
|
|
+ //添加试卷
|
|
|
+ Long examId = 0L;
|
|
|
+ QuestionWaiBuBo bo1 = new QuestionWaiBuBo();
|
|
|
+ bo1.setEduId(eduId);
|
|
|
+ bo1.setProId(proId);
|
|
|
+ bo1.setBusinessId(businessId);
|
|
|
+ bo1.setSubId(subId);
|
|
|
+ bo1.setContent(exam);
|
|
|
+ Exam examEntity = baseMapper.getExamByWaiBu(bo1);
|
|
|
+ if (ObjectUtils.isNull(examEntity)){
|
|
|
+ //新增
|
|
|
+ Exam exam2 = new Exam();
|
|
|
+ exam2.setExamName(exam);
|
|
|
+ exam2.setCode(ServletUtils.getEncoded("SJ"));
|
|
|
+ exam2.setCreateTime(DateUtils.getNowTime());
|
|
|
+ exam2.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ exam2.setPrefixName(String.format("外部系统拉取试卷(%s)",DateUtils.getDate()));
|
|
|
+ exam2.setPublishStatus(1L);
|
|
|
+ exam2.setYear(2026L);
|
|
|
+ exam2.setStatus(1);
|
|
|
+ exam2.setDoType(1);
|
|
|
+ //试卷类型ID
|
|
|
+ ExamPaper paper = iExamPaperService.getOne(new LambdaUpdateWrapper<ExamPaper>().eq(ExamPaper::getStatus, 1).eq(ExamPaper::getPaperName, "普通练习").last("limit 1"));
|
|
|
+ exam2.setExamPaperId(paper.getPaperId());
|
|
|
+ iExamService.save(exam2);
|
|
|
+ //业务乘次
|
|
|
+ QuestionBusiness questionBusiness = new QuestionBusiness();
|
|
|
+ questionBusiness.setEducationTypeId(eduId);
|
|
|
+ questionBusiness.setProjectId(proId);
|
|
|
+ questionBusiness.setBusinessId(businessId);
|
|
|
+ questionBusiness.setSubjectId(subId);
|
|
|
+ questionBusiness.setType(2);
|
|
|
+ questionBusiness.setMajorId(exam2.getExamId());
|
|
|
+ iQuestionBusinessService.save(questionBusiness);
|
|
|
+ examId = exam2.getExamId();
|
|
|
+ }else {
|
|
|
+ examId = examEntity.getExamId();
|
|
|
+ }
|
|
|
+
|
|
|
//题库ID
|
|
|
Long questionId = 0L;
|
|
|
//处理题库
|
|
|
@@ -4755,6 +4796,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness.setType(1);
|
|
|
questionBusiness.setMajorId(question.getQuestionId());
|
|
|
iQuestionBusinessService.save(questionBusiness);
|
|
|
+ saveExamQuestion(question.getQuestionId(),examId);
|
|
|
}
|
|
|
|
|
|
//案例题小题
|
|
|
@@ -4875,6 +4917,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
question.setJsonStr(JSONArray.toJSONString(infoVoList));
|
|
|
save(question);
|
|
|
questionId = question.getQuestionId();
|
|
|
+ saveExamQuestion(questionId,examId);
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
@@ -4907,6 +4950,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
question.setAnswerQuestion(simpleConvert(answer));
|
|
|
save(question);
|
|
|
questionId = question.getQuestionId();
|
|
|
+ saveExamQuestion(questionId,examId);
|
|
|
}
|
|
|
|
|
|
if (bt.contains("多选题")){
|
|
|
@@ -4937,6 +4981,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
question.setAnswerQuestion(simpleConvert(answer));
|
|
|
save(question);
|
|
|
questionId = question.getQuestionId();
|
|
|
+ saveExamQuestion(questionId,examId);
|
|
|
}
|
|
|
|
|
|
if (bt.contains("判断题")){
|
|
|
@@ -4958,6 +5003,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
question.setAnswerQuestion(answer.contains("错") ? "0":"1");
|
|
|
save(question);
|
|
|
questionId = question.getQuestionId();
|
|
|
+ saveExamQuestion(questionId,examId);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -4976,6 +5022,20 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void saveExamQuestion(Long questionId,Long examId){
|
|
|
+ ExamQuestion examQuestion = new ExamQuestion();
|
|
|
+ examQuestion.setExamId(examId);
|
|
|
+ examQuestion.setQuestionId(questionId);
|
|
|
+ //获取最新排序
|
|
|
+ Integer sort = 0;
|
|
|
+ ExamQuestion one = iExamQuestionService.getOne(new LambdaUpdateWrapper<ExamQuestion>().eq(ExamQuestion::getExamId, examId).orderByDesc(ExamQuestion::getSort));
|
|
|
+ if (ObjectUtils.isNotNull(one)){
|
|
|
+ sort = one.getSort() +1;
|
|
|
+ }
|
|
|
+ examQuestion.setSort(sort);
|
|
|
+ iExamQuestionService.save(examQuestion);
|
|
|
+ }
|
|
|
+
|
|
|
public static String simpleConvert(String letters) {
|
|
|
String result = letters.toUpperCase()
|
|
|
.replaceAll("[^A-E]", "") // 只保留A-E
|