xiatian il y a 5 ans
Parent
commit
69fce491b8

+ 2 - 2
src/main/java/cn/com/qmth/examcloud/app/controller/ExamController.java

@@ -16,14 +16,14 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 @RestController
-@RequestMapping("${$rmp.ctr.examwork}/exam")
+@RequestMapping("${$rmp}/v2/exam")
 public class ExamController extends ControllerSupport {
 
     @Autowired
     private CoreOeService oeService;
 
 	@ApiOperation(value = "查询考生的考试批次属性集")
-	@GetMapping("getExamPropertyFromCacheByStudentSession/{examId}/{keys}")
+	@GetMapping("getExamProperty/{examId}/{keys}")
 	public Result getExamPropertyFromCacheByStudentSession(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token,@PathVariable Long examId,
 			@PathVariable String keys) throws Exception{
 	    return oeService.getExamPropertyFromCacheByStudentSession(key, token, examId, keys);

+ 33 - 0
src/main/java/cn/com/qmth/examcloud/app/controller/PaperController.java

@@ -0,0 +1,33 @@
+package cn.com.qmth.examcloud.app.controller;
+
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_KEY;
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_TOKEN;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import cn.com.qmth.examcloud.app.model.Result;
+import cn.com.qmth.examcloud.app.service.CoreOeService;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+@RestController
+@RequestMapping("${$rmp}/v2/paper")
+public class PaperController extends ControllerSupport {
+
+    @Autowired
+    private CoreOeService oeService;
+
+	@ApiOperation(value = "根据Id获取试卷")
+	@GetMapping("{paperId}")
+	public Result getPaperById(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token,
+			@PathVariable String paperId) throws Exception{
+	    return oeService.getPaperById(key, token,paperId);
+	}
+
+
+}

+ 8 - 0
src/main/java/cn/com/qmth/examcloud/app/service/CoreOeService.java

@@ -246,4 +246,12 @@ public interface CoreOeService {
     Result getExamPropertyFromCacheByStudentSession(String key, String token, Long examId, String keys)
             throws Exception;
 
+    /**根据Id获取试卷
+     * @param key
+     * @param token
+     * @param paperId
+     * @return
+     */
+    Result getPaperById(String key, String token, String paperId) throws Exception ;
+
 }

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

@@ -231,10 +231,13 @@ public class CoreOeServiceImpl implements CoreOeService {
         //封装请求参数
         final String requestUrl = String.format("%s/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/"+examId+"/"+keys, sysProperty.getCoreExamWorkUrl());
         Result<String> result = HttpUtils.doGet(requestUrl, key, token);
-        if (result.isSuccess()) {
-            //转换日期格式
-            result.setData(DateUtils.formatLongDate(result.getData()));
-        }
+        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;
     }
 }