|
@@ -10,16 +10,19 @@ import org.springframework.data.domain.Example;
|
|
import org.springframework.data.domain.ExampleMatcher;
|
|
import org.springframework.data.domain.ExampleMatcher;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.entity.Org;
|
|
import cn.com.qmth.examcloud.service.core.entity.Student;
|
|
import cn.com.qmth.examcloud.service.core.entity.Student;
|
|
import cn.com.qmth.examcloud.service.core.entity.User;
|
|
import cn.com.qmth.examcloud.service.core.entity.User;
|
|
import cn.com.qmth.examcloud.service.core.enums.LoginType;
|
|
import cn.com.qmth.examcloud.service.core.enums.LoginType;
|
|
import cn.com.qmth.examcloud.service.core.enums.UserScope;
|
|
import cn.com.qmth.examcloud.service.core.enums.UserScope;
|
|
import cn.com.qmth.examcloud.service.core.enums.UserType;
|
|
import cn.com.qmth.examcloud.service.core.enums.UserType;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.repo.OrgRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.StudentRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.StudentRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.UserRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.UserRepo;
|
|
|
|
|
|
@@ -36,6 +39,8 @@ public class StudentService {
|
|
UserRepo userRepo;
|
|
UserRepo userRepo;
|
|
@Autowired
|
|
@Autowired
|
|
UserService userService;
|
|
UserService userService;
|
|
|
|
+ @Autowired
|
|
|
|
+ OrgRepo orgRepo;
|
|
|
|
|
|
private static final String JPG = ".jpg";
|
|
private static final String JPG = ".jpg";
|
|
|
|
|
|
@@ -129,11 +134,15 @@ public class StudentService {
|
|
* @param password
|
|
* @param password
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public ResponseEntity<?> login(long orgId,String loginName,
|
|
|
|
|
|
+ public ResponseEntity<?> login(String orgId,String loginName,
|
|
String password,LoginType loginType){
|
|
String password,LoginType loginType){
|
|
|
|
+ Org org = orgRepo.findByParentIdAndCode((long)0, orgId);
|
|
|
|
+ if(org == null){
|
|
|
|
+ return new ResponseEntity(new ErrorMsg("学校不存在"),HttpStatus.NOT_FOUND);
|
|
|
|
+ }
|
|
Student student = null;
|
|
Student student = null;
|
|
if(LoginType.STUDENT_CODE.equals(loginType)){
|
|
if(LoginType.STUDENT_CODE.equals(loginType)){
|
|
- student = studentRepo.findByUserRootOrgIdAndStudentCode(orgId, loginName);
|
|
|
|
|
|
+ student = studentRepo.findByUserRootOrgIdAndStudentCode(org.getId(), loginName);
|
|
}
|
|
}
|
|
if(LoginType.IDENTITY_NUMBER.equals(loginType)){
|
|
if(LoginType.IDENTITY_NUMBER.equals(loginType)){
|
|
student = studentRepo.findByIdentityNumber(loginName);
|
|
student = studentRepo.findByIdentityNumber(loginName);
|