Explorar el Código

扫描客户端接口增加题卡信息字段

luoshi hace 4 años
padre
commit
562b126520

+ 16 - 0
stmms-web/src/main/java/cn/com/qmth/stmms/api/controller/ExamInfoController.java

@@ -9,11 +9,13 @@ import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
 import cn.com.qmth.stmms.biz.exam.query.ExamSearchQuery;
 import cn.com.qmth.stmms.biz.exam.service.ExamService;
 import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
+import cn.com.qmth.stmms.biz.file.service.FileService;
 import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
 import cn.com.qmth.stmms.common.annotation.Logging;
 import cn.com.qmth.stmms.common.annotation.RoleRequire;
 import cn.com.qmth.stmms.common.domain.ApiUser;
 import cn.com.qmth.stmms.common.enums.ExamStatus;
+import cn.com.qmth.stmms.common.enums.ExamType;
 import cn.com.qmth.stmms.common.enums.LogType;
 import cn.com.qmth.stmms.common.enums.Role;
 import cn.com.qmth.stmms.common.utils.DateUtils;
@@ -41,6 +43,9 @@ public class ExamInfoController extends BaseApiController {
     @Autowired
     private CampusService campusService;
 
+    @Autowired
+    private FileService fileService;
+
     @RequestMapping("/version")
     @ResponseBody
     public String version(HttpServletRequest request) {
@@ -54,6 +59,7 @@ public class ExamInfoController extends BaseApiController {
         ApiUser user = RequestUtils.getApiUser(request);
         JSONArray array = new JSONArray();
         query.setSchoolId(user.getSchoolId());
+        query.setType(ExamType.SCAN_IMAGE);
         query.setStatus(ExamStatus.START);
         if (query.getPageSize() < 1) {
             query.setPageSize(20);
@@ -65,6 +71,11 @@ public class ExamInfoController extends BaseApiController {
             obj.accumulate("id", exam.getId());
             obj.accumulate("name", exam.getName());
             obj.accumulate("examTime", DateUtils.formatDate(exam.getExamTime()));
+            if (exam.getCardType() != null) {
+                obj.accumulate("cardType", exam.getCardType().getExtName());
+                obj.accumulate("cardUrl",
+                        fileService.getFileServer() + fileService.getCardUri(exam.getId(), exam.getCardType()));
+            }
             array.add(obj);
         }
         return array;
@@ -95,6 +106,11 @@ public class ExamInfoController extends BaseApiController {
             JSONObject obj = new JSONObject();
             obj.accumulate("code", subject.getCode());
             obj.accumulate("name", subject.getName());
+            if (subject.getCardType() != null) {
+                obj.accumulate("cardType", subject.getCardType().getExtName());
+                obj.accumulate("cardUrl", fileService.getFileServer() + fileService
+                        .getCardUri(subject.getExamId(), subject.getCode(), subject.getCardType()));
+            }
             array.add(obj);
         }
         return array;