|
@@ -0,0 +1,63 @@
|
|
|
+package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+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;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.request.SaveRandomPaperExtractConfigReq;
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.response.SaveRandomPaperExtractConfigResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.ExtractConfigOuterService;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExtractConfigReq;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExamResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExtractConfigResp;
|
|
|
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.web.support.StatusResponse;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp.cloud.exchange.outer}/extract_config")
|
|
|
+public class ExtractConfigOuterServiceProvider extends ControllerSupport implements ExtractConfigOuterService {
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private static final long serialVersionUID = 1949134276130329162L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExtractConfigCloudService extractConfigCloudService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "保存调卷规则(千卷考试)")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterSaveExamResp.class),
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
+ @PostMapping("random/paper/save")
|
|
|
+ @Override
|
|
|
+ public OuterSaveExtractConfigResp saveRandomPaperExtractConfig(
|
|
|
+ @RequestBody @ApiParam(required = true) OuterSaveExtractConfigReq req) {
|
|
|
+
|
|
|
+ SaveRandomPaperExtractConfigReq savereq = new SaveRandomPaperExtractConfigReq();
|
|
|
+ if (StringUtils.isBlank(req.getExamCode())&&StringUtils.isBlank(req.getExamName())) {
|
|
|
+ throw new StatusException("examCode、examCode不能都为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(req.getCourseCode())) {
|
|
|
+ throw new StatusException("courseCode不能为空");
|
|
|
+ }
|
|
|
+ savereq.setRootOrgId(getEnterpriseRootOrgId());
|
|
|
+ savereq.setExamName(req.getExamName());
|
|
|
+ savereq.setExamCode(req.getExamCode());
|
|
|
+ savereq.setCourseCode(req.getCourseCode());
|
|
|
+ SaveRandomPaperExtractConfigResp r = extractConfigCloudService.saveRandomPaperExtractConfig(savereq);
|
|
|
+
|
|
|
+ OuterSaveExtractConfigResp resp = new OuterSaveExtractConfigResp();
|
|
|
+ resp.setExtractConfigId(r.getExtractConfigId());
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|