|
@@ -77,9 +77,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@RestController
|
|
|
@Api(tags = "RPC-考生相关接口")
|
|
|
@RequestMapping("${$rmp.cloud.examwork}" + "examStudent")
|
|
|
-public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
- implements
|
|
|
- ExamStudentCloudService {
|
|
|
+public class ExamStudentCloudServiceProvider extends ControllerSupport implements ExamStudentCloudService {
|
|
|
|
|
|
private static final long serialVersionUID = -89062090947597841L;
|
|
|
|
|
@@ -103,6 +101,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
|
|
|
@Autowired
|
|
|
CourseCloudService courseCloudService;
|
|
|
+
|
|
|
@Autowired
|
|
|
ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
|
|
|
|
|
@@ -112,7 +111,13 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
@Override
|
|
|
public SaveExamStudentResp saveExamStudent(@RequestBody SaveExamStudentReq req) {
|
|
|
trim(req);
|
|
|
-
|
|
|
+ ExamEntity exam = GlobalHelper.getEntity(examRepo, req.getExamId(), ExamEntity.class);
|
|
|
+ if (exam == null) {
|
|
|
+ throw new StatusException("未找到考试");
|
|
|
+ }
|
|
|
+ if (exam.getArchived()) {
|
|
|
+ throw new StatusException("考试已归档,不能新增考生");
|
|
|
+ }
|
|
|
ExamStudentInfo info = new ExamStudentInfo();
|
|
|
info.setCourseCode(req.getCourseCode());
|
|
|
info.setCourseName(req.getCourseName());
|
|
@@ -143,7 +148,6 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
|
|
|
info.setExamStageId(req.getExamStageId());
|
|
|
info.setExamStageOrder(req.getExamStageOrder());
|
|
|
-
|
|
|
|
|
|
ExamStudentInfo saved = examStudentService.saveExamStudent(info);
|
|
|
|
|
@@ -173,12 +177,12 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
|
|
|
resp.setExamStudentBean(examStudentBean);
|
|
|
|
|
|
- //操作日志
|
|
|
- ReportsUtil.report(new OperateReport(saved.getRootOrgId(), null, saved.getStudentId(), saved.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_IMPORT.getDesc()));
|
|
|
+ // 操作日志
|
|
|
+ ReportsUtil.report(new OperateReport(saved.getRootOrgId(), null, saved.getStudentId(), saved.getId(),
|
|
|
+ UserType.COMMON, OperateContent.EXAM_STUDENT_IMPORT.getDesc()));
|
|
|
return resp;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@ApiOperation(value = "复制考生")
|
|
|
@PostMapping("copyExamStudents")
|
|
|
@Transactional
|
|
@@ -234,8 +238,8 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
while (iterator.hasNext()) {
|
|
|
ExamStudentEntity es = iterator.next();
|
|
|
|
|
|
- ExamStudentEntity finded = examStudentRepo.findByExamIdAndStudentIdAndCourseId(examId2,
|
|
|
- es.getStudentId(), es.getCourseId());
|
|
|
+ ExamStudentEntity finded = examStudentRepo.findByExamIdAndStudentIdAndCourseId(examId2, es.getStudentId(),
|
|
|
+ es.getCourseId());
|
|
|
|
|
|
if (null != finded) {
|
|
|
continue;
|
|
@@ -273,9 +277,10 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
one.setExt5(es.getExt5());
|
|
|
|
|
|
ExamStudentInfo saved = examStudentService.saveExamStudent(one);
|
|
|
- // //操作日志
|
|
|
- // ReportsUtil.report(new OperateReport(saved.getRootOrgId(), null, saved.getStudentId(),saved.getId(), UserType.COMMON,
|
|
|
- // OperateContent.EXAM_STUDENT_COPY.getDesc()));
|
|
|
+ // //操作日志
|
|
|
+ // ReportsUtil.report(new OperateReport(saved.getRootOrgId(), null,
|
|
|
+ // saved.getStudentId(),saved.getId(), UserType.COMMON,
|
|
|
+ // OperateContent.EXAM_STUDENT_COPY.getDesc()));
|
|
|
examStudentIds.add(saved.getId());
|
|
|
|
|
|
next = es.getId();
|
|
@@ -299,8 +304,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
public GetExamStudentResp getExamStudent(@RequestBody GetExamStudentReq req) {
|
|
|
Long examStudentId = req.getExamStudentId();
|
|
|
|
|
|
- ExamStudentEntity examStudent = GlobalHelper.getEntity(examStudentRepo, examStudentId,
|
|
|
- ExamStudentEntity.class);
|
|
|
+ ExamStudentEntity examStudent = GlobalHelper.getEntity(examStudentRepo, examStudentId, ExamStudentEntity.class);
|
|
|
|
|
|
if (examStudent == null) {
|
|
|
throw new StatusException("考生信息不存在!id=" + examStudentId);
|
|
@@ -403,8 +407,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
|
|
|
- PageRequest pageRequest = PageRequest.of(curPage, pageSize,
|
|
|
- Sort.by(Direction.DESC, "updateTime", "id"));
|
|
|
+ PageRequest pageRequest = PageRequest.of(curPage, pageSize, Sort.by(Direction.DESC, "updateTime", "id"));
|
|
|
|
|
|
Page<ExamStudentEntity> examStudents = examStudentRepo.findAll(specification, pageRequest);
|
|
|
|
|
@@ -451,8 +454,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
@PostMapping("updateExamStudentStatus")
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public UpdateExamStudentStatusResp updateExamStudentStatus(
|
|
|
- @RequestBody UpdateExamStudentStatusReq req) {
|
|
|
+ public UpdateExamStudentStatusResp updateExamStudentStatus(@RequestBody UpdateExamStudentStatusReq req) {
|
|
|
Long rootOrgId = req.getRootOrgId();
|
|
|
Long examId = req.getExamId();
|
|
|
String examCode = req.getExamCode();
|
|
@@ -503,8 +505,8 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
GetStudentResp gsResp = studentCloudService.getStudent(gsReq);
|
|
|
StudentBean studentBean = gsResp.getStudentInfo();
|
|
|
|
|
|
- ExamStudentEntity es = examStudentRepo.findByExamIdAndStudentIdAndCourseId(
|
|
|
- examEntity.getId(), studentBean.getId(), courseBean.getId());
|
|
|
+ ExamStudentEntity es = examStudentRepo.findByExamIdAndStudentIdAndCourseId(examEntity.getId(),
|
|
|
+ studentBean.getId(), courseBean.getId());
|
|
|
|
|
|
es.setEnable(enable);
|
|
|
|
|
@@ -512,13 +514,13 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
|
|
|
examStudentService.syncExamStudent(saved.getId());
|
|
|
|
|
|
- //操作日志
|
|
|
+ // 操作日志
|
|
|
if (enable) {
|
|
|
- ReportsUtil.report(new OperateReport(es.getRootOrgId(), null, es.getStudentId(), es.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_ENABLE.getDesc()));
|
|
|
+ ReportsUtil.report(new OperateReport(es.getRootOrgId(), null, es.getStudentId(), es.getId(),
|
|
|
+ UserType.COMMON, OperateContent.EXAM_STUDENT_ENABLE.getDesc()));
|
|
|
} else {
|
|
|
- ReportsUtil.report(new OperateReport(es.getRootOrgId(), null, es.getStudentId(), es.getId(), UserType.COMMON,
|
|
|
- OperateContent.EXAM_STUDENT_DISABLE.getDesc()));
|
|
|
+ ReportsUtil.report(new OperateReport(es.getRootOrgId(), null, es.getStudentId(), es.getId(),
|
|
|
+ UserType.COMMON, OperateContent.EXAM_STUDENT_DISABLE.getDesc()));
|
|
|
}
|
|
|
UpdateExamStudentStatusResp resp = new UpdateExamStudentStatusResp();
|
|
|
resp.setExamStudentId(saved.getId());
|
|
@@ -571,8 +573,8 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
|
|
|
GetStudentResp gsResp = studentCloudService.getStudent(gsReq);
|
|
|
StudentBean studentBean = gsResp.getStudentInfo();
|
|
|
|
|
|
- List<ExamStudentEntity> presentExamStudentList = examStudentRepo
|
|
|
- .findByExamIdAndStudentId(examId, studentBean.getId());
|
|
|
+ List<ExamStudentEntity> presentExamStudentList = examStudentRepo.findByExamIdAndStudentId(examId,
|
|
|
+ studentBean.getId());
|
|
|
|
|
|
for (ExamStudentEntity cur : presentExamStudentList) {
|
|
|
cur.setEnable(false);
|