|
@@ -806,7 +806,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
for (ExamPapers examPapers : examPapersList) {
|
|
|
//获取是否考试状态并赋值
|
|
|
userExamPapersList1 = iUserExamPapersService.UserExamPapersList(userExamId, examPapers.getPaperId());
|
|
|
- if (userExamPapersList1.size() == 0) {
|
|
|
+ if (userExamPapersList1.isEmpty()) {
|
|
|
examPapers.setState(9);
|
|
|
} else {
|
|
|
examPapers.setState(userExamPapersList1.get(0).getState());
|
|
@@ -901,21 +901,18 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
// dto.setExamPapersList(examPapersList);
|
|
|
// return dto;
|
|
|
}
|
|
|
- public UserExamDTO userExamResultDetails(String paperId,boolean needAnswerFlag, boolean needAnalysis, boolean needClearBlankContent, boolean needRenderBlank) {
|
|
|
+ public UserExamDTO userExamResultDetails(String examId,String paperId,boolean needAnswerFlag, boolean needAnalysis, boolean needClearBlankContent, boolean needRenderBlank) {
|
|
|
UserExamDTO dto = new UserExamDTO();
|
|
|
- List<UserExam> listuserExam = userExamService.listUserExamYueJuans(paperId);
|
|
|
+ List<UserExam> listuserExam = userExamService.listUserExamYueJuans(examId,paperId);
|
|
|
UserExam userExam = new UserExam();
|
|
|
String userExamId="";
|
|
|
- if (listuserExam.size()>0) {
|
|
|
+ if (!listuserExam.isEmpty()) {
|
|
|
userExam=listuserExam.get(0);
|
|
|
userExamId=userExam.getId();
|
|
|
}else {
|
|
|
throw new JeecgBootException("没有可阅卷的试卷!");
|
|
|
}
|
|
|
//显示试卷详情
|
|
|
- if (Objects.isNull(userExam)) {
|
|
|
- throw new JeecgBootException("考试不存在!");
|
|
|
- }
|
|
|
BeanUtils.copyProperties(userExam, dto);
|
|
|
List<UserExamQuestion> userExamQuestionList = dto.getUserExamQuestionList();
|
|
|
List<Map<String, AnswerCardDTO>> answerCardList = new ArrayList<>();
|
|
@@ -962,10 +959,104 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
dto.setExamPapersList(examPapersList);
|
|
|
return dto;
|
|
|
}
|
|
|
+ public UserExamDTO ybuserExamResultDetails(String examId,String paperId,boolean needAnswerFlag, boolean needAnalysis, boolean needClearBlankContent, boolean needRenderBlank) {
|
|
|
+ UserExamDTO dto = new UserExamDTO();
|
|
|
+ List<UserExam> listuserExam = userExamService.yblistUserExamYueJuans(examId,paperId);
|
|
|
+ UserExam userExam = new UserExam();
|
|
|
+ String userExamId="";
|
|
|
+ if (!listuserExam.isEmpty()) {
|
|
|
+ userExam=listuserExam.get(0);
|
|
|
+ userExamId=userExam.getId();
|
|
|
+ }else {
|
|
|
+ throw new JeecgBootException("没有可阅卷的试卷!");
|
|
|
+ }
|
|
|
+ System.out.println("yyz显示"+userExam);
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(userExam, dto);
|
|
|
+ List<UserExamQuestion> userExamQuestionList = dto.getUserExamQuestionList();
|
|
|
+ List<Map<String, AnswerCardDTO>> answerCardList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(userExamQuestionList)) {
|
|
|
+ List<UserExamQuestion> rootQuestionList = userExamQuestionList.stream().filter(r -> !Objects.isNull(r.getChild()) && !r.getChild())
|
|
|
+ .sorted(Comparator.comparing(UserExamQuestion::getQuestionIndex)).collect(Collectors.toList());
|
|
|
+ List<UserExamQuestion> childQuestionList = userExamQuestionList.stream().filter(r -> !Objects.isNull(r.getChild()) && r.getChild())
|
|
|
+ .sorted(Comparator.comparing(UserExamQuestion::getQuestionIndex)).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(rootQuestionList)) {
|
|
|
+ //获取题目和答案
|
|
|
+ assembleUserExamQuestion(userExamId, rootQuestionList, childQuestionList, needAnswerFlag, needAnalysis, false, true, needClearBlankContent);
|
|
|
+
|
|
|
+ //设置题目
|
|
|
+ setUserExamQuestion(rootQuestionList, needRenderBlank);
|
|
|
+
|
|
|
+ //设置答题卡
|
|
|
+ setAnswerCard(rootQuestionList, answerCardList);
|
|
|
+ dto.setUserExamQuestionList(rootQuestionList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setAnswerCardList(answerCardList);
|
|
|
+ return dto;
|
|
|
+// String userExamId="";
|
|
|
+// if (listuserExam.size()>0) {
|
|
|
+// userExam=listuserExam.get(0);
|
|
|
+// userExamId=userExam.getId();
|
|
|
+// }else {
|
|
|
+// throw new JeecgBootException("没有可阅卷的试卷!");
|
|
|
+// }
|
|
|
+// //显示试卷详情
|
|
|
+// if (Objects.isNull(userExam)) {
|
|
|
+// throw new JeecgBootException("考试不存在!");
|
|
|
+// }
|
|
|
+// BeanUtils.copyProperties(userExam, dto);
|
|
|
+// List<UserExamQuestion> userExamQuestionList = dto.getUserExamQuestionList();
|
|
|
+// List<Map<String, AnswerCardDTO>> answerCardList = new ArrayList<>();
|
|
|
+// List< AnswerCardDTO> answerCardList2 = new ArrayList<>();
|
|
|
+// if (!CollectionUtils.isEmpty(userExamQuestionList)) {
|
|
|
+// List<UserExamQuestion> rootQuestionList = userExamQuestionList.stream().filter(r -> !Objects.isNull(r.getChild()) && !r.getChild())
|
|
|
+// .sorted(Comparator.comparing(UserExamQuestion::getQuestionIndex)).collect(Collectors.toList());
|
|
|
+// List<UserExamQuestion> childQuestionList = userExamQuestionList.stream().filter(r -> !Objects.isNull(r.getChild()) && r.getChild())
|
|
|
+// .sorted(Comparator.comparing(UserExamQuestion::getQuestionIndex)).collect(Collectors.toList());
|
|
|
+// if (!CollectionUtils.isEmpty(rootQuestionList)) {
|
|
|
+// //获取题目和答案
|
|
|
+// assembleUserExamQuestion(userExamId, rootQuestionList, childQuestionList, needAnswerFlag, needAnalysis, false, true, needClearBlankContent);
|
|
|
+//
|
|
|
+// //设置题目
|
|
|
+// setUserExamQuestion(rootQuestionList, needRenderBlank);
|
|
|
+//
|
|
|
+// //设置答题卡
|
|
|
+// setAnswerCard(rootQuestionList, answerCardList);
|
|
|
+// setAnswerCard2(rootQuestionList, answerCardList2);
|
|
|
+// dto.setUserExamQuestionList(rootQuestionList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// dto.setAnswerCardList(answerCardList);
|
|
|
+// dto.setAnswerCardList2(answerCardList2);
|
|
|
+//// //获取有没有正在考试的试卷信息
|
|
|
+//// LambdaQueryWrapper<UserExamPapers> wrapperpaper = new LambdaQueryWrapper<UserExamPapers>();
|
|
|
+//// wrapperpaper.eq(UserExamPapers::getUserExamId, userExam.getId())
|
|
|
+//// .eq(UserExamPapers::getState, PaperState.ING);
|
|
|
+//// List<UserExamPapers> userExamPapersList=BeanContext.getApplicationContext().getBean(IUserExamPapersService.class).list(wrapperpaper);
|
|
|
+//// //获取本地当前时间
|
|
|
+//// userExamPapersList.get(0).setSystemTime(new Date());
|
|
|
+//// //在返回值中添加考试试卷信息
|
|
|
+//// dto.setUserExamPapersList(userExamPapersList);
|
|
|
+// //添加当前考试的所有试卷信息
|
|
|
+// List<ExamPapers> examPapersList=iExamPapersService.getExamIdPaper(userExam.getExamId());
|
|
|
+// List<UserExamPapers> userExamPapersList1=new ArrayList<UserExamPapers>();
|
|
|
+// for (ExamPapers examPapers : examPapersList) {
|
|
|
+// //获取是否考试状态并赋值
|
|
|
+// userExamPapersList1 = iUserExamPapersService.UserExamPapersList(userExamId, examPapers.getPaperId());
|
|
|
+// if (userExamPapersList1.size() == 0) {
|
|
|
+// examPapers.setState(9);
|
|
|
+// } else {
|
|
|
+// examPapers.setState(userExamPapersList1.get(0).getState());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// dto.setExamPapersList(examPapersList);
|
|
|
+// return dto;
|
|
|
+ }
|
|
|
/**
|
|
|
* 用户考试成绩详情,包括答题卡,试题(包含正确答案和解析)
|
|
|
*
|
|
@@ -999,8 +1090,15 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public UserExamDTO userExamResultDetails(String paperId) {
|
|
|
- UserExamDTO userExamDTO = userExamResultDetails(paperId, true, true, false, true);
|
|
|
+ public UserExamDTO userExamResultDetails(String examId,String paperId) {
|
|
|
+ UserExamDTO userExamDTO = userExamResultDetails(examId,paperId, true, true, false, true);
|
|
|
+ //设置单选题/多选题/判断题的答案tag
|
|
|
+ setAnswerTag(userExamDTO);
|
|
|
+ return userExamDTO;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public UserExamDTO ybuserExamResultDetails(String examId,String paperId) {
|
|
|
+ UserExamDTO userExamDTO = ybuserExamResultDetails(examId,paperId, true, true, false, true);
|
|
|
//设置单选题/多选题/判断题的答案tag
|
|
|
setAnswerTag(userExamDTO);
|
|
|
return userExamDTO;
|