|
@@ -21,6 +21,7 @@ import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.StudentService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.service.UserService;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
|
import cn.com.qmth.examcloud.task.api.request.SyncStudentReq;
|
|
@@ -38,7 +39,7 @@ public class StudentServiceImpl implements StudentService {
|
|
|
UserRepo userRepo;
|
|
|
|
|
|
@Autowired
|
|
|
- UserServiceImpl userService;
|
|
|
+ UserService userService;
|
|
|
|
|
|
@Autowired
|
|
|
OrgRepo orgRepo;
|
|
@@ -107,12 +108,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);
|
|
|
}
|
|
|
|
|
@@ -133,7 +137,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);
|
|
|
}
|
|
@@ -194,12 +199,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");
|
|
@@ -225,7 +231,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) {
|