Bladeren bron

。。。

wangwei 7 jaren geleden
bovenliggende
commit
05d0fdf559

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

@@ -48,6 +48,8 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 	public InsertOrUpdateStudentResp insertOrUpdateStudent(
 			@RequestBody InsertOrUpdateStudentReq req) {
 
+		trim(req);
+
 		StudentInfo studentInfo = new StudentInfo();
 		studentInfo.setName(req.getName());
 		studentInfo.setIdentityNumber(req.getIdentityNumber());

+ 7 - 4
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java

@@ -158,6 +158,9 @@ public class StudentServiceImpl implements StudentService {
 		}
 
 		String identityNumber = studentInfo.getIdentityNumber();
+		if (StringUtils.isBlank(identityNumber)) {
+			throw new StatusException("B-160012", "身份证号不能为空");
+		}
 		String studentCode = studentInfo.getStudentCode();
 		if (StringUtils.isBlank(studentCode)) {
 			studentCode = null;
@@ -167,13 +170,13 @@ public class StudentServiceImpl implements StudentService {
 				rootOrgId);
 		if (1 < list.size()) {
 			throw new StatusException("B-160007",
-					"已经存在不同考生的身份证号相同的数据. identityNumber: " + identityNumber);
+					"已经存在不同考生的身份证号相同的数据,请联系服务商处理. 身份证号: " + identityNumber);
 		}
 		if (StringUtils.isNotBlank(studentCode)) {
 			list = studentRepo.findAllByStudentCodeAndRootOrgId(studentCode, rootOrgId);
 			if (1 < list.size()) {
 				throw new StatusException("B-160008",
-						"已经存在不同考生的学号相同的数据. studentCode: " + studentCode);
+						"已经存在不同考生的学号相同的数据,请联系服务商处理. 学号: " + studentCode);
 			}
 		}
 
@@ -183,7 +186,7 @@ public class StudentServiceImpl implements StudentService {
 		if (null != studentByIdentity) {
 			String curStudentCode = studentByIdentity.getStudentCode();
 			if (StringUtils.isNotBlank(curStudentCode) && !curStudentCode.equals(studentCode)) {
-				throw new StatusException("B-160005", "身份证对应得");
+				throw new StatusException("B-160005", "身份证号已关联学号,请联系服务商处理.");
 			}
 		}
 
@@ -193,7 +196,7 @@ public class StudentServiceImpl implements StudentService {
 			if (null != studentByCode) {
 				String curIdentityNumber = studentByCode.getIdentityNumber();
 				if (!curIdentityNumber.equals(identityNumber)) {
-					throw new StatusException("B-160006", "studentCode is wrong");
+					throw new StatusException("B-160006", "学号已关联身份证号,请联系服务商处理.");
 				}
 			}
 		}