|
@@ -4,7 +4,6 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.Date;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
import javax.transaction.Transactional;
|
|
@@ -19,16 +18,12 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
-import cn.com.qmth.examcloud.core.basic.base.enums.UserType;
|
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.constants.Consts;
|
|
import cn.com.qmth.examcloud.core.basic.dao.constants.Consts;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
|
|
|
|
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserRole;
|
|
|
|
-import cn.com.qmth.examcloud.core.basic.dao.enums.UserScope;
|
|
|
|
import cn.com.qmth.examcloud.core.basic.service.StudentService;
|
|
import cn.com.qmth.examcloud.core.basic.service.StudentService;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
|
|
|
|
@@ -165,13 +160,27 @@ public class StudentServiceImpl implements StudentService {
|
|
String identityNumber = studentInfo.getIdentityNumber();
|
|
String identityNumber = studentInfo.getIdentityNumber();
|
|
String studentCode = studentInfo.getStudentCode();
|
|
String studentCode = studentInfo.getStudentCode();
|
|
|
|
|
|
- Student student = studentRepo.findByIdentityNumberAndStudentCodeAndRootOrgId(identityNumber,
|
|
|
|
- studentCode, rootOrgId);
|
|
|
|
|
|
+ Student studentByIdentity = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
|
|
|
|
+ rootOrgId);
|
|
|
|
+
|
|
|
|
+ if (null != studentByIdentity) {
|
|
|
|
+ String curStudentCode = studentByIdentity.getStudentCode();
|
|
|
|
+ if (StringUtils.isNotBlank(curStudentCode) && !curStudentCode.equals(studentCode)) {
|
|
|
|
+ throw new StatusException("B-160005", "studentCode is wrong");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Student studentByCode = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
|
|
|
|
+ if (null != studentByCode) {
|
|
|
|
+ String curIdentityNumber = studentByCode.getIdentityNumber();
|
|
|
|
+ if (!curIdentityNumber.equals(identityNumber)) {
|
|
|
|
+ throw new StatusException("B-160005", "studentCode is wrong");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
Student updatedStudent = new Student();
|
|
Student updatedStudent = new Student();
|
|
- if (null != student) {
|
|
|
|
- updatedStudent.setId(student.getId());
|
|
|
|
- updatedStudent.setPassword(student.getPassword());
|
|
|
|
|
|
+ if (null != studentByIdentity) {
|
|
|
|
+ updatedStudent = studentByIdentity;
|
|
} else {
|
|
} else {
|
|
if (StringUtils.isNotEmpty(identityNumber)
|
|
if (StringUtils.isNotEmpty(identityNumber)
|
|
&& identityNumber.matches("[0-9a-zA-Z]{6,}")) {
|
|
&& identityNumber.matches("[0-9a-zA-Z]{6,}")) {
|