From 409c68b0d42f38f80ee09e91491f9bfa869bee7d Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Wed, 20 Nov 2024 16:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=98=E7=9B=AE=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TheoryTestController.java | 3 --- .../service/impl/TheoryTestServiceImpl.java | 13 +++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java b/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java index b46cbf0..ecf37b4 100644 --- a/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java +++ b/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java @@ -56,9 +56,6 @@ public class TheoryTestController { } catch (IOException e) { 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); } diff --git a/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java index 7c8fd5c..748524d 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java @@ -491,18 +491,20 @@ public class TheoryTestServiceImpl implements TheoryTestService { return objectiveQuestionList; } else { //在两个小时内 返回最近的一条试卷 String singleIds = stuTheoryExam.getSingleIds(); - String multipleIds = stuTheoryExam.getMultipleIds(); //todo 测试考试中心只有单选题的考试 是否会报错 + String multipleIds = stuTheoryExam.getMultipleIds(); 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<>(); 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); returnQuestionList.addAll(mulQuestionList); } 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); returnQuestionList.addAll(judgeQuestionList); } @@ -741,10 +743,9 @@ public class TheoryTestServiceImpl implements TheoryTestService { if (ids == null || ids.length() <= 2) { return Collections.emptyList(); } - return Arrays.asList(ids.substring(1, ids.length() - 1).split(", ")); + return Arrays.asList(ids.split(", ")); } - // // @Override // public List<ObjectiveQuestionWithBLOBs> selectErrors(String userId, String schoolId) {