瀏覽代碼

examcloud.api.domain

deason 4 年之前
父節點
當前提交
cfc44a04c5

+ 17 - 33
src/main/java/cn/com/qmth/examcloud/app/core/SysProperty.java

@@ -7,60 +7,44 @@
 
 package cn.com.qmth.examcloud.app.core;
 
+import cn.com.qmth.examcloud.app.core.router.Server;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
-import cn.com.qmth.examcloud.app.core.router.Server;
-import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
-
 /**
  * 属性配置服务类
  */
 @Component
 public class SysProperty {
+
     @Autowired
     private CloudDiscoveryClient discoveryClient;
 
-    @Value("${$upyun.site.1.domain}")
-    private String domain;//又拍云文件服务
-    
+    @Value("${$aliyun.site.1.domain}")
+    private String fileDomain;
 
-    public String getProxyUrl(Server server) {
-        return discoveryClient.getInstanceUrl(server.getInstanceName());
-    }
+    @Value("${examcloud.api.domain}")
+    private String apiDomain;
 
-    public String getCoreBasicUrl() {
-        return discoveryClient.getInstanceUrl(Constants.EC_CORE_BASIC);
+    public String getFileDomain() {
+        return fileDomain;
     }
 
-    public String getCoreExamWorkUrl() {
-        return discoveryClient.getInstanceUrl(Constants.EC_CORE_EXAMWORK);
+    public void setFileDomain(String fileDomain) {
+        this.fileDomain = fileDomain;
     }
 
-    public String getCoreOeStudentUrl() {
-        return discoveryClient.getInstanceUrl(Constants.EC_CORE_OE_STUDENT);
+    public String getApiDomain() {
+        return apiDomain;
     }
 
-    public String getCoreOeAdminUrl() {
-//        return discoveryClient.getInstanceUrl(Constants.EC_CORE_OE_ADMIN);
-    	return PropertiesUtil.getString("oe.admin.api.domain"); 
+    public void setApiDomain(String apiDomain) {
+        this.apiDomain = apiDomain;
     }
 
-    public String getCoreQuestionUrl() {
-//        return discoveryClient.getInstanceUrl(Constants.EC_CORE_QUESTION);
-    	return PropertiesUtil.getString("question.api.domain");
-    }
-
-    public String getCoreAuthUrl() {
-        return discoveryClient.getInstanceUrl(Constants.EC_CORE_BASIC);
-    }
-
-    public String getDomain() {
-        if (domain != null) {
-            return domain.trim();
-        }
-        return "";
+    public String getProxyUrl(Server server) {
+        return discoveryClient.getInstanceUrl(server.getInstanceName());
     }
 
-}
+}

+ 9 - 4
src/main/java/cn/com/qmth/examcloud/app/core/utils/HttpClientBuilder.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.app.core.utils;
 
+import okhttp3.ConnectionPool;
 import okhttp3.OkHttpClient;
 import okhttp3.Request;
 import okhttp3.Response;
@@ -17,7 +18,7 @@ import java.util.concurrent.TimeUnit;
  */
 public class HttpClientBuilder {
 
-    private static final Logger LOG = LoggerFactory.getLogger(HttpClientBuilder.class);
+    private static Logger LOG = LoggerFactory.getLogger(HttpClientBuilder.class);
 
     private static OkHttpClient client;
 
@@ -34,11 +35,15 @@ public class HttpClientBuilder {
         INSTANCE;
 
         Client() {
+            ConnectionPool connectionPool = new ConnectionPool(10, 5L, TimeUnit.MINUTES);
+
             instance = new OkHttpClient
                     .Builder()
-                    .connectTimeout(15, TimeUnit.SECONDS)
-                    .readTimeout(30, TimeUnit.SECONDS)
-                    .writeTimeout(30, TimeUnit.SECONDS)
+                    .retryOnConnectionFailure(false)
+                    .connectionPool(connectionPool)
+                    .connectTimeout(30, TimeUnit.SECONDS)
+                    .readTimeout(60, TimeUnit.SECONDS)
+                    .writeTimeout(60, TimeUnit.SECONDS)
                     .sslSocketFactory(sslSocketFactory(), new TrustAllCert())
                     .hostnameVerifier(new TrustAllHost())
                     .build();

+ 10 - 10
src/main/java/cn/com/qmth/examcloud/app/service/impl/CoreAuthServiceImpl.java

@@ -91,7 +91,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
         }
 
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/getStudentOnLineExamInfo", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/getStudentOnLineExamInfo", sysProperty.getApiDomain());
         try {
             //执行请求
             String json = new JsonMapper().toJson(params);
@@ -161,7 +161,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
         }
 
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/auth/login", sysProperty.getCoreBasicUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/auth/login", sysProperty.getApiDomain());
         Map<String, String> params = new HashMap<>();
         params.put("accountValue", loginInfo.getAccount());
         params.put("password", loginInfo.getPassword());
@@ -205,7 +205,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result logout(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/auth/logout", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/auth/logout", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add(PARAM_KEY, key)
                 .add(PARAM_TOKEN, token)
@@ -221,7 +221,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result updateStudentPassword(String key, String token, String password, String newPassword) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/student/password", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/student/password", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("password", password)
                 .add("newPassword", newPassword)
@@ -232,7 +232,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result resetStudentPassword(String key, String token, String newPassword) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/student/password/direct", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/student/password/direct", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("newPassword", newPassword)
                 .build();
@@ -242,7 +242,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result sendSmsCode(String key, String token, String phone) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/auth/sendVerificationCode", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/auth/sendVerificationCode", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("phone", phone)
                 .build();
@@ -252,7 +252,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result code4Student(String phone, Boolean bound) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/auth/sendVerificationCode4Student", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/auth/sendVerificationCode4Student", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("phone", phone)
                 .add("bound", bound.toString())
@@ -271,7 +271,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
     @Override
     public Result userBindingPhone(String key, String token, String phone, String code) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/auth/bindSecurityPhone", sysProperty.getCoreAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/auth/bindSecurityPhone", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("phone", phone)
                 .add("verificationCode", code)
@@ -340,7 +340,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
 
 	@Override
 	public Result register(String user_id,String client_type, String ip_address) throws Exception {
-		final String requestUrl = String.format("%s/api/ecs_core/verifyCode/register", sysProperty.getCoreAuthUrl());
+		final String requestUrl = String.format("%s/api/ecs_core/verifyCode/register", sysProperty.getApiDomain());
         Map<String, Object> params = new HashMap<>();
         params.put("user_id", user_id);
         params.put("client_type", client_type);
@@ -361,7 +361,7 @@ public class CoreAuthServiceImpl implements CoreAuthService {
         }
 
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/verifyCode/gt/login", sysProperty.getCoreBasicUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/verifyCode/gt/login", sysProperty.getApiDomain());
         Map<String, String> params = new HashMap<>();
         
         

+ 2 - 2
src/main/java/cn/com/qmth/examcloud/app/service/impl/CoreBasicServiceImpl.java

@@ -31,14 +31,14 @@ public class CoreBasicServiceImpl implements CoreBasicService {
     @Override
     public Result getStudentInfo(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/student/getStudentInfoBySession", sysProperty.getCoreBasicUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/student/getStudentInfoBySession", sysProperty.getApiDomain());
         //包含头像、手机号等字段
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
 	@Override
 	public Result onlineSignal(String key, String token, Long studentId) throws Exception  {
-		final String requestUrl = String.format("%s/api/ecs_core/student/online_signal/"+studentId, sysProperty.getCoreBasicUrl());
+		final String requestUrl = String.format("%s/api/ecs_core/student/online_signal/"+studentId, sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
 	}
 

+ 5 - 5
src/main/java/cn/com/qmth/examcloud/app/service/impl/CoreExamWorkServiceImpl.java

@@ -32,7 +32,7 @@ public class CoreExamWorkServiceImpl implements CoreExamWorkService {
     @Override
     public Result getPracticeExamList(String key, String token, String studentId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/queryByNameLike?name=&examTypes=PRACTICE&studentId=%s", sysProperty.getCoreExamWorkUrl(), studentId);
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/queryByNameLike?name=&examTypes=PRACTICE&studentId=%s", sysProperty.getApiDomain(), studentId);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             String data = result.getData();
@@ -48,7 +48,7 @@ public class CoreExamWorkServiceImpl implements CoreExamWorkService {
     @Override
     public Result getExamInfo(String key, String token, Long examId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/%s", sysProperty.getCoreExamWorkUrl(), examId);
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/%s", sysProperty.getApiDomain(), examId);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //过滤掉为空的属性
@@ -60,7 +60,7 @@ public class CoreExamWorkServiceImpl implements CoreExamWorkService {
     @Override
     public Result getBeforeExamRemark(String key, String token, Long examId, String type) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/%s", sysProperty.getCoreExamWorkUrl(), examId, type);
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/%s", sysProperty.getApiDomain(), examId, type);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //过滤掉为空的属性
@@ -72,7 +72,7 @@ public class CoreExamWorkServiceImpl implements CoreExamWorkService {
     @Override
     public Result getFreezeTime(String key, String token, Long examId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/FREEZE_TIME", sysProperty.getCoreExamWorkUrl(), examId);
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/FREEZE_TIME", sysProperty.getApiDomain(), examId);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //过滤掉为空的属性
@@ -84,7 +84,7 @@ public class CoreExamWorkServiceImpl implements CoreExamWorkService {
     @Override
     public Result getUpLoadType(String key, String token, Long examId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/OFFLINE_UPLOAD_FILE_TYPE", sysProperty.getCoreExamWorkUrl(), examId);
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/OFFLINE_UPLOAD_FILE_TYPE", sysProperty.getApiDomain(), examId);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //过滤掉为空的属性

+ 33 - 33
src/main/java/cn/com/qmth/examcloud/app/service/impl/CoreOeServiceImpl.java

@@ -57,7 +57,7 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getCurrentTime(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/currentTime", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/currentTime", sysProperty.getApiDomain());
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //转换日期格式
@@ -69,14 +69,14 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getOfflineExamCourseList(String key, String token) throws Exception {
         //封装请求参数									
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/getOfflineCourse", sysProperty.getCoreOeAdminUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/getOfflineCourse", sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result startOfflineExamRecord(String key, String token, String examStudentId) throws Exception {
         //封装请求参数									
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/startOfflineExam?examStudentId=%s", sysProperty.getCoreOeAdminUrl(), examStudentId);
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/startOfflineExam?examStudentId=%s", sysProperty.getApiDomain(), examStudentId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
@@ -94,7 +94,7 @@ public class CoreOeServiceImpl implements CoreOeService {
             throw new ApiException("File must be not empty.");
         }
         //封装请求参数									
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/submitPaper?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/submitPaper?examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         MultipartBody.Builder form = new MultipartBody.Builder().setType(MultipartBody.FORM);
         RequestBody body = RequestBody.create(MediaType.parse("application/octet-stream"), fileBytes);
         form.addFormDataPart("file", fileName, body);
@@ -106,21 +106,21 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getPracticeExamCourseList(String key, String token, String examId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/queryPracticeCourseList?examId=%s", sysProperty.getCoreOeAdminUrl(), examId);
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/queryPracticeCourseList?examId=%s", sysProperty.getApiDomain(), examId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result getExamRecordHeartbeat(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/examHeartbeat", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/examHeartbeat", sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result startPracticeExamRecord(String key, String token, String examStudentId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/startExam?examStudentId=%s", sysProperty.getCoreOeStudentUrl(), examStudentId);
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/startExam?examStudentId=%s", sysProperty.getApiDomain(), examStudentId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
@@ -129,37 +129,37 @@ public class CoreOeServiceImpl implements CoreOeService {
         //封装请求参数
         String requestUrl=null;
         if("1".equals(fromCache)) {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?fromCache=1&examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         }else {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         }
         return HttpUtils.doGet(requestUrl, key, token);
     }
     @Override
     public Result getStudentExamPaperStructList(String key, String token, String examRecordId) throws Exception {
         //封装请求参数
-        String requestUrl = String.format("%s/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeStudentUrl(), examRecordId);
+        String requestUrl = String.format("%s/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?fromCache=1&examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result getExamRecordPaperQuestionList(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/findExamQuestionList", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/findExamQuestionList", sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result getExamRecordPaperQuestionDetail(String key, String token, String questionId, String examRecordId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/getQuestionContent?questionId=%s&exam_record_id=%s", sysProperty.getCoreOeStudentUrl(), questionId, examRecordId);
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/getQuestionContent?questionId=%s&exam_record_id=%s", sysProperty.getApiDomain(), questionId, examRecordId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result updateExamRecordPaperQuestionAnswer(String key, String token, Integer order, String studentAnswer,String audioPlayTimes) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/submitQuestionAnswer", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/submitQuestionAnswer", sysProperty.getApiDomain());
         List<Map> paramsList = new ArrayList<Map>();
         Map<String, Object> params = new HashMap<>();
         params.put("order", order);
@@ -174,14 +174,14 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result submitPracticeExamRecord(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/endExam", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/endExam", sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result checkOnlineExamRecord(String key, String token) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/checkExamInProgress", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/checkExamInProgress", sysProperty.getApiDomain());
         Result<String> ret=HttpUtils.doGet(requestUrl, key, token);
         if(Constants.CODE_200.equals(ret.getCode())&&StringUtils.isNotBlank(ret.getData())) {
         	JSONObject data=JSONObject.parseObject(ret.getData());
@@ -208,7 +208,7 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getExamRecordPracticeHistoryList(String key, String token, String examStudentId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/queryPracticeRecordList?examStudentId=%s", sysProperty.getCoreOeAdminUrl(), examStudentId);
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/queryPracticeRecordList?examStudentId=%s", sysProperty.getApiDomain(), examStudentId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
@@ -217,9 +217,9 @@ public class CoreOeServiceImpl implements CoreOeService {
         //封装请求参数
         String requestUrl=null;
         if("1".equals(fromCache)) {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/getPracticeDetailInfo?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/getPracticeDetailInfo?fromCache=1&examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         }else {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/getPracticeDetailInfo?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/practice/getPracticeDetailInfo?examRecordDataId=%s", sysProperty.getApiDomain(), examRecordId);
         }
         return HttpUtils.doGet(requestUrl, key, token);
     }
@@ -227,21 +227,21 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getExamRecordQuestionDetailList(String key, String token, String examRecordId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe/report/exam_detail_report/paper_question?exam_record_id=%s", sysProperty.getCoreOeStudentUrl(), examRecordId);
+        final String requestUrl = String.format("%s/api/ecs_oe/report/exam_detail_report/paper_question?exam_record_id=%s", sysProperty.getApiDomain(), examRecordId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result getExamRecordQuestionAudioPlayTimes(String key, String token, String questionId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/exam_question_playtimes?questionId=%s", sysProperty.getCoreOeStudentUrl(), questionId);
+        final String requestUrl = String.format("%s/api/exam_question_playtimes?questionId=%s", sysProperty.getApiDomain(), questionId);
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result updateExamRecordQuestionAudioPlayTimes(String key, String token, String questionId, String mediaName) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/exam_question_playtimes", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/exam_question_playtimes", sysProperty.getApiDomain());
         RequestBody formBody = new FormBody.Builder()
                 .add("questionId", questionId)
                 .add("mediaName", mediaName)
@@ -254,9 +254,9 @@ public class CoreOeServiceImpl implements CoreOeService {
         //封装请求参数
         String requestUrl=null;
         if("1".equals(fromCache)) {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/record/data/findExamRecordDataEntity?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/record/data/findExamRecordDataEntity?fromCache=1&examRecordDataId=%s", sysProperty.getApiDomain(), examRecordDataId);
         }else {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/record/data/findExamRecordDataEntity?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/record/data/findExamRecordDataEntity?examRecordDataId=%s", sysProperty.getApiDomain(), examRecordDataId);
         }
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
@@ -271,9 +271,9 @@ public class CoreOeServiceImpl implements CoreOeService {
         //封装请求参数
         String requestUrl=null;
         if("1".equals(fromCache)) {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?fromCache=1&examRecordDataId=%s", sysProperty.getApiDomain(), examRecordDataId);
         }else {
-            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
+            requestUrl = String.format("%s/api/branch_ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?examRecordDataId=%s", sysProperty.getApiDomain(), examRecordDataId);
         }
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
@@ -286,14 +286,14 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getExamPropertyFromCacheByStudentSession(String key, String token,Long examId,String keys) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/"+examId+"/"+keys, sysProperty.getCoreExamWorkUrl());
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/"+examId+"/"+keys, sysProperty.getApiDomain());
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         return result;
     }
 
     @Override
     public Result getPaperById(String key, String token, String paperId) throws Exception {
-        final String requestUrl = String.format("%s/api/branch_ecs_ques/paper/"+paperId, sysProperty.getCoreQuestionUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_ques/paper/"+paperId, sysProperty.getApiDomain());
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         return result;
     }
@@ -301,7 +301,7 @@ public class CoreOeServiceImpl implements CoreOeService {
     @Override
     public Result getYunSignature(String key, String token, GetYunSignatureReq req) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/yunSignature", sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/yunSignature", sysProperty.getApiDomain());
         Builder b= new FormBody.Builder()
                 .add("examRecordDataId", req.getExamRecordDataId())
                 .add("order", req.getOrder())
@@ -317,25 +317,25 @@ public class CoreOeServiceImpl implements CoreOeService {
 
     @Override
     public Result queryExamList(String key, String token) throws Exception {
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/examControl/queryExamList", sysProperty.getCoreOeAdminUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/examControl/queryExamList", sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result getEndExamInfo(String key, String token, Long examRecordDataId) throws Exception {
-        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/getEndExamInfo?examRecordDataId="+examRecordDataId, sysProperty.getCoreOeStudentUrl());
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/getEndExamInfo?examRecordDataId="+examRecordDataId, sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
     @Override
     public Result queryObjectiveScoreList(String key, String token, Long examStudentId) throws Exception {
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/score/queryObjectiveScoreList?examStudentId="+examStudentId, sysProperty.getCoreOeAdminUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/exam/score/queryObjectiveScoreList?examStudentId="+examStudentId, sysProperty.getApiDomain());
         return HttpUtils.doGet(requestUrl, key, token);
     }
 
 	@Override
 	public Result startAnswer(String key, String token, Long examRecordDataId) throws Exception {
-		final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/startAnswer", sysProperty.getCoreOeStudentUrl());
+		final String requestUrl = String.format("%s/api/ecs_oe_student/examControl/startAnswer", sysProperty.getApiDomain());
 		RequestBody formBody = new FormBody.Builder()
                 .add("examRecordDataId", examRecordDataId.toString())
                 .build();
@@ -351,7 +351,7 @@ public class CoreOeServiceImpl implements CoreOeService {
             throw new ApiException("FileType must be zip,pdf,jpg,jpeg,png.");
         }
         //封装请求参数									
-        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/batchSubmitPaper?examRecordDataId="+examRecordDataId+"&fileType="+fileType, sysProperty.getCoreOeAdminUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_oe_admin/offlineExam/batchSubmitPaper?examRecordDataId="+examRecordDataId+"&fileType="+fileType, sysProperty.getApiDomain());
         MultipartBody.Builder form = new MultipartBody.Builder().setType(MultipartBody.FORM);
         for(MultipartFile file:fileArray) {
 	        RequestBody body = RequestBody.create(MediaType.parse("application/octet-stream"), file.getBytes());

+ 3 - 3
src/main/java/cn/com/qmth/examcloud/app/service/impl/CoreQuestionServiceImpl.java

@@ -42,13 +42,13 @@ public class CoreQuestionServiceImpl implements CoreQuestionService {
     @Override
     public String downloadPaper(String key, String token, String paperId) throws Exception {
         //封装请求参数
-        return String.format("%s/api/branch_ecs_ques/paper/export/%s/PAPER/offLine?$key=%s&$token=%s", sysProperty.getCoreQuestionUrl(), paperId, key, token);
+        return String.format("%s/api/branch_ecs_ques/paper/export/%s/PAPER/offLine?$key=%s&$token=%s", sysProperty.getApiDomain(), paperId, key, token);
     }
 
     @Override
     public Result getPaperDetail(String key, String token, String paperId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/branch_ecs_ques/paper/%s", sysProperty.getCoreQuestionUrl(), paperId);
+        final String requestUrl = String.format("%s/api/branch_ecs_ques/paper/%s", sysProperty.getApiDomain(), paperId);
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
         if (result.isSuccess()) {
             //过滤掉为空的属性
@@ -60,7 +60,7 @@ public class CoreQuestionServiceImpl implements CoreQuestionService {
     @Override
     public Result getQuestion(String key, String token, String courseCode, Long examId, String groupCode, String questionId) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/branch_ecs_ques/default_question/question", sysProperty.getCoreQuestionUrl());
+        final String requestUrl = String.format("%s/api/branch_ecs_ques/default_question/question", sysProperty.getApiDomain());
         Map<String, Object> params = new HashMap<>();
         params.put("courseCode", courseCode);
         params.put("examId", examId);

+ 3 - 1
src/main/java/cn/com/qmth/examcloud/app/service/impl/UpYunServiceImpl.java

@@ -22,14 +22,16 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class UpYunServiceImpl implements UpYunService {
+
     private static final Logger log = LoggerFactory.getLogger(UpYunServiceImpl.class);
+
     @Autowired
     private SysProperty sysProperty;
 
     @Override
     public String downloadPaperAnswer(String filePath) throws Exception {
         //封装请求参数
-        return String.format("%s/%s", sysProperty.getDomain(), filePath);
+        return String.format("%s/%s", sysProperty.getFileDomain(), filePath);
     }
 
 }