Przeglądaj źródła

云阅卷接口部分代码

lideyin 5 lat temu
rodzic
commit
c633f52c94

+ 44 - 23
examcloud-exchange-outer-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/provider/ExamQuestionOuterServiceProvider.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.examcloud.exchange.outer.api.provider;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.StringUtil;
 import cn.com.qmth.examcloud.core.oe.admin.api.ExamScoreObtainQueueCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.DeleteExamScoreQueueReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.GetTopExamScoreQueueReq;
@@ -21,6 +22,7 @@ import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetSubjectivePaper
 import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetSubjectiveQuestionResp;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.web.support.StatusResponse;
+import com.mysql.cj.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
@@ -30,6 +32,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+
 /**
  * @Description 考试作答服务
  * @Author lideyin
@@ -41,29 +44,47 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("${$rmp.cloud.exchange.outer}/question")
 public class ExamQuestionOuterServiceProvider extends ControllerSupport implements ExamQuestionOuterService {
 
-	private static final long serialVersionUID = 7607495598308348018L;
+    private static final long serialVersionUID = 7607495598308348018L;
+
+    /**
+     * 获取主观题试卷结构
+     *
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "获取主观题试卷结构", httpMethod = "POST")
+    @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetScoreQueueTopResp.class),
+            @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
+    @PostMapping("/getSubjectivePaperStruct")
+    @Override
+    public OuterGetSubjectivePaperStructResp getSubjectivePaperStruct(OuterGetSubjectivePaperStructReq req) {
+        return null;
+    }
+
+    @ApiOperation(value = "获取主观题作答结果", httpMethod = "POST")
+    @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetScoreQueueTopResp.class),
+            @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
+    @PostMapping("/getSubjectiveQuestion")
+    @Override
+    public OuterGetSubjectiveQuestionResp getSubjectiveQuestion(OuterGetSubjectiveQuestionReq req) {
+        if (null == req.getExamId()) {
+            throw new StatusException("101001", "考试id不允许为空");
+        }
+
+        if (StringUtils.isNullOrEmpty(req.getSubjectCode())) {
+            throw new StatusException("101002", "科目代码不允许为空");
+        }
+
+        if (null == req.getStartId()) {
+            throw new StatusException("101003", "考试记录id不允许为空");
+        }
+
+        if (null == req.getSize()) {
+            throw new StatusException("101004", "数据量大小不允许为空");
+        }
+
 
-	/**
-	 * 获取主观题试卷结构
-	 *
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value = "获取主观题试卷结构", httpMethod = "POST")
-	@ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetScoreQueueTopResp.class),
-			@ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
-	@PostMapping("/getSubjectivePaperStruct")
-	@Override
-	public OuterGetSubjectivePaperStructResp getSubjectivePaperStruct(OuterGetSubjectivePaperStructReq req) {
-		return null;
-	}
 
-	@ApiOperation(value = "获取主观题作答结果", httpMethod = "POST")
-	@ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetScoreQueueTopResp.class),
-			@ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
-	@PostMapping("/getSubjectiveQuestion")
-	@Override
-	public OuterGetSubjectiveQuestionResp getSubjectiveQuestion(OuterGetSubjectiveQuestionReq req) {
-		return null;
-	}
+        return null;
+    }
 }

+ 4 - 4
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/request/OuterGetSubjectiveQuestionReq.java

@@ -17,9 +17,9 @@ public class OuterGetSubjectiveQuestionReq extends EnterpriseRequest {
 	private Long examId;
 
 	@ApiModelProperty(value = "科目代码", example = "128", required = true)
-	private Long subjectCode;
+	private String subjectCode;
 
-	@ApiModelProperty(value = "考试记录id,Long,第一次调用传0,下次调用,用返回的nextId", example = "0", required = true)
+	@ApiModelProperty(value = "考id,Long,第一次调用传0,下次调用,用返回的nextId", example = "0", required = true)
 	private Long startId;
 
 	@ApiModelProperty(value = "考试记录集合大小,最大不得超过500", example = "200", required = true)
@@ -33,11 +33,11 @@ public class OuterGetSubjectiveQuestionReq extends EnterpriseRequest {
 		this.examId = examId;
 	}
 
-	public Long getSubjectCode() {
+	public String getSubjectCode() {
 		return subjectCode;
 	}
 
-	public void setSubjectCode(Long subjectCode) {
+	public void setSubjectCode(String subjectCode) {
 		this.subjectCode = subjectCode;
 	}
 

+ 1 - 1
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/response/OuterGetSubjectiveQuestionResp.java

@@ -16,7 +16,7 @@ public class OuterGetSubjectiveQuestionResp extends EnterpriseResponse{
 
 	private static final long serialVersionUID = -8015424509347237754L;
 
-	@ApiModelProperty(value = "下一个考试记录ID,如果已经是最后一条数据,则此值和startId相等", example = "128", required = true)
+	@ApiModelProperty(value = "下一个考ID,如果已经是最后一条数据,则此值和startId相等", example = "128", required = true)
 	private Long nextId;
 
 	@ApiModelProperty(value = "考试记录集合", example = "[{'id':1}]", required = true)