|
@@ -0,0 +1,59 @@
|
|
|
+package cn.com.qmth.examcloud.core.examwork.api.provider;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.common.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.common.util.BeanCopierUtil;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.request.ExamStudentReq;
|
|
|
+import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
|
|
|
+import cn.com.qmth.examcloud.service.examwork.dto.ExamStudentDTO;
|
|
|
+import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
|
|
|
+import cn.com.qmth.examcloud.service.examwork.service.ExamStudentService;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author chenken
|
|
|
+ * @date 2018年5月4日 下午2:06:14
|
|
|
+ * @company QMTH
|
|
|
+ * @description ExamStudentProvider.java
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("${url.prefix}/examStudent")
|
|
|
+public class ExamStudentCloudServiceProvider extends ControllerSupport implements ExamStudentCloudService{
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentService examStudentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentRepo examStudentRepo;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveExamStudent(ExamStudentReq examStudentReq) {
|
|
|
+ ExamStudentDTO examStudentDto = new ExamStudentDTO();
|
|
|
+ examStudentDto.setExamId(examStudentReq.getExamId());
|
|
|
+ examStudentDto.setCourseCode(examStudentReq.getCourseCode());
|
|
|
+ examStudentDto.setIdentityNumber(examStudentReq.getIdentityNumber());
|
|
|
+ List<ExamStudent> examStudents = examStudentService.getAllExamStudent(examStudentDto);
|
|
|
+ if(examStudents!=null&&examStudents.size()>0){
|
|
|
+ ExamStudent examStudentOld = examStudents.get(0);
|
|
|
+ //更新相关的姓名、学习中心、专业
|
|
|
+ examStudentOld.setName(examStudentReq.getStudentName());
|
|
|
+ examStudentOld.setOrgId(examStudentReq.getOrgId());
|
|
|
+ examStudentOld.setOrgCode(examStudentReq.getOrgCode());
|
|
|
+ examStudentOld.setOrgName(examStudentReq.getOrgName());
|
|
|
+ examStudentOld.setRootOrgId(examStudentReq.getRootOrgId());
|
|
|
+ examStudentOld.setSpecialtyName(examStudentReq.getSpecialtyName());
|
|
|
+ examStudentRepo.save(examStudentOld);
|
|
|
+ }else{
|
|
|
+ ExamStudent examStudent = BeanCopierUtil.copyProperties(examStudentReq, ExamStudent.class);
|
|
|
+ examStudent.setFinished(false);
|
|
|
+ examStudentRepo.save(examStudent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|