WANG 5 gadi atpakaļ
vecāks
revīzija
0c56e41b11

+ 7 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamStudentCloudServiceProvider.java

@@ -481,6 +481,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 		Long rootOrgId = req.getRootOrgId();
 		Long examId = req.getExamId();
 		String examCode = req.getExamCode();
+		String examName = req.getExamName();
 		Long studentId = req.getStudentId();
 		String identityNumber = req.getIdentityNumber();
 		String studentName = req.getStudentName();
@@ -499,6 +500,11 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 			if (null == examEntity) {
 				throw new StatusException("088002", "exam is not present");
 			}
+		} else if (StringUtils.isNotBlank(examName)) {
+			examEntity = examRepo.findByNameAndRootOrgId(examName, rootOrgId);
+			if (null == examEntity) {
+				throw new StatusException("088003", "exam is not present");
+			}
 		}
 
 		GetStudentReq gsReq = new GetStudentReq();
@@ -524,6 +530,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 			info.setCourseId(cur.getCourseId());
 			info.setRootOrgId(req.getRootOrgId());
 			info.setExamId(req.getExamId());
+			info.setExamCode(req.getExamCode());
 			info.setExamName(examEntity.getName());
 			info.setIdentityNumber(identityNumber);
 			info.setPaperType(cur.getPaperType());

+ 13 - 0
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/bean/ExamStudentInfo.java

@@ -21,6 +21,11 @@ public class ExamStudentInfo {
 	 */
 	private Long examId;
 
+	/**
+	 * 考试编码
+	 */
+	private String examCode;
+
 	/**
 	 * 考试名称
 	 */
@@ -160,6 +165,14 @@ public class ExamStudentInfo {
 		this.examId = examId;
 	}
 
+	public String getExamCode() {
+		return examCode;
+	}
+
+	public void setExamCode(String examCode) {
+		this.examCode = examCode;
+	}
+
 	public String getExamName() {
 		return examName;
 	}

+ 6 - 0
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamStudentServiceImpl.java

@@ -210,12 +210,18 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		ExamEntity exam = null;
 		Long examId = examStudentInfo.getExamId();
 		String examName = examStudentInfo.getExamName();
+		String examCode = examStudentInfo.getExamCode();
 
 		if (null != examId) {
 			exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
 			if (null == exam) {
 				throw new StatusException("100020", "examId is wrong");
 			}
+		} else if (StringUtils.isNotBlank(examCode)) {
+			exam = examRepo.findByCodeAndRootOrgId(examCode, rootOrgId);
+			if (null == exam) {
+				throw new StatusException("1000050", "考试不存在");
+			}
 		} else if (StringUtils.isNotBlank(examName)) {
 			exam = examRepo.findByNameAndRootOrgId(examName, rootOrgId);
 			if (null == exam) {