|
@@ -0,0 +1,117 @@
|
|
|
+package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
+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;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.GetTopExamScoreQueueResp;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.request.GetExamReq;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.response.GetExamResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.ScoreQueueService;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterDeleteScoreQueueTopReq;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetScoreQueueTopReq;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterDeleteScoreQueueTopResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetScoreQueueTopResp;
|
|
|
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.web.support.StatusResponse;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+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
|
|
|
+ * @Date 2020/3/30 14:48
|
|
|
+ * @Version 1.0
|
|
|
+ */
|
|
|
+@Api("考试作答服务")
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp.cloud.exchange.outer}/scoreQueue")
|
|
|
+public class ExamQuestionOuterServiceProvider extends ControllerSupport implements ScoreQueueService {
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private static final long serialVersionUID = -7975687672489564748L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamScoreObtainQueueCloudService examScoreObtainQueueCloudService;
|
|
|
+ @Autowired
|
|
|
+ private ExamCloudService examCloudService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "取队列最顶层记录", httpMethod = "POST")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetScoreQueueTopResp.class),
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
+ @PostMapping("/getScoreQueueTop")
|
|
|
+ @Override
|
|
|
+ public OuterGetScoreQueueTopResp getScoreQueueTop(@RequestBody OuterGetScoreQueueTopReq req) {
|
|
|
+ if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
+ throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
+ }
|
|
|
+ GetTopExamScoreQueueReq getTopExamScoreQueueReq = new GetTopExamScoreQueueReq();
|
|
|
+ getTopExamScoreQueueReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetTopExamScoreQueueResp getTopExamScoreQueueResp = examScoreObtainQueueCloudService.getTopExamScoreQueue(getTopExamScoreQueueReq);
|
|
|
+ OuterGetScoreQueueTopResp resp = new OuterGetScoreQueueTopResp();
|
|
|
+
|
|
|
+ //返回值不为空数据
|
|
|
+ if(!getTopExamScoreQueueResp.getIsEmpty()){
|
|
|
+ resp.setQueueId(getTopExamScoreQueueResp.getQueueId());
|
|
|
+ resp.setExamRecordDataId(getTopExamScoreQueueResp.getExamRecordDataId());
|
|
|
+ Long examId=getTopExamScoreQueueResp.getExamId();
|
|
|
+ GetExamReq getExamReq=new GetExamReq();
|
|
|
+ getExamReq.setId(examId);
|
|
|
+ //获取考试详情
|
|
|
+ GetExamResp getExamResp = examCloudService.getExam(getExamReq);
|
|
|
+ if(getExamResp!=null) {
|
|
|
+ resp.setExamId(examId);//考试id
|
|
|
+ ExamBean examBean = getExamResp.getExamBean();
|
|
|
+ if(examBean!=null) {
|
|
|
+ //需求调整201911216:code和name都返回为code
|
|
|
+ resp.setExamCode(examBean.getCode());
|
|
|
+ resp.setExamName(examBean.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp.setIsEmpty(false);//返回的为非空数据
|
|
|
+ }else {
|
|
|
+ resp.setIsEmpty(true);//返回的为空数据
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除队列最顶层记录", httpMethod = "POST")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterDeleteScoreQueueTopResp.class),
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
+ @PostMapping("/deleteScoreQueueTop")
|
|
|
+ @Override
|
|
|
+ public OuterDeleteScoreQueueTopResp deleteScoreQueueTop(@RequestBody OuterDeleteScoreQueueTopReq req) {
|
|
|
+ if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
+ throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
+ }
|
|
|
+ GetTopExamScoreQueueReq getTopExamScoreQueueReq = new GetTopExamScoreQueueReq();
|
|
|
+ getTopExamScoreQueueReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetTopExamScoreQueueResp getTopExamScoreQueueResp = examScoreObtainQueueCloudService.getTopExamScoreQueue(getTopExamScoreQueueReq);
|
|
|
+
|
|
|
+ if(getTopExamScoreQueueResp.getQueueId()==null || (getTopExamScoreQueueResp.getQueueId()!=null && !getTopExamScoreQueueResp.getQueueId().equals(req.getQueueId()))){
|
|
|
+ throw new StatusException("1000003", "queueId is wrong");
|
|
|
+ }
|
|
|
+
|
|
|
+ DeleteExamScoreQueueReq deleteExamScoreQueueReq = new DeleteExamScoreQueueReq();
|
|
|
+ deleteExamScoreQueueReq.setQueueId(req.getQueueId());
|
|
|
+ deleteExamScoreQueueReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ examScoreObtainQueueCloudService.deleteExamScoreQueue(deleteExamScoreQueueReq);
|
|
|
+ OuterDeleteScoreQueueTopResp resp = new OuterDeleteScoreQueueTopResp();
|
|
|
+ resp.setIsSuccess(true);
|
|
|
+ resp.setDesc("删除成功");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|