Sfoglia il codice sorgente

查询学生特殊设置

wangwei 5 anni fa
parent
commit
38f9035cd1

+ 70 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -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;
+	}
+
 }

+ 157 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/bean/ExamStudentSettingsDomain.java

@@ -0,0 +1,157 @@
+package cn.com.qmth.examcloud.core.examwork.api.controller.bean;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
+
+/**
+ * 考试--学生设置
+ *
+ * @author WANGWEI
+ * @date 2018年5月16日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class ExamStudentSettingsDomain implements JsonSerializable {
+
+	private static final long serialVersionUID = -3335725218626631530L;
+
+	private Long id;
+
+	/**
+	 * 考试ID
+	 */
+	private Long examId;
+
+	/**
+	 * 顶级机构ID
+	 */
+	private Long rootOrgId;
+
+	/**
+	 * 学生ID
+	 */
+	private Long studentId;
+
+	/**
+	 * 学生身份证
+	 */
+	private String identityNumber;
+
+	/**
+	 * 学生学号
+	 */
+	private List<String> studentCodeList;
+
+	/**
+	 * 考试批次开始时间
+	 */
+	private Date beginTime;
+
+	/**
+	 * 考试批次结束时间
+	 */
+	private Date endTime;
+
+	/**
+	 * 更新时间
+	 */
+	private Date updateTime;
+
+	/**
+	 * 是否禁止考试
+	 */
+	private Boolean examLimit;
+
+	private Map<String, String> properties;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public Long getStudentId() {
+		return studentId;
+	}
+
+	public void setStudentId(Long studentId) {
+		this.studentId = studentId;
+	}
+
+	public String getIdentityNumber() {
+		return identityNumber;
+	}
+
+	public void setIdentityNumber(String identityNumber) {
+		this.identityNumber = identityNumber;
+	}
+
+	public List<String> getStudentCodeList() {
+		return studentCodeList;
+	}
+
+	public void setStudentCodeList(List<String> studentCodeList) {
+		this.studentCodeList = studentCodeList;
+	}
+
+	public Date getBeginTime() {
+		return beginTime;
+	}
+
+	public void setBeginTime(Date beginTime) {
+		this.beginTime = beginTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public Boolean getExamLimit() {
+		return examLimit;
+	}
+
+	public void setExamLimit(Boolean examLimit) {
+		this.examLimit = examLimit;
+	}
+
+	public Map<String, String> getProperties() {
+		return properties;
+	}
+
+	public void setProperties(Map<String, String> properties) {
+		this.properties = properties;
+	}
+
+}

+ 14 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/entity/ExamSpecialSettingsEntity.java

@@ -67,6 +67,12 @@ public class ExamSpecialSettingsEntity extends JpaEntity {
 	@Column(nullable = true)
 	private Long studentId;
 
+	/**
+	 * 学生学号
+	 */
+	@Column(nullable = true)
+	private String identityNumber;
+
 	/**
 	 * 顶级机构ID
 	 */
@@ -192,4 +198,12 @@ public class ExamSpecialSettingsEntity extends JpaEntity {
 		this.studentId = studentId;
 	}
 
+	public String getIdentityNumber() {
+		return identityNumber;
+	}
+
+	public void setIdentityNumber(String identityNumber) {
+		this.identityNumber = identityNumber;
+	}
+
 }