|
|
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -18,6 +19,8 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class EvalService implements SubsystemService {
|
|
|
private final HttpService httpService;
|
|
|
+ @Value("${eval.host}")
|
|
|
+ private String evalHost;
|
|
|
|
|
|
public EvalService(HttpService httpService) {
|
|
|
this.httpService = httpService;
|
|
|
@@ -25,7 +28,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject createCourse(CourseVO courseVO) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/course";
|
|
|
+ String uri = evalHost + "/api/course";
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
requestBody.put("name", courseVO.getName());
|
|
|
@@ -52,7 +55,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject findTeacherExamsByCourseId(int courseId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/teacher/course/" + courseId;
|
|
|
+ String uri = evalHost + "/api/exam/teacher/course/" + courseId;
|
|
|
String token = httpService.getToken();
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
String result = null;
|
|
|
@@ -66,7 +69,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject findStudentExamsByCourseId(int courseId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/course/" + courseId;
|
|
|
+ String uri = evalHost + "/api/exam/course/" + courseId;
|
|
|
String token = httpService.getToken();
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
String result = null;
|
|
|
@@ -80,7 +83,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject findTeacherExams(int pageNum, int pageSize, int state) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/teacher/exams";
|
|
|
+ String uri = evalHost + "/api/exam/teacher/exams";
|
|
|
String token = httpService.getToken();
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("pageSize", String.valueOf(pageSize)));
|
|
|
@@ -102,7 +105,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
|
|
|
public JSONObject createEvalExam(CreateEvalExamVO createEvalExamVO) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam";
|
|
|
+ String uri = evalHost + "/api/exam";
|
|
|
// String uri = "https://localhost:8081/api/exam";
|
|
|
String token = httpService.getToken();
|
|
|
System.out.println(token);
|
|
|
@@ -131,7 +134,7 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject findRecommendExamsByCourseId(int courseId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/recommend/" + courseId;
|
|
|
+ String uri = evalHost + "/api/exam/recommend/" + courseId;
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
@@ -142,7 +145,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getSampleExamPaperList() {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/question/sample";
|
|
|
+ String uri = evalHost + "/api/question/sample";
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
@@ -153,7 +156,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getExamQuestionAndScoreById(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/" + examId + "/questions";
|
|
|
+ String uri = evalHost + "/api/exam/" + examId + "/questions";
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
@@ -164,7 +167,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getQuestionById(String id) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/question/" + id;
|
|
|
+ String uri = evalHost + "/api/question/" + id;
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
@@ -175,7 +178,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public void setExamQuestionsBySampleExamPaper(int examId, int sampleExamPaperId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/question/sample/" + examId + "/?sampleExamPaperId=" + sampleExamPaperId;
|
|
|
+ String uri = evalHost + "/api/exam/question/sample/" + examId + "/?sampleExamPaperId=" + sampleExamPaperId;
|
|
|
String token = httpService.getToken();
|
|
|
try {
|
|
|
httpService.sendPost(uri, null, null, token);
|
|
|
@@ -185,7 +188,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getQuestionRecordsOfExamByUserId(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/record/all" + "?examId=" + examId;
|
|
|
+ String uri = evalHost + "/api/record/all" + "?examId=" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -207,7 +210,7 @@ public class EvalService implements SubsystemService {
|
|
|
if (knowledgeName != null) {
|
|
|
params += ("knowledgeName=" + knowledgeName + "&");
|
|
|
}
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/question/question" + "?" + params + "pageSize=" + pageSize + "&pageNum=" + pageNum;
|
|
|
+ String uri = evalHost + "/api/question/question" + "?" + params + "pageSize=" + pageSize + "&pageNum=" + pageNum;
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -219,7 +222,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public void updateQuestionsOfExam(Integer examId, QuestionScoreMapVO questionScoreMapVO) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/" + examId + "/questions/";
|
|
|
+ String uri = evalHost + "/api/exam/" + examId + "/questions/";
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
requestBody.put("questionScoreMap", questionScoreMapVO.getQuestionScoreMap());
|
|
|
@@ -231,7 +234,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getExamById(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/" + examId;
|
|
|
+ String uri = evalHost + "/api/exam/" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -243,7 +246,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getUsersByExamId(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/user/" + examId;
|
|
|
+ String uri = evalHost + "/api/user/" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -255,7 +258,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getReportByExamId(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/report/all?examId=" + examId;
|
|
|
+ String uri = evalHost + "/api/report/all?examId=" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -267,7 +270,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public void takeExamWithInviteCode(Integer examId, String inviteCode) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/invite/code" + "?inviteCode=" + inviteCode + "&examId=" + examId;
|
|
|
+ String uri = evalHost + "/api/exam/invite/code" + "?inviteCode=" + inviteCode + "&examId=" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
requestBody.put("inviteCode", inviteCode);
|
|
|
@@ -280,7 +283,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public void takeExamWithoutInviteCode(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/invite/code" + "?examId=" + examId;
|
|
|
+ String uri = evalHost + "/api/exam/invite/code" + "?examId=" + examId;
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
requestBody.put("examId", examId);
|
|
|
@@ -292,7 +295,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getExamListByCurrentStudent() {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/student/examList";
|
|
|
+ String uri = evalHost + "/api/exam/student/examList";
|
|
|
// String uri = "https://localhost:8081/api/exam/student/examList";
|
|
|
String token = httpService.getToken();
|
|
|
String result = null;
|
|
|
@@ -305,7 +308,7 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getExamCodeQuestionAndScoreById(Integer examId) {
|
|
|
- String uri = "https://eval-server.internal-paas.seec.seecoder.cn/api/exam/" + examId + "/questions/code";
|
|
|
+ String uri = evalHost + "/api/exam/" + examId + "/questions/code";
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendGet(uri, new ArrayList<>(), null);
|