修改题目回显接口逻辑

master
xiaoCJ 4 months ago
parent 014ac3b232
commit 409c68b0d4

@ -56,9 +56,6 @@ public class TheoryTestController {
} catch (IOException e) { } catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "服务器异常,请联系管理员"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "服务器异常,请联系管理员");
} }
for (int i = 0; i < list.size(); i++) {
list.get(i).setSource(String.valueOf(i + 1));
}
return new ResultEntity<>(HttpStatus.OK, "开始考试、客观题列表查询成功", list); return new ResultEntity<>(HttpStatus.OK, "开始考试、客观题列表查询成功", list);
} }

@ -491,18 +491,20 @@ public class TheoryTestServiceImpl implements TheoryTestService {
return objectiveQuestionList; return objectiveQuestionList;
} else { //在两个小时内 返回最近的一条试卷 } else { //在两个小时内 返回最近的一条试卷
String singleIds = stuTheoryExam.getSingleIds(); String singleIds = stuTheoryExam.getSingleIds();
String multipleIds = stuTheoryExam.getMultipleIds(); //todo 测试考试中心只有单选题的考试 是否会报错 String multipleIds = stuTheoryExam.getMultipleIds();
String judgeIds = stuTheoryExam.getJudgeIds(); String judgeIds = stuTheoryExam.getJudgeIds();
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
List<String> singleIdList = Arrays.asList(singleIds.split(", "));
System.out.println(Collections.singletonList(singleIdList).size());
List<ObjectiveQuestionWithBLOBs> returnQuestionList = new ArrayList<>(); List<ObjectiveQuestionWithBLOBs> returnQuestionList = new ArrayList<>();
if (StringUtils.isNotBlank(multipleIds)) { if (StringUtils.isNotBlank(multipleIds)) {
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", ")); List<String> multipleIdList = Arrays.asList(multipleIds.split(", "));
List<ObjectiveQuestionWithBLOBs> mulQuestionList = selectBatchByIdList(multipleIdList); List<ObjectiveQuestionWithBLOBs> mulQuestionList = selectBatchByIdList(multipleIdList);
returnQuestionList.addAll(mulQuestionList); returnQuestionList.addAll(mulQuestionList);
} }
if (StringUtils.isNotBlank(judgeIds)) { if (StringUtils.isNotBlank(judgeIds)) {
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", ")); List<String> judgeIdList = Arrays.asList(judgeIds.split(", "));
List<ObjectiveQuestionWithBLOBs> judgeQuestionList = selectBatchByIdList(judgeIdList); List<ObjectiveQuestionWithBLOBs> judgeQuestionList = selectBatchByIdList(judgeIdList);
returnQuestionList.addAll(judgeQuestionList); returnQuestionList.addAll(judgeQuestionList);
} }
@ -741,10 +743,9 @@ public class TheoryTestServiceImpl implements TheoryTestService {
if (ids == null || ids.length() <= 2) { if (ids == null || ids.length() <= 2) {
return Collections.emptyList(); return Collections.emptyList();
} }
return Arrays.asList(ids.substring(1, ids.length() - 1).split(", ")); return Arrays.asList(ids.split(", "));
} }
// //
// @Override // @Override
// public List<ObjectiveQuestionWithBLOBs> selectErrors(String userId, String schoolId) { // public List<ObjectiveQuestionWithBLOBs> selectErrors(String userId, String schoolId) {

Loading…
Cancel
Save