|
@@ -26,9 +26,15 @@ import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamPaperTypeRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
|
|
@@ -54,7 +60,7 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
|
- * 类注释
|
|
|
+ * {@link StatusException} 状态码范围:088XXX<br>
|
|
|
*
|
|
|
* @author WANGWEI
|
|
|
* @date 2018年7月18日
|
|
@@ -405,10 +411,63 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "更新考生状态")
|
|
|
+ @PostMapping("updateExamStudentStatus")
|
|
|
@Override
|
|
|
- public UpdateExamStudentStatusResp updateExamStudentStatus(UpdateExamStudentStatusReq req) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ public UpdateExamStudentStatusResp updateExamStudentStatus(
|
|
|
+ @RequestBody UpdateExamStudentStatusReq req) {
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
+ Long examId = req.getExamId();
|
|
|
+ String examCode = req.getExamCode();
|
|
|
+ Long studentId = req.getStudentId();
|
|
|
+ String identityNumber = req.getIdentityNumber();
|
|
|
+ Long courseId = req.getCourseId();
|
|
|
+ String courseCode = req.getCourseCode();
|
|
|
+ Boolean enable = req.getEnable();
|
|
|
+
|
|
|
+ if (null == rootOrgId) {
|
|
|
+ throw new StatusException("088001", "rootOrgId is null");
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamEntity examEntity = null;
|
|
|
+ if (null != examId) {
|
|
|
+ examEntity = GlobalHelper.getPresentEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ GlobalHelper.uniformRootOrg(examEntity.getRootOrgId(), rootOrgId);
|
|
|
+ } else if (StringUtils.isNotBlank(courseCode)) {
|
|
|
+ examEntity = examRepo.findByCodeAndRootOrgId(examCode, rootOrgId);
|
|
|
+ if (null == examEntity) {
|
|
|
+ throw new StatusException("088002", "exam is not present");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == courseId && StringUtils.isBlank(courseCode)) {
|
|
|
+ throw new StatusException("088003", "courseId & courseCode cannot be all null");
|
|
|
+ }
|
|
|
+ GetCourseReq gcR = new GetCourseReq();
|
|
|
+ gcR.setRootOrgId(rootOrgId);
|
|
|
+ gcR.setId(courseId);
|
|
|
+ gcR.setCode(courseCode);
|
|
|
+ GetCourseResp gcResp = courseCloudService.getCourse(gcR);
|
|
|
+ CourseBean courseBean = gcResp.getCourseBean();
|
|
|
+
|
|
|
+ GetStudentReq gsReq = new GetStudentReq();
|
|
|
+ gsReq.setRootOrgId(rootOrgId);
|
|
|
+ gsReq.setIdentityNumber(identityNumber);
|
|
|
+ gsReq.setStudentId(studentId);
|
|
|
+
|
|
|
+ GetStudentResp gsResp = studentCloudService.getStudent(gsReq);
|
|
|
+ StudentBean studentBean = gsResp.getStudentInfo();
|
|
|
+
|
|
|
+ ExamStudentEntity es = examStudentRepo.findByExamIdAndStudentIdAndCourseId(examId,
|
|
|
+ studentBean.getId(), courseBean.getId());
|
|
|
+
|
|
|
+ es.setEnable(enable);
|
|
|
+
|
|
|
+ ExamStudentEntity saved = examStudentRepo.save(es);
|
|
|
+
|
|
|
+ UpdateExamStudentStatusResp resp = new UpdateExamStudentStatusResp();
|
|
|
+ resp.setExamStudentId(saved.getId());
|
|
|
+ return resp;
|
|
|
}
|
|
|
|
|
|
}
|