|
@@ -7,14 +7,22 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.boot.core.exception.ParameterException;
|
|
|
+import com.qmth.distributed.print.business.service.BasicExamService;
|
|
|
+import com.qmth.distributed.print.business.service.BasicExamStudentService;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicExamStudent;
|
|
|
+import com.qmth.teachcloud.common.enums.BasicExamStudentStatusEnum;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
|
|
|
import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
|
|
|
import com.qmth.teachcloud.mark.bean.student.StudentQuery;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -37,6 +45,14 @@ public class ScanStudentController extends BaseController {
|
|
|
@Resource
|
|
|
private MarkStudentService markStudentService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private BasicExamStudentService basicExamStudentService;
|
|
|
+ @Resource
|
|
|
+ private BasicExamService basicExamService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MarkPaperService markPaperService;
|
|
|
+
|
|
|
@ApiOperation(value = "考生查询")
|
|
|
@RequestMapping(value = "find", method = RequestMethod.POST)
|
|
|
public Result student(@Validated StudentQuery query) {
|
|
@@ -113,8 +129,35 @@ public class ScanStudentController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "考生新增")
|
|
|
@RequestMapping(value = "save", method = RequestMethod.POST)
|
|
|
- public Result studentSave(@RequestParam Long examId, @RequestParam String coursePaperId, @RequestParam String studentCode, @RequestParam String studentName,@RequestParam(required = false) String paperType) {
|
|
|
- return ResultUtil.ok(markStudentService.add(examId,coursePaperId,studentCode,studentName,paperType));
|
|
|
+ public Result studentSave(@RequestParam Long examId, @RequestParam String coursePaperId, @RequestParam String studentCode, @RequestParam String studentName,@RequestParam(required = false) String paperType,@RequestParam String teachClassName) {
|
|
|
+ MarkStudent markStudent = markStudentService.findByExamIdAndCoursePaperIdAndStudentCode(examId,coursePaperId,studentCode);
|
|
|
+ if(markStudent != null ){
|
|
|
+ throw new ParameterException("考生已存在");
|
|
|
+ }
|
|
|
+ BasicExamStudent basicExamStudent = basicExamStudentService.findByExamIdAndCoursePaperIdAndStudentCode(examId,coursePaperId,studentCode);
|
|
|
+ if(basicExamStudent != null ){
|
|
|
+ throw new ParameterException("基础考生已存在");
|
|
|
+ }
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndCoursePaperId(examId, coursePaperId);
|
|
|
+ BasicExam basicExam = basicExamService.getById(examId);
|
|
|
+ basicExamStudent = new BasicExamStudent();
|
|
|
+ basicExamStudent.setId(SystemConstant.getDbUuid());
|
|
|
+ basicExamStudent.setSchoolId(basicExam.getSchoolId());
|
|
|
+ basicExamStudent.setSemesterId(Long.valueOf(basicExam.getSemesterId()));
|
|
|
+ basicExamStudent.setExamId(examId);
|
|
|
+ basicExamStudent.setCourseId(markPaper.getCourseId());
|
|
|
+ basicExamStudent.setCourseCode(markPaper.getCourseCode());
|
|
|
+ basicExamStudent.setCourseName(markPaper.getCourseName());
|
|
|
+ basicExamStudent.setCoursePaperId(coursePaperId);
|
|
|
+ basicExamStudent.setPaperNumber(markPaper.getPaperNumber());
|
|
|
+ basicExamStudent.setPaperType(paperType);
|
|
|
+ basicExamStudent.setStudentCode(studentCode);
|
|
|
+ basicExamStudent.setStudentName(studentName);
|
|
|
+ basicExamStudent.setStatus(BasicExamStudentStatusEnum.N);
|
|
|
+ basicExamStudent.setEnable(true);
|
|
|
+ basicExamStudent.setTeachClassName(teachClassName);
|
|
|
+ this.basicExamStudentService.save(basicExamStudent);
|
|
|
+ return ResultUtil.ok(markStudentService.add(examId,coursePaperId,studentCode,studentName,paperType,basicExamStudent.getId()));
|
|
|
}
|
|
|
|
|
|
}
|