|
|
@@ -1,6 +1,7 @@
|
|
|
package nju.seec.helper.service.impl;
|
|
|
|
|
|
import nju.seec.helper.dao.QuizDAO;
|
|
|
+import nju.seec.helper.dao.UserDAO;
|
|
|
import nju.seec.helper.dto.user.LoginUser;
|
|
|
import nju.seec.helper.entity.Quiz;
|
|
|
import nju.seec.helper.service.QuestionService;
|
|
|
@@ -24,11 +25,16 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class QuestionServiceImpl implements QuestionService {
|
|
|
private final QuizDAO quizDAO;
|
|
|
+ private final UserDAO userDAO;
|
|
|
+
|
|
|
private final BokUtil bokUtil;
|
|
|
|
|
|
@Autowired
|
|
|
- public QuestionServiceImpl(QuizDAO quizDAO, BokUtil bokUtil) {
|
|
|
+ public QuestionServiceImpl(QuizDAO quizDAO
|
|
|
+ , UserDAO userDAO
|
|
|
+ , BokUtil bokUtil) {
|
|
|
this.quizDAO = quizDAO;
|
|
|
+ this.userDAO = userDAO;
|
|
|
this.bokUtil = bokUtil;
|
|
|
}
|
|
|
|
|
|
@@ -37,11 +43,6 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
return bokUtil.bokFindByStemLike(stem, pageable, true);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public BaseQuestionVO getQuestion(String questionId) {
|
|
|
- return bokUtil.bokFindById(questionId, true);
|
|
|
- }
|
|
|
-
|
|
|
@Transactional(readOnly = true)
|
|
|
@Override
|
|
|
public List<BaseQuestionVO> getQuestionsByQuiz(LoginUser user, Long quizId) {
|
|
|
@@ -57,27 +58,9 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
return bokUtil.bokFindByIdIn(questionIds, true);
|
|
|
}
|
|
|
|
|
|
- // @Override
|
|
|
-// public BaseQuestionVO newQuestion(BaseQuestionVO newQuestion) {
|
|
|
-// try {
|
|
|
-// return bokUtil.postNewQuestion(newQuestion);
|
|
|
-// } catch (JsonProcessingException e) {
|
|
|
-// throw HelperException.of(ExceptionType.ERROR, "请求BOK题库数据错误:" + e.getMessage());
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public BaseQuestionVO updateQuestion(BaseQuestionVO newQuestion) {
|
|
|
-// try {
|
|
|
-// return bokUtil.putQuestion(newQuestion);
|
|
|
-// } catch (JsonProcessingException e) {
|
|
|
-// throw HelperException.of(ExceptionType.ERROR, "请求BOK题库数据错误:" + e.getMessage());
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void deleteQuestion(String questionId) {
|
|
|
-// bokUtil.deleteQuestion(questionId);
|
|
|
-// }
|
|
|
-
|
|
|
+ @Transactional(readOnly = true)
|
|
|
+ @Override
|
|
|
+ public BaseQuestionVO getOneQuestion(LoginUser user, String questionId) {
|
|
|
+ return bokUtil.bokFindById(questionId, true);
|
|
|
+ }
|
|
|
}
|