ソースを参照

refactor: 修改了题库url参数

xuxiaopang 2 年 前
親
コミット
26d4116085

+ 4 - 1
judgement-server/src/main/java/cn/seecoder/judgement/service/impl/JudgementServiceImpl.java

@@ -7,6 +7,7 @@ import cn.seecoder.judgement.service.JudgementService;
 import cn.seecoder.judgement.service.QuestionService;
 import cn.seecoder.judgement.vo.JudgedAnswersVO;
 import cn.seecoder.judgement.vo.question.BaseQuestionVO;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.time.ZoneOffset;
@@ -20,6 +21,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 @Service
 public class JudgementServiceImpl implements JudgementService {
     private final QuestionService questionService;
+    @Value("${bok.host}")
+    private String bokHost;
 
     public JudgementServiceImpl(QuestionService questionService){
         this.questionService = questionService;
@@ -65,7 +68,7 @@ public class JudgementServiceImpl implements JudgementService {
         });
         JudgedAnswersVO res = new JudgedAnswersVO(judgedAnswers);
 
-        SeecoderBokClient seecoderBokClient = new SeecoderBokClient("https://bok.seec.seecoder.cn");
+        SeecoderBokClient seecoderBokClient = new SeecoderBokClient(bokHost);
         List<RecordVO> recordVOS = seecoderBokClient.createUserRecord(judgedAnswerRecords);
 
         System.out.println("results are as follows:");

+ 5 - 1
judgement-server/src/main/java/cn/seecoder/judgement/service/impl/QuestionServiceImpl.java

@@ -5,6 +5,7 @@ import cn.seecoder.bok.common.vo.RecordVO;
 import cn.seecoder.judgement.service.QuestionService;
 import cn.seecoder.judgement.vo.question.BaseQuestionVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -29,9 +30,12 @@ public class QuestionServiceImpl implements QuestionService {
 }
 */
 public class QuestionServiceImpl implements QuestionService {
+    @Value("${bok.host}")
+    private String bokHost;
+
     @Override
     public List<BaseQuestionVO> getQuestionsByIds(List<String> questionIds) {
-        SeecoderBokClient seecoderBokClient = new SeecoderBokClient("https://bok.seec.seecoder.cn");
+        SeecoderBokClient seecoderBokClient = new SeecoderBokClient(bokHost);
         List<BaseQuestionVO> list1 = seecoderBokClient.getQuestionListByIds(questionIds).stream()
                 .map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true))
                 .collect(Collectors.toList());

+ 4 - 1
judgement-server/src/main/resources/application.yml

@@ -3,4 +3,7 @@ spring:
     name: seec-playground
     url: jdbc:mysql://environment-23-38.seec.svc.cluster.local:3306/seec-playground?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
     username: root
-    password: NJU67mysql
+    password: NJU67mysql
+
+bok:
+  host: http://environment-26-43.seec.svc.cluster.local:8080