|
@@ -44,6 +44,9 @@ import cn.com.qmth.examcloud.common.dto.examwork.CommonExamStudent;
|
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
|
import cn.com.qmth.examcloud.commons.base.util.excel.ExcelError;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.InsertOrUpdateStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.InsertOrUpdateStudentResp;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamStudentDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.base.util.ExportUtils;
|
|
|
import cn.com.qmth.examcloud.core.examwork.base.util.ImportUtils;
|
|
@@ -52,9 +55,12 @@ import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.bean.ExamStudentAssembler;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.bean.ExamStudentDTO;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.bean.OrgExamInfoDTO;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.entity.Exam;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudent;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.impl.ExamStudentService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.response.SaveExamStudentResp;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
@@ -78,6 +84,12 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
ExamRepo examRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ StudentCloudService studentCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamStudentCloudService examStudentCloudService;
|
|
|
+
|
|
|
@GetMapping("/query")
|
|
|
public List<ExamStudent> find(
|
|
|
@RequestParam(value = "student_id", required = false) Long studentId) {
|
|
@@ -120,9 +132,9 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
if (null != examCriteria.getExamId()) {
|
|
|
predicates.add(cb.equal(root.get("exam").get("id"), examCriteria.getExamId()));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(examCriteria.getName())) {
|
|
|
- predicates
|
|
|
- .add(cb.like(root.get("name"), toSqlSearchPattern(examCriteria.getName())));
|
|
|
+ if (StringUtils.isNotEmpty(examCriteria.getStudentName())) {
|
|
|
+ predicates.add(cb.like(root.get("name"),
|
|
|
+ toSqlSearchPattern(examCriteria.getStudentName())));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(examCriteria.getStudentCode())) {
|
|
|
predicates.add(cb.like(root.get("studentCode"),
|
|
@@ -165,7 +177,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
for (ExamStudent cur : examStudents) {
|
|
|
ExamStudentDomain bean = new ExamStudentDomain();
|
|
|
bean.setId(cur.getId());
|
|
|
- bean.setName(cur.getName());
|
|
|
+ bean.setStudentName(cur.getName());
|
|
|
bean.setStudentCode(cur.getStudentCode());
|
|
|
bean.setIdentityNumber(cur.getIdentityNumber());
|
|
|
bean.setCourseCode(cur.getCourseCode());
|
|
@@ -232,41 +244,81 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
return new ResponseEntity(examStudentService.findById(id), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param request
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@ApiOperation(value = "新增考试学生", notes = "新增")
|
|
|
@PostMapping()
|
|
|
- public ExamStudent addExamStudent(HttpServletRequest request,
|
|
|
- @RequestBody ExamStudent examStudent) {
|
|
|
-
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- if (accessUser != null) {
|
|
|
- examStudent.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- }
|
|
|
- Exam exam = examRepo.findOne(examStudent.getExam().getId());
|
|
|
- examStudent.setExam(exam);
|
|
|
- if (StringUtils.isEmpty(examStudent.getPaperType())) {
|
|
|
- examStudent.setPaperType("O");
|
|
|
- }
|
|
|
- if (null == examStudent.getFinished()) {
|
|
|
- examStudent.setFinished(false);
|
|
|
- }
|
|
|
- ExamStudent saveExamStu = examStudentService.saveExamStudent(accessUser.getUserToken(),
|
|
|
- examStudent);
|
|
|
- return saveExamStu;
|
|
|
+ public ExamStudentDomain addExamStudent(HttpServletRequest request,
|
|
|
+ @RequestBody ExamStudentDomain examStudent) {
|
|
|
+ return saveExamStudent(examStudent);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@ApiOperation(value = "更新考试学生", notes = "更新")
|
|
|
@PutMapping()
|
|
|
- public ExamStudent updateExamStudent(@RequestBody ExamStudent examStudent) {
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ public ExamStudentDomain updateExamStudent(@RequestBody ExamStudentDomain examStudent) {
|
|
|
+ return saveExamStudent(examStudent);
|
|
|
+ }
|
|
|
|
|
|
- Exam exam = examRepo.findOne(examStudent.getExam().getId());
|
|
|
- examStudent.setExam(exam);
|
|
|
- if (StringUtils.isEmpty(examStudent.getPaperType())) {
|
|
|
- examStudent.setPaperType("O");
|
|
|
- }
|
|
|
- ExamStudent saveExamStu = examStudentService.saveExamStudent(accessUser.getUserToken(),
|
|
|
- examStudent);
|
|
|
- return saveExamStu;
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ExamStudentDomain saveExamStudent(ExamStudentDomain examStudent) {
|
|
|
+ InsertOrUpdateStudentReq saveStudentReq = new InsertOrUpdateStudentReq();
|
|
|
+ saveStudentReq.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
+ saveStudentReq.setName(examStudent.getStudentName());
|
|
|
+ saveStudentReq.setPhoneNumber(examStudent.getPhone());
|
|
|
+ saveStudentReq.setOrgCode(examStudent.getOrgCode());
|
|
|
+ saveStudentReq.setOrgId(examStudent.getOrgId());
|
|
|
+ saveStudentReq.setOrgName(examStudent.getOrgName());
|
|
|
+ saveStudentReq.setRemark(examStudent.getRemark());
|
|
|
+ saveStudentReq.setRootOrgId(examStudent.getRootOrgId());
|
|
|
+ saveStudentReq.setStudentCode(examStudent.getStudentCode());
|
|
|
+
|
|
|
+ InsertOrUpdateStudentResp insertOrUpdateStudentResp = studentCloudService
|
|
|
+ .insertOrUpdateStudent(saveStudentReq);
|
|
|
+
|
|
|
+ Long studentId = insertOrUpdateStudentResp.getStudentId();
|
|
|
+
|
|
|
+ SaveExamStudentReq saveExamStudentReq = new SaveExamStudentReq();
|
|
|
+ saveExamStudentReq.setCourseCode(examStudent.getCourseCode());
|
|
|
+ saveExamStudentReq.setCourseLevel(examStudent.getCourseLevel());
|
|
|
+ saveExamStudentReq.setCourseName(examStudent.getCourseName());
|
|
|
+ saveExamStudentReq.setExamId(examStudent.getExamId());
|
|
|
+ saveExamStudentReq.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
+ saveExamStudentReq.setPaperType(examStudent.getPaperType());
|
|
|
+ saveExamStudentReq.setRootOrgId(examStudent.getRootOrgId());
|
|
|
+ saveExamStudentReq.setStudentCode(examStudent.getStudentCode());
|
|
|
+ saveExamStudentReq.setStudentName(examStudent.getStudentName());
|
|
|
+ saveExamStudentReq.setStudentId(studentId);
|
|
|
+
|
|
|
+ SaveExamStudentResp saveExamStudentResp = examStudentCloudService
|
|
|
+ .saveExamStudent(saveExamStudentReq);
|
|
|
+ ExamStudentBean examStudentBean = saveExamStudentResp.getExamStudentBean();
|
|
|
+
|
|
|
+ ExamStudentDomain ret = new ExamStudentDomain();
|
|
|
+ ret.setStudentId(studentId);
|
|
|
+ ret.setStudentCode(examStudentBean.getStudentCode());
|
|
|
+ ret.setStudentName(examStudentBean.getStudentName());
|
|
|
+ ret.setCourseCode(examStudentBean.getCourseCode());
|
|
|
+ ret.setCourseName(examStudentBean.getCourseName());
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新考试学生缺考状态", notes = "更新缺考")
|