deason 7 жил өмнө
parent
commit
7a94f2b5a0

+ 50 - 8
src/main/java/cn/com/qmth/examcloud/app/controller/v1/OfflineExamRestController.java

@@ -7,14 +7,19 @@
 
 package cn.com.qmth.examcloud.app.controller.v1;
 
-import cn.com.qmth.examcloud.app.service.ExamAdminService;
-import cn.com.qmth.examcloud.app.service.OnLineExamService;
+import cn.com.qmth.examcloud.app.model.Result;
+import cn.com.qmth.examcloud.app.service.NetExamService;
 import cn.com.qmth.examcloud.app.service.QuestionPoolService;
 import cn.com.qmth.examcloud.app.service.UpYunService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
 
 /**
  * 离线考试相关接口
@@ -22,16 +27,53 @@ import org.springframework.web.bind.annotation.RestController;
  * @Version v1.0
  */
 @RestController
-@RequestMapping("/api/v1")
+@RequestMapping("/api/v1/exam/offline")
 @Api(tags = "离线考试相关接口")
 public class OfflineExamRestController {
-    @Autowired
-    private ExamAdminService examAdminService;
     @Autowired
     private QuestionPoolService questionPoolService;
     @Autowired
-    private OnLineExamService onLineExamService;
+    private NetExamService netExamService;
     @Autowired
     private UpYunService upYunService;
 
+    @ApiOperation(value = "获取当前用户参加的离线课程列表接口")
+    @RequestMapping(value = "/course/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getOfflineExamCourseList(@RequestHeader String key, @RequestHeader String token) throws Exception {
+        return netExamService.getOfflineExamCourseList(key, token);
+    }
+
+    @ApiOperation(value = "离线考试的抽取考题接口")
+    @RequestMapping(value = "/record/start", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result startOfflineExamRecord(@RequestHeader String key, @RequestHeader String token, @RequestParam String examStudentId) throws Exception {
+        return netExamService.startOfflineExamRecord(key, token, examStudentId);
+    }
+
+    @ApiOperation(value = "下载考题接口")
+    @RequestMapping(value = "/paper/download", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result downloadPaper(@RequestHeader String key, @RequestHeader String token, @RequestParam String paperId, @RequestParam String orgName) throws Exception {
+        return questionPoolService.downloadPaper(key, token, paperId, orgName);
+    }
+
+    @ApiOperation(value = "上传作答文件接口")
+    @RequestMapping(value = "/paper/answer/upload", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result uploadPaperAnswer(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId, @RequestParam String fileType,
+                                    @RequestParam(required = false) String fileMd5, HttpServletRequest request) throws Exception {
+        MultipartFile multipart = ((MultipartHttpServletRequest) request).getFile("file");
+        File file = null;//todo
+        return netExamService.uploadPaperAnswer(key, token, examRecordId, file, fileType, fileMd5);
+    }
+
+    @ApiOperation(value = "下载已上传的“作答文件”接口")
+    @RequestMapping(value = "/paper/answer/download", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result downloadPaperAnswer(@RequestHeader String key, @RequestHeader String token, @RequestParam String filePath) throws Exception {
+        return upYunService.downloadPaperAnswer(key, token, filePath);
+    }
+
+    @ApiOperation(value = "获取某份试卷的详细信息接口")
+    @RequestMapping(value = "/paper/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getPaperDetail(@RequestHeader String key, @RequestHeader String token, @RequestParam String paperId) throws Exception {
+        return questionPoolService.getPaperDetail(key, token, paperId);
+    }
+
 }

+ 108 - 10
src/main/java/cn/com/qmth/examcloud/app/controller/v1/PracticeExamRestController.java

@@ -7,14 +7,13 @@
 
 package cn.com.qmth.examcloud.app.controller.v1;
 
+import cn.com.qmth.examcloud.app.model.Result;
 import cn.com.qmth.examcloud.app.service.ExamAdminService;
-import cn.com.qmth.examcloud.app.service.OnLineExamService;
-import cn.com.qmth.examcloud.app.service.QuestionPoolService;
-import cn.com.qmth.examcloud.app.service.UpYunService;
+import cn.com.qmth.examcloud.app.service.NetExamService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 在线练习相关接口
@@ -28,11 +27,110 @@ public class PracticeExamRestController {
     @Autowired
     private ExamAdminService examAdminService;
     @Autowired
-    private QuestionPoolService questionPoolService;
-    @Autowired
-    private OnLineExamService onLineExamService;
-    @Autowired
-    private UpYunService upYunService;
+    private NetExamService netExamService;
+
+    @ApiOperation(value = "获取某考生的“考试批次”列表接口")
+    @RequestMapping(value = "/exam/practice/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getPracticeExamList(@RequestHeader String key, @RequestHeader String token, @RequestParam String studentId) throws Exception {
+        return examAdminService.getPracticeExamList(key, token, studentId);
+    }
+
+    @ApiOperation(value = "获取某考试批次下的课程列表接口")
+    @RequestMapping(value = "/exam/practice/course/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getPracticeExamCourseList(@RequestHeader String key, @RequestHeader String token, @RequestParam String examId) throws Exception {
+        return netExamService.getPracticeExamCourseList(key, token, examId);
+    }
+
+    @ApiOperation(value = "获取当前练习的剩余作答时间接口")
+    @RequestMapping(value = "/exam/record/heartbeat", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordHeartbeat(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.getExamRecordHeartbeat(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "考生“开始练习”接口")
+    @RequestMapping(value = "/exam/record/start", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result startPracticeExamRecord(@RequestHeader String key, @RequestHeader String token, @RequestParam String examStudentId) throws Exception {
+        return netExamService.startPracticeExamRecord(key, token, examStudentId);
+    }
+
+    @ApiOperation(value = "获取当前练习的试卷大题结构信息接口")
+    @RequestMapping(value = "/exam/record/paper/struct/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordPaperStructList(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.getExamRecordPaperStructList(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "获取当前练习的考试基本信息接口")
+    @RequestMapping(value = "/exam/info/{examId}", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamInfo(@RequestHeader String key, @RequestHeader String token, @PathVariable Long examId) throws Exception {
+        return examAdminService.getExamInfo(key, token, examId);
+    }
+
+    @ApiOperation(value = "获取当前练习的试卷试题列表接口")
+    @RequestMapping(value = "/exam/record/paper/question/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordPaperQuestionList(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.getExamRecordPaperQuestionList(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "获取考生作答的某个试题的详细信息接口")
+    @RequestMapping(value = "/exam/record/paper/question/detail/{questionId}", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result questionDetail(@RequestHeader String key, @RequestHeader String token, @PathVariable String questionId) throws Exception {
+        return netExamService.getExamRecordPaperQuestionDetail(key, token, questionId);
+    }
+
+    @ApiOperation(value = "保存或更新考生作答的某个试题答案接口")
+    @RequestMapping(value = "/exam/record/paper/question/answer/update", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result updateExamRecordPaperQuestionAnswer(@RequestHeader String key, @RequestHeader String token, @RequestParam String examQuestionId,
+                                                      @RequestParam String studentAnswer) throws Exception {
+        return netExamService.updateExamRecordPaperQuestionAnswer(key, token, examQuestionId, studentAnswer);
+    }
+
+    @ApiOperation(value = "当前练习的交卷接口")
+    @RequestMapping(value = "/exam/record/submit", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result submitPracticeExamRecord(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.submitPracticeExamRecord(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "检查考生当前是否有正在进行的练习记录接口")
+    @RequestMapping(value = "/exam/record/online/check", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result checkOnlineExamRecord(@RequestHeader String key, @RequestHeader String token) throws Exception {
+        return netExamService.checkOnlineExamRecord(key, token);
+    }
+
+    @ApiOperation(value = "获取当前考生的当前课程练习统计信息接口")
+    @RequestMapping(value = "/exam/record/practice/course/total", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordPracticeTotalInfo(@RequestHeader String key, @RequestHeader String token, @RequestParam String examStudentId) throws Exception {
+        return netExamService.getExamRecordPracticeTotalInfo(key, token, examStudentId);
+    }
+
+    @ApiOperation(value = "获取当前考生的当前课程的历史练习记录接口")
+    @RequestMapping(value = "/exam/record/practice/course/history/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordPracticeHistoryList(@RequestHeader String key, @RequestHeader String token, @RequestParam String examStudentId) throws Exception {
+        return netExamService.getExamRecordPracticeHistoryList(key, token, examStudentId);
+    }
+
+    @ApiOperation(value = "获取成绩报告的答题情况统计接口")
+    @RequestMapping(value = "/exam/record/total", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordTotalInfo(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.getExamRecordTotalInfo(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "获取作答的题列表接口")
+    @RequestMapping(value = "/exam/record/paper/question/detail/list", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordQuestionDetailList(@RequestHeader String key, @RequestHeader String token, @RequestParam String examRecordId) throws Exception {
+        return netExamService.getExamRecordQuestionDetailList(key, token, examRecordId);
+    }
+
+    @ApiOperation(value = "获取当前试题的音频已播放次数接口")
+    @RequestMapping(value = "/exam/record/paper/question/get/playtimes", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getExamRecordQuestionAudioPlayTimes(@RequestHeader String key, @RequestHeader String token, @RequestParam String questionId) throws Exception {
+        return netExamService.getExamRecordQuestionAudioPlayTimes(key, token, questionId);
+    }
 
+    @ApiOperation(value = "更新当前试题的音频已播放次数接口")
+    @RequestMapping(value = "/exam/record/paper/question/update/playtimes", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result updateExamRecordQuestionAudioPlayTimes(@RequestHeader String key, @RequestHeader String token,
+                                                         @RequestParam String questionId, @RequestParam String mediaName) throws Exception {
+        return netExamService.updateExamRecordQuestionAudioPlayTimes(key, token, questionId, mediaName);
+    }
 
 }

+ 38 - 0
src/main/java/cn/com/qmth/examcloud/app/controller/v1/SystemRestController.java

@@ -0,0 +1,38 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-07-18 10:38:43.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.app.controller.v1;
+
+import cn.com.qmth.examcloud.app.model.Result;
+import cn.com.qmth.examcloud.app.service.NetExamService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统服务相关接口
+ *
+ * @Version v1.0
+ */
+@RestController
+@RequestMapping("/api/v1")
+@Api(tags = "系统服务相关接口")
+public class SystemRestController {
+    @Autowired
+    private NetExamService netExamService;
+
+    @ApiOperation(value = "获取服务器当前时间接口")
+    @RequestMapping(value = "/system/currentTime", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getCurrentTime(@RequestHeader String key, @RequestHeader String token) throws Exception {
+        return netExamService.getCurrentTime(key, token);
+    }
+
+}

+ 1 - 1
src/main/java/cn/com/qmth/examcloud/app/controller/v1/UserAuthRestController.java

@@ -40,7 +40,7 @@ public class UserAuthRestController {
 
     @ApiOperation(value = "获取用户信息接口")
     @RequestMapping(value = "/user/info", method = {RequestMethod.GET, RequestMethod.POST})
-    public Result getUserInfo(@RequestHeader String key, @RequestHeader String token) throws Exception {
+    public Result userInfo(@RequestHeader String key, @RequestHeader String token) throws Exception {
         return userAuthService.getUserInfo(key, token);
     }
 

+ 6 - 2
src/main/java/cn/com/qmth/examcloud/app/service/ExamAdminService.java

@@ -27,8 +27,8 @@ public class ExamAdminService {
     @Autowired
     private PropertyService propertyService;
 
-    public Result demo(String key, String token, String userId, String password) throws Exception {
-        final String requestUrl = String.format(propertyService.getUserAuthUrl() + "/api/ecs_core/user/password?userId=%s&password=%s", userId, password);
+    public Result getPracticeExamList(String key, String token, String studentId) throws Exception {
+        final String requestUrl = String.format(propertyService.getUserAuthUrl() + "/api/ecs_core/user/password?userId=%s", studentId);
         //封装请求参数
         Request request = new Request.Builder()
                 .url(requestUrl)
@@ -40,4 +40,8 @@ public class ExamAdminService {
         return HttpUtils.call(request);
     }
 
+    public Result getExamInfo(String key, String token, Long examId) throws Exception {
+        return null;
+    }
+
 }

+ 103 - 0
src/main/java/cn/com/qmth/examcloud/app/service/NetExamService.java

@@ -0,0 +1,103 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-07-16 17:49:59.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.app.service;
+
+import cn.com.qmth.examcloud.app.model.Result;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+
+/**
+ * 网考业务服务接口
+ */
+@Service
+public class NetExamService {
+    private static Logger log = LoggerFactory.getLogger(NetExamService.class);
+    @Autowired
+    private PropertyService propertyService;
+
+    public Result getCurrentTime(String key, String token) throws Exception {
+        return null;
+    }
+
+    public Result getOfflineExamCourseList(String key, String token) throws Exception {
+        return null;
+    }
+
+    public Result startOfflineExamRecord(String key, String token, String examStudentId) throws Exception {
+        return null;
+    }
+
+    public Result uploadPaperAnswer(String key, String token, String examRecordId, File file, String fileType, String fileMd5) throws Exception {
+        return null;
+    }
+
+    public Result getPracticeExamCourseList(String key, String token, String examId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordHeartbeat(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result startPracticeExamRecord(String key, String token, String examStudentId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordPaperStructList(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordPaperQuestionList(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordPaperQuestionDetail(String key, String token, String questionId) throws Exception {
+        return null;
+    }
+
+    public Result updateExamRecordPaperQuestionAnswer(String key, String token, String examQuestionId, String studentAnswer) throws Exception {
+        return null;
+    }
+
+    public Result submitPracticeExamRecord(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result checkOnlineExamRecord(String key, String token) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordPracticeTotalInfo(String key, String token, String examStudentId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordPracticeHistoryList(String key, String token, String examStudentId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordTotalInfo(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordQuestionDetailList(String key, String token, String examRecordId) throws Exception {
+        return null;
+    }
+
+    public Result getExamRecordQuestionAudioPlayTimes(String key, String token, String questionId) throws Exception {
+        return null;
+    }
+
+    public Result updateExamRecordQuestionAudioPlayTimes(String key, String token, String questionId, String mediaName) throws Exception {
+        return null;
+    }
+
+}

+ 0 - 25
src/main/java/cn/com/qmth/examcloud/app/service/OnLineExamService.java

@@ -1,25 +0,0 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-07-16 17:49:59.
- * *************************************************
- */
-
-package cn.com.qmth.examcloud.app.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 网考业务服务接口
- */
-@Service
-public class OnLineExamService {
-    private static Logger log = LoggerFactory.getLogger(OnLineExamService.class);
-    @Autowired
-    private PropertyService propertyService;
-
-
-}

+ 9 - 0
src/main/java/cn/com/qmth/examcloud/app/service/QuestionPoolService.java

@@ -7,6 +7,7 @@
 
 package cn.com.qmth.examcloud.app.service;
 
+import cn.com.qmth.examcloud.app.model.Result;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,4 +22,12 @@ public class QuestionPoolService {
     @Autowired
     private PropertyService propertyService;
 
+    public Result downloadPaper(String key, String token, String paperId, String orgName) throws Exception {
+        return null;
+    }
+
+    public Result getPaperDetail(String key, String token, String paperId) throws Exception {
+        return null;
+    }
+
 }

+ 5 - 0
src/main/java/cn/com/qmth/examcloud/app/service/UpYunService.java

@@ -7,6 +7,7 @@
 
 package cn.com.qmth.examcloud.app.service;
 
+import cn.com.qmth.examcloud.app.model.Result;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,4 +22,8 @@ public class UpYunService {
     @Autowired
     private PropertyService propertyService;
 
+    public Result downloadPaperAnswer(String key, String token, String filePath) throws Exception {
+        return null;
+    }
+
 }

+ 8 - 4
src/main/resources/static/bycdao-ui/cdao/swaggerbootstrapui.js

@@ -55,7 +55,7 @@
         var host = $.getValue(menu, "host", "", true);
         if (menu.hasOwnProperty("info")) {
             var info = menu.info;
-            title = $.getValue(info, "title", "Swagger-Bootstrap-UI-前后端api接口文档", true);
+            title = $.getValue(info, "title", "API接口文档", true);
             description = $.getValue(info, "description", "", true);
             if (info.hasOwnProperty("contact")) {
                 var contact = info["contact"];
@@ -159,10 +159,14 @@
                 var titleA = $('<a href="#" class="dropdown-toggle"><i class="icon-file-alt"></i><span class="menu-text">' + tag.name + '<span class="badge badge-primary ">' + len + '</span></span><b class="arrow icon-angle-down"></b></a>');
                 li.append(titleA);
                 //循环树
-                var ul = $('<ul class="submenu"></ul>')
+                var ul = $('<ul class="submenu"></ul>');
                 $.each(tag.childrens, function (i, children) {
                     /*var childrenLi=$('<li class="menuLi" ><div class="mhed"><div class="swu-hei"><span class="swu-menu swu-left">'+children.methodType.toUpperCase()+'</span><span class="swu-menu swu-left"><code>'+children.url+'</code></span></div><div>'+children.summary+'</div></div></li>');*/
-                    var childrenLi = $('<li class="menuLi" ><div class="mhed"><div>' + (i + 1) + '、' + children.summary + '</div></div></li>');
+                    var curTitle = children.summary;
+                    if (curTitle.length > 15) {
+                        curTitle = curTitle.substring(0, 15) + '...';
+                    }
+                    var childrenLi = $('<li class="menuLi" ><div class="mhed"><div>' + (i + 1) + '、' + curTitle + '</div></div></li>');
                     childrenLi.data("data", children);
                     ul.append(childrenLi);
                 });
@@ -170,7 +174,7 @@
                 that.getMenu().append(li);
             }
         })
-        that.log("菜单初始化完成...")
+        that.log("菜单初始化完成...");
         //DApiUI.initLiClick();
         that.initializationMenuClickEvents();
     }