Parcourir la source

fix : 重命名错误的bug

XuShengTao il y a 6 ans
Parent
commit
5d1e323df6

+ 1 - 1
src/main/java/nju/seec/helper/service/impl/QuizServiceImpl.java

@@ -153,7 +153,7 @@ public class QuizServiceImpl implements QuizService {
     public Integer upStudentAnswer(Long quizId, Long uid, List<QuestionStudentAnswerDTO> answers) {
         Assert.notNull(quizId,"错误的测试!");
         final Quiz quiz = quizDAO.findQuizById(quizId);
-        if(quiz.getState()!=QuizState.ONGOING){throw HelperException.of(ExceptionType.FORBIDDEN,"不能提交尚未开始的作业!");}
+        if(quiz.getState()!=QuizState.ONGOING){throw HelperException.of(ExceptionType.FORBIDDEN,"不能提交尚未开始或已经结束的作业!");}
         User student =new User();student.setId(uid);
         Set<QuizStudentAnswer> quizAnswers = quizStudentAnswerDAO.findByStudentAndQuiz(student,quiz);
         Set<String> questionIdSet = new HashSet<>(quiz.getQuestions());

+ 4 - 2
src/main/java/nju/seec/helper/util/BokUtil.java

@@ -91,8 +91,10 @@ public class BokUtil {
                 throw new RuntimeException("bok request error!for findByIdIn:" + Arrays.toString(requestIds.toArray()));
             }
             List<BaseQuestionVO> collect = parseBody(tqs);
+
             Map<String,Object> newGet=new HashMap<>(collect.size());
             for (BaseQuestionVO vo : collect) {
+                System.out.println(vo);
                 questionsMap.put(vo.getQuestionId(), vo);
                 newGet.put(vo.getQuestionId(),vo);
             }
@@ -117,12 +119,12 @@ public class BokUtil {
             case "choice":
                 return ChoiceQuestionVO.builder().stem((String) q.get("stem")).kind(QuestionKindState.CHOICE)
                         .options((Map<String, String>) q.get("options")).answer(((String) q.get("answer")).replaceAll("【答案】", ""))
-                        .analysis((String) q.get("analysis")).questionId(String.valueOf((Integer) q.get("tqId"))).build();
+                        .analysis((String) q.get("analysis")).questionId(String.valueOf((Integer) q.get("tq_id"))).build();
 
             case "true_false":
                 return TrueOrFalseQuestionVO.builder().stem((String) q.get("stem")).kind(QuestionKindState.TRUE_FALSE)
                         .answer(Boolean.valueOf((String) q.get("answer")))
-                        .analysis((String) q.get("analysis")).questionId(String.valueOf((Integer) q.get("tqId"))).build();
+                        .analysis((String) q.get("analysis")).questionId(String.valueOf((Integer) q.get("tq_id"))).build();
             default:
         }
         throw HelperException.of(ExceptionType.ERROR,"unknown type:" + (String) q.get("type"));

+ 3 - 0
src/main/java/nju/seec/helper/vo/quiz/BaseQuestionVO.java

@@ -11,6 +11,7 @@ import nju.seec.helper.util.enums.ExceptionType;
 import nju.seec.helper.util.enums.QuestionKindState;
 import nju.seec.helper.util.exception.HelperException;
 
+import javax.validation.constraints.NotNull;
 import java.util.Map;
 
 /**
@@ -21,8 +22,10 @@ import java.util.Map;
 @AllArgsConstructor
 @SuperBuilder
 public abstract class BaseQuestionVO {
+    @NotNull
     @JsonProperty(value = "id")
     private String questionId;
+    @NotNull
     @JsonProperty(value = "kind")
     private QuestionKindState kind;
     @JsonProperty(value = "stem")