|
@@ -12,14 +12,17 @@ import cn.com.qmth.examcloud.app.core.utils.DateUtils;
|
|
|
import cn.com.qmth.examcloud.app.core.utils.HttpUtils;
|
|
|
import cn.com.qmth.examcloud.app.core.utils.JsonMapper;
|
|
|
import cn.com.qmth.examcloud.app.model.Constants;
|
|
|
+import cn.com.qmth.examcloud.app.model.GetYunSignatureReq;
|
|
|
import cn.com.qmth.examcloud.app.model.Result;
|
|
|
import cn.com.qmth.examcloud.app.service.CoreOeService;
|
|
|
import cn.com.qmth.examcloud.app.core.SysProperty;
|
|
|
import okhttp3.FormBody;
|
|
|
+import okhttp3.FormBody.Builder;
|
|
|
import okhttp3.MediaType;
|
|
|
import okhttp3.MultipartBody;
|
|
|
import okhttp3.RequestBody;
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -61,14 +64,14 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
@Override
|
|
|
public Result getOfflineExamCourseList(String key, String token) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/offlineExam/getOfflineCourse", sysProperty.getCoreOeStudentUrl());
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/offlineExam/getOfflineCourse", sysProperty.getCoreOeAdminUrl());
|
|
|
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/ecs_oe_student/offlineExam/startOfflineExam?examStudentId=%s", sysProperty.getCoreOeStudentUrl(), examStudentId);
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/offlineExam/startOfflineExam?examStudentId=%s", sysProperty.getCoreOeAdminUrl(), examStudentId);
|
|
|
return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
@@ -84,7 +87,7 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
throw new ApiException("File must be not empty.");
|
|
|
}
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/offlineExam/submitPaper?examRecordDataId=%s", sysProperty.getCoreOeStudentUrl(), examRecordId);
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/offlineExam/submitPaper?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), 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);
|
|
@@ -96,7 +99,7 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
@Override
|
|
|
public Result getPracticeExamCourseList(String key, String token, String examId) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/practice/queryPracticeCourseList?examId=%s", sysProperty.getCoreOeStudentUrl(), examId);
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/practice/queryPracticeCourseList?examId=%s", sysProperty.getCoreOeAdminUrl(), examId);
|
|
|
return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
@@ -115,9 +118,20 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result getExamRecordPaperStructList(String key, String token, String examRecordId) throws Exception {
|
|
|
+ public Result getAdminExamPaperStructList(String key, String token, String examRecordId,String fromCache) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=%s", sysProperty.getCoreOeStudentUrl(), examRecordId);
|
|
|
+ String requestUrl=null;
|
|
|
+ if("1".equals(fromCache)) {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
|
|
|
+ }else {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), 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);
|
|
|
return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
@@ -136,13 +150,14 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result updateExamRecordPaperQuestionAnswer(String key, String token, Integer order, String studentAnswer) throws Exception {
|
|
|
+ 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());
|
|
|
List<Map> paramsList = new ArrayList<Map>();
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("order", order);
|
|
|
params.put("studentAnswer", studentAnswer);
|
|
|
+ params.put("audioPlayTimes", audioPlayTimes);
|
|
|
paramsList.add(params);
|
|
|
String json = new JsonMapper().toJson(paramsList);
|
|
|
RequestBody formBody = FormBody.create(MediaType.parse(Constants.CHARSET_JSON_UTF8), json);
|
|
@@ -166,14 +181,19 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
@Override
|
|
|
public Result getExamRecordPracticeHistoryList(String key, String token, String examStudentId) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/practice/queryPracticeRecordList?examStudentId=%s", sysProperty.getCoreOeStudentUrl(), examStudentId);
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/practice/queryPracticeRecordList?examStudentId=%s", sysProperty.getCoreOeAdminUrl(), examStudentId);
|
|
|
return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result getExamRecordTotalInfo(String key, String token, String examRecordId) throws Exception {
|
|
|
+ public Result getExamRecordTotalInfo(String key, String token, String examRecordId,String fromCache) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_student/practice/getPracticeDetailInfo?examRecordDataId=%s", sysProperty.getCoreOeStudentUrl(), examRecordId);
|
|
|
+ String requestUrl=null;
|
|
|
+ if("1".equals(fromCache)) {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/practice/getPracticeDetailInfo?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
|
|
|
+ }else {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/practice/getPracticeDetailInfo?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordId);
|
|
|
+ }
|
|
|
return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
@@ -203,9 +223,14 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result findExamRecordDataEntity(String key, String token, Long examRecordDataId) throws Exception {
|
|
|
+ public Result findExamRecordDataEntity(String key, String token, Long examRecordDataId,String fromCache) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_admin/exam/record/data/findExamRecordDataEntity?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ String requestUrl=null;
|
|
|
+ if("1".equals(fromCache)) {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/exam/record/data/findExamRecordDataEntity?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ }else {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/exam/record/data/findExamRecordDataEntity?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ }
|
|
|
Result<String> result = HttpUtils.doGet(requestUrl, key, token);
|
|
|
if (result.isSuccess()) {
|
|
|
//过滤掉为空的属性
|
|
@@ -215,9 +240,14 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result getExamRecordQuestions(String key, String token, Long examRecordDataId) throws Exception {
|
|
|
+ public Result getExamRecordQuestions(String key, String token, Long examRecordDataId,String fromCache) throws Exception {
|
|
|
//封装请求参数
|
|
|
- final String requestUrl = String.format("%s/api/ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ String requestUrl=null;
|
|
|
+ if("1".equals(fromCache)) {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?fromCache=1&examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ }else {
|
|
|
+ requestUrl = String.format("%s/api/ecs_oe_admin/examRecordQuestions/getExamRecordQuestions?examRecordDataId=%s", sysProperty.getCoreOeAdminUrl(), examRecordDataId);
|
|
|
+ }
|
|
|
Result<String> result = HttpUtils.doGet(requestUrl, key, token);
|
|
|
if (result.isSuccess()) {
|
|
|
//过滤掉为空的属性
|
|
@@ -226,4 +256,54 @@ public class CoreOeServiceImpl implements CoreOeService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @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());
|
|
|
+ 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/ecs_ques/paper/"+paperId, sysProperty.getCoreQuestionUrl());
|
|
|
+ Result<String> result = HttpUtils.doGet(requestUrl, key, token);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @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());
|
|
|
+ Builder b= new FormBody.Builder()
|
|
|
+ .add("examRecordDataId", req.getExamRecordDataId())
|
|
|
+ .add("order", req.getOrder())
|
|
|
+ .add("fileMd5", req.getFileMd5())
|
|
|
+ .add("fileSuffix", req.getFileSuffix());
|
|
|
+ if(StringUtils.isNotBlank(req.getExt())) {
|
|
|
+ b.add("ext", req.getExt());
|
|
|
+ }
|
|
|
+ RequestBody formBody =b.build();
|
|
|
+
|
|
|
+ return HttpUtils.doPost(requestUrl, formBody, key, token);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result queryExamList(String key, String token) throws Exception {
|
|
|
+ final String requestUrl = String.format("%s/api/ecs_oe_admin/examControl/queryExamList", sysProperty.getCoreOeAdminUrl());
|
|
|
+ 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());
|
|
|
+ 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/ecs_oe_admin/exam/score/queryObjectiveScoreList?examStudentId="+examStudentId, sysProperty.getCoreOeAdminUrl());
|
|
|
+ return HttpUtils.doGet(requestUrl, key, token);
|
|
|
+ }
|
|
|
+
|
|
|
}
|