|
@@ -94,6 +94,8 @@ public class StudentServiceImpl implements StudentService {
|
|
|
org.setRootId(rootOrgId);
|
|
|
org = orgRepo.save(org);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ throw new StatusException("B-160082", "orgId,orgCode can not be all null");
|
|
|
}
|
|
|
|
|
|
String identityNumber = studentInfo.getIdentityNumber();
|
|
@@ -101,12 +103,15 @@ public class StudentServiceImpl implements StudentService {
|
|
|
throw new StatusException("B-160012", "身份证号不能为空");
|
|
|
}
|
|
|
|
|
|
- StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
|
|
|
+ StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
|
|
|
+ rootOrgId);
|
|
|
|
|
|
String studentCode = studentInfo.getStudentCode();
|
|
|
if (StringUtils.isNotBlank(studentCode)) {
|
|
|
- StudentEntity studentByCode = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
|
|
|
- if (null != studentByCode && (!studentByCode.getIdentityNumber().equalsIgnoreCase(identityNumber))) {
|
|
|
+ StudentEntity studentByCode = studentRepo.findByStudentCodeAndRootOrgId(studentCode,
|
|
|
+ rootOrgId);
|
|
|
+ if (null != studentByCode
|
|
|
+ && (!studentByCode.getIdentityNumber().equalsIgnoreCase(identityNumber))) {
|
|
|
throw new StatusException("B-160008", "学号被占用. 学号: " + studentCode);
|
|
|
}
|
|
|
|
|
@@ -127,7 +132,8 @@ public class StudentServiceImpl implements StudentService {
|
|
|
student = new StudentEntity();
|
|
|
student.setEnable(true);
|
|
|
if (identityNumber.matches("[0-9a-zA-Z]{6,}")) {
|
|
|
- student.setPassword(StringUtils.substring(identityNumber, -6, identityNumber.length()));
|
|
|
+ student.setPassword(
|
|
|
+ StringUtils.substring(identityNumber, -6, identityNumber.length()));
|
|
|
} else {
|
|
|
student.setPassword(BasicConsts.DEFAULT_PASSWORD);
|
|
|
}
|
|
@@ -135,9 +141,7 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
|
|
student.setRootOrgId(rootOrgId);
|
|
|
student.setIdentityNumber(identityNumber);
|
|
|
- if (null != org) {
|
|
|
- student.setOrgId(org.getId());
|
|
|
- }
|
|
|
+ student.setOrgId(org.getId());
|
|
|
if (StringUtils.isNotBlank(studentCode)) {
|
|
|
student.setStudentCode(studentCode);
|
|
|
}
|
|
@@ -168,11 +172,9 @@ public class StudentServiceImpl implements StudentService {
|
|
|
req.setId(saved.getId());
|
|
|
req.setIdentityNumber(saved.getIdentityNumber());
|
|
|
req.setName(saved.getName());
|
|
|
- if (null != org) {
|
|
|
- req.setOrgCode(org.getCode());
|
|
|
- req.setOrgId(org.getId());
|
|
|
- req.setOrgName(org.getName());
|
|
|
- }
|
|
|
+ req.setOrgCode(org.getCode());
|
|
|
+ req.setOrgId(org.getId());
|
|
|
+ req.setOrgName(org.getName());
|
|
|
req.setPhoneNumber(saved.getPhoneNumber());
|
|
|
req.setPhotoPath(saved.getPhotoPath());
|
|
|
req.setRootOrgId(saved.getRootOrgId());
|
|
@@ -192,12 +194,13 @@ public class StudentServiceImpl implements StudentService {
|
|
|
*
|
|
|
* @author WANGWEI
|
|
|
*
|
|
|
- * @see cn.com.qmth.examcloud.core.basic.service.StudentService#getStudentInfo(
|
|
|
+ * @see
|
|
|
+ * cn.com.qmth.examcloud.core.basic.service.StudentService#getStudentInfo(
|
|
|
* java.lang.Long, java.lang.String, java.lang.String, java.lang.String)
|
|
|
*/
|
|
|
@Override
|
|
|
- public StudentInfo getStudentInfo(Long rootOrgId, Long studentId, String identityNumber, String studentCode,
|
|
|
- String securityPhone) {
|
|
|
+ public StudentInfo getStudentInfo(Long rootOrgId, Long studentId, String identityNumber,
|
|
|
+ String studentCode, String securityPhone) {
|
|
|
|
|
|
if (null == rootOrgId) {
|
|
|
throw new StatusException("B-160250", "rootOrgId is null");
|
|
@@ -223,7 +226,8 @@ public class StudentServiceImpl implements StudentService {
|
|
|
}
|
|
|
|
|
|
if (count > 1) {
|
|
|
- throw new StatusException("B-160210", "参数过多,只需要[studentId,identityNumber,studentCode,securityPhone]中的一个");
|
|
|
+ throw new StatusException("B-160210",
|
|
|
+ "参数过多,只需要[studentId,identityNumber,studentCode,securityPhone]中的一个");
|
|
|
}
|
|
|
|
|
|
if (null == s) {
|