|
@@ -68,6 +68,7 @@ import cn.com.qmth.examcloud.core.basic.api.response.GetOrgsResp;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.CopyExamDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamOrgSettingsDomain;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamStudentSettingsDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamOrgPropertyRepo;
|
|
@@ -926,6 +927,7 @@ public class ExamController extends ControllerSupport {
|
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
|
predicates.add(cb.equal(root.get("examId"), examOrgDomain.getExamId()));
|
|
|
predicates.add(cb.isNull(root.get("courseId")));
|
|
|
+ predicates.add(cb.isNull(root.get("studentId")));
|
|
|
|
|
|
if (null != examOrgDomain.getOrgId()) {
|
|
|
predicates.add(cb.equal(root.get("orgId"), examOrgDomain.getOrgId()));
|
|
@@ -1408,4 +1410,72 @@ public class ExamController extends ControllerSupport {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "查询考试相关的学生设置", notes = "")
|
|
|
+ @GetMapping("getExamStudentSettingsList/{curPage}/{pageSize}")
|
|
|
+ public PageInfo<ExamStudentSettingsDomain> getExamStudentSettingsList(
|
|
|
+ @PathVariable Integer curPage, @PathVariable Integer pageSize,
|
|
|
+ @ModelAttribute ExamStudentSettingsDomain examStudentDomain) {
|
|
|
+
|
|
|
+ Long examId = examStudentDomain.getExamId();
|
|
|
+ if (null == examStudentDomain.getExamId()) {
|
|
|
+ throw new StatusException("001210", "examId is null");
|
|
|
+ }
|
|
|
+ ExamEntity examEntity = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ if (null == examEntity) {
|
|
|
+ throw new StatusException("001250", "examId is wrong");
|
|
|
+ }
|
|
|
+ validateRootOrgIsolation(examEntity.getRootOrgId());
|
|
|
+
|
|
|
+ Specification<ExamSpecialSettingsEntity> specification = (root, query, cb) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(cb.equal(root.get("examId"), examStudentDomain.getExamId()));
|
|
|
+ predicates.add(cb.isNull(root.get("courseId")));
|
|
|
+ predicates.add(cb.isNull(root.get("orgId")));
|
|
|
+
|
|
|
+ if (null != examStudentDomain.getStudentId()) {
|
|
|
+ predicates.add(cb.equal(root.get("studentId"), examStudentDomain.getStudentId()));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.isNotNull(root.get("studentId")));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != examStudentDomain.getIdentityNumber()) {
|
|
|
+ predicates.add(cb.equal(root.get("identityNumber"),
|
|
|
+ examStudentDomain.getIdentityNumber()));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.isNotNull(root.get("getIdentityNumber")));
|
|
|
+ }
|
|
|
+
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+
|
|
|
+ Pageable pageable = PageRequest.of(curPage, pageSize, Sort.Direction.DESC, "updateTime",
|
|
|
+ "id");
|
|
|
+ Page<ExamSpecialSettingsEntity> page = examSpecialSettingsRepo.findAll(specification,
|
|
|
+ pageable);
|
|
|
+
|
|
|
+ Iterator<ExamSpecialSettingsEntity> iterator = page.iterator();
|
|
|
+ List<ExamStudentSettingsDomain> domainList = Lists.newArrayList();
|
|
|
+
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ ExamSpecialSettingsEntity next = iterator.next();
|
|
|
+ ExamStudentSettingsDomain bean = new ExamStudentSettingsDomain();
|
|
|
+ domainList.add(bean);
|
|
|
+
|
|
|
+ bean.setBeginTime(next.getBeginTime());
|
|
|
+ bean.setEndTime(next.getEndTime());
|
|
|
+ bean.setExamId(next.getExamId());
|
|
|
+ bean.setId(next.getId());
|
|
|
+ bean.setRootOrgId(next.getRootOrgId());
|
|
|
+ bean.setUpdateTime(next.getUpdateTime());
|
|
|
+ bean.setExamLimit(next.getExamLimit());
|
|
|
+ bean.setStudentId(next.getStudentId());
|
|
|
+ bean.setIdentityNumber(next.getIdentityNumber());
|
|
|
+ }
|
|
|
+
|
|
|
+ PageInfo<ExamStudentSettingsDomain> ret = new PageInfo<ExamStudentSettingsDomain>();
|
|
|
+ ret.setList(domainList);
|
|
|
+ ret.setTotal(page.getTotalElements());
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
}
|