wangwei пре 6 година
родитељ
комит
075e1a2dba

+ 22 - 23
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/StudentCloudServiceProvider.java

@@ -89,37 +89,36 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 	@PostMapping("getStudent")
 	@Override
 	public GetStudentResp getStudent(@RequestBody GetStudentReq req) {
+		Long studentId = req.getStudentId();
 		Long rootOrgId = req.getRootOrgId();
-		String studentCode = req.getStudentCode();
 		String identityNumber = req.getIdentityNumber();
 
-		if (null == rootOrgId) {
-			throw new StatusException("B-150000", "rootOrgId is null");
-		}
-		if (StringUtils.isBlank(identityNumber)) {
-			throw new StatusException("B-150004", "identityNumber is null");
-		}
-
-		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
-		if (null == rootOrg) {
-			throw new StatusException("B-150001", "机构不存在");
-		}
-		if (null != rootOrg.getParentId()) {
-			throw new StatusException("B-150002", "机构错误");
+		StudentEntity student = null;
+		if (null != studentId) {
+			student = studentRepo.findOne(studentId);
+		} else {
+
+			if (null == rootOrgId) {
+				throw new StatusException("B-150000", "rootOrgId is null");
+			}
+			if (StringUtils.isBlank(identityNumber)) {
+				throw new StatusException("B-150004", "identityNumber is null");
+			}
+
+			OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
+			if (null == rootOrg) {
+				throw new StatusException("B-150001", "机构不存在");
+			}
+			if (null != rootOrg.getParentId()) {
+				throw new StatusException("B-150002", "机构错误");
+			}
+
+			student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
 		}
 
-		StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
-				rootOrgId);
-
 		if (null == student) {
 			throw new StatusException("B-150005", "学生不存在");
 		}
-		String realStudentCode = student.getStudentCode();
-
-		if (StringUtils.isNotBlank(studentCode)
-				&& (StringUtils.isBlank(realStudentCode) || !studentCode.equals(realStudentCode))) {
-			throw new StatusException("B-150005", "学号错误");
-		}
 
 		OrgEntity org = orgRepo.findOne(student.getOrgId());