|
|
@@ -14,29 +14,17 @@ import java.util.Optional;
|
|
|
|
|
|
@Service
|
|
|
public class QuestionManager {
|
|
|
- private final QuestionThirdPartyService questionThirdPartyService;
|
|
|
-
|
|
|
private final ProblemDAO problemDAO;
|
|
|
|
|
|
private final TestCaseDAO testCaseDAO;
|
|
|
|
|
|
- public QuestionManager(QuestionThirdPartyService questionThirdPartyService,
|
|
|
+ public QuestionManager(
|
|
|
ProblemDAO problemDAO,
|
|
|
TestCaseDAO testCaseDAO) {
|
|
|
- this.questionThirdPartyService = questionThirdPartyService;
|
|
|
this.problemDAO = problemDAO;
|
|
|
this.testCaseDAO = testCaseDAO;
|
|
|
}
|
|
|
|
|
|
- public Optional<CompleteQuestionVO> getQuestionById(String id) {
|
|
|
- Optional<CompleteQuestionVO> res = questionThirdPartyService.getQuestionById(id);
|
|
|
- if (!res.isPresent()) {
|
|
|
- throw new ThirdPartyServiceException("C0001", "没有对应的问题Id");
|
|
|
- } else {
|
|
|
- return res;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public Optional<Problem> getProblemById(Integer id){
|
|
|
return problemDAO.findById(id);
|
|
|
}
|