|
@@ -8,6 +8,9 @@
|
|
|
package cn.com.qmth.examcloud.app.service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.app.model.Result;
|
|
|
+import cn.com.qmth.examcloud.app.utils.DateUtils;
|
|
|
+import cn.com.qmth.examcloud.app.utils.HttpUtils;
|
|
|
+import okhttp3.Request;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -15,6 +18,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_KEY;
|
|
|
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_TOKEN;
|
|
|
+
|
|
|
/**
|
|
|
* 网考业务服务接口
|
|
|
*/
|
|
@@ -25,7 +31,21 @@ public class NetExamService {
|
|
|
private PropertyService propertyService;
|
|
|
|
|
|
public Result getCurrentTime(String key, String token) throws Exception {
|
|
|
- return null;
|
|
|
+ final String requestUrl = propertyService.getNetExamUrl() + "/api/online_exam_course/currentTime";
|
|
|
+ //封装请求参数
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url(requestUrl)
|
|
|
+ .get()
|
|
|
+ .addHeader(PARAM_KEY, key)
|
|
|
+ .addHeader(PARAM_TOKEN, token)
|
|
|
+ .build();
|
|
|
+ //执行请求
|
|
|
+ Result<String> result = HttpUtils.call(request);
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ //转换日期格式
|
|
|
+ result.setData(DateUtils.format(result.getData()));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
public Result getOfflineExamCourseList(String key, String token) throws Exception {
|