|
@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+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;
|
|
@@ -11,12 +12,16 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean4Reset;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.request.GetExamReq;
|
|
|
import cn.com.qmth.examcloud.examwork.api.request.ResetExamStudentReq;
|
|
|
import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
|
|
|
import cn.com.qmth.examcloud.examwork.api.request.UpdateExamStudentStatusReq;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.response.GetExamResp;
|
|
|
import cn.com.qmth.examcloud.examwork.api.response.ResetExamStudentResp;
|
|
|
import cn.com.qmth.examcloud.examwork.api.response.SaveExamStudentResp;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.ExamStudentOuterService;
|
|
@@ -60,6 +65,9 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
@Autowired
|
|
|
ExamStudentCloudService examStudentCloudService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ExamCloudService examCloudService;
|
|
|
+
|
|
|
@ApiOperation(value = "保存考生信息", httpMethod = "POST")
|
|
|
@ApiResponses({
|
|
|
@ApiResponse(code = 200, message = "成功", response = OuterSaveExamStudentResp.class),
|
|
@@ -73,13 +81,25 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
}
|
|
|
|
|
|
+ String examCode = req.getExamCode();
|
|
|
+ String examName = req.getExamName();
|
|
|
+ if (StringUtils.isNotBlank(examName)) {
|
|
|
+ examCode = examName;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamReq getExamReq = new GetExamReq();
|
|
|
+ getExamReq.setCode(examCode);
|
|
|
+ getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
+ ExamBean examBean = r.getExamBean();
|
|
|
+
|
|
|
SaveExamStudentReq request = new SaveExamStudentReq();
|
|
|
|
|
|
request.setCourseCode(req.getCourseCode());
|
|
|
request.setCourseLevel(req.getCourseLevel());
|
|
|
request.setCourseName(req.getCourseName());
|
|
|
request.setExamId(req.getExamId());
|
|
|
- request.setExamName(req.getExamName());
|
|
|
+ request.setExamName(examBean.getName());
|
|
|
request.setIdentityNumber(req.getIdentityNumber());
|
|
|
request.setPaperType(req.getPaperType());
|
|
|
request.setRootOrgId(req.getRootOrgId());
|
|
@@ -127,10 +147,23 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
@Override
|
|
|
public OuterBatchSaveExamStudentResp batchSaveExamStudent(
|
|
|
@RequestBody @ApiParam(required = true) OuterBatchSaveExamStudentReq req) {
|
|
|
+
|
|
|
if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
}
|
|
|
|
|
|
+ String examCode = req.getExamCode();
|
|
|
+ String examName = req.getExamName();
|
|
|
+ if (StringUtils.isNotBlank(examName)) {
|
|
|
+ examCode = examName;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamReq getExamReq = new GetExamReq();
|
|
|
+ getExamReq.setCode(examCode);
|
|
|
+ getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
+ ExamBean examBean = r.getExamBean();
|
|
|
+
|
|
|
List<ExamStudent4BatchBean> examStudentList = req.getExamStudentList();
|
|
|
|
|
|
List<ExamStudentStatus4BatchBean> successList = Lists.newArrayList();
|
|
@@ -143,7 +176,7 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
request.setCourseLevel(cur.getCourseLevel());
|
|
|
request.setCourseName(cur.getCourseName());
|
|
|
request.setExamId(req.getExamId());
|
|
|
- request.setExamName(req.getExamName());
|
|
|
+ request.setExamName(examBean.getName());
|
|
|
request.setIdentityNumber(cur.getIdentityNumber());
|
|
|
request.setPaperType(cur.getPaperType());
|
|
|
request.setRootOrgId(req.getRootOrgId());
|
|
@@ -211,11 +244,23 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
}
|
|
|
|
|
|
+ String examCode = req.getExamCode();
|
|
|
+ String examName = req.getExamName();
|
|
|
+ if (StringUtils.isNotBlank(examName)) {
|
|
|
+ examCode = examName;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamReq getExamReq = new GetExamReq();
|
|
|
+ getExamReq.setCode(examCode);
|
|
|
+ getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
+ ExamBean examBean = r.getExamBean();
|
|
|
+
|
|
|
UpdateExamStudentStatusReq uessReq = new UpdateExamStudentStatusReq();
|
|
|
uessReq.setCourseCode(req.getCourseCode());
|
|
|
uessReq.setCourseId(req.getCourseId());
|
|
|
uessReq.setEnable(req.getEnable());
|
|
|
- uessReq.setExamName(req.getExamName());
|
|
|
+ uessReq.setExamName(examBean.getName());
|
|
|
uessReq.setExamCode(req.getExamCode());
|
|
|
uessReq.setExamId(req.getExamId());
|
|
|
uessReq.setIdentityNumber(req.getIdentityNumber());
|
|
@@ -241,8 +286,20 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
}
|
|
|
|
|
|
+ String examCode = req.getExamCode();
|
|
|
+ String examName = req.getExamName();
|
|
|
+ if (StringUtils.isNotBlank(examName)) {
|
|
|
+ examCode = examName;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamReq getExamReq = new GetExamReq();
|
|
|
+ getExamReq.setCode(examCode);
|
|
|
+ getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
+ GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
+ ExamBean examBean = r.getExamBean();
|
|
|
+
|
|
|
ResetExamStudentReq resReq = new ResetExamStudentReq();
|
|
|
- resReq.setExamName(req.getExamName());
|
|
|
+ resReq.setExamName(examBean.getName());
|
|
|
resReq.setExamCode(req.getExamCode());
|
|
|
resReq.setExamId(req.getExamId());
|
|
|
resReq.setIdentityNumber(req.getIdentityNumber());
|