ting.yin 8 жил өмнө
parent
commit
8932d1c212

+ 5 - 3
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/StudentService.java

@@ -152,7 +152,7 @@ public class StudentService {
                                    String password, LoginType loginType) {
                                    String password, LoginType loginType) {
         Org org = orgRepo.findByParentIdAndCode((long) 0, orgId);
         Org org = orgRepo.findByParentIdAndCode((long) 0, orgId);
         if (org == null) {
         if (org == null) {
-            return new ResponseEntity(new ErrorMsg("学校不存在"), HttpStatus.NOT_FOUND);
+        	new RuntimeException("学校不存在");
         }
         }
         Student student = null;
         Student student = null;
         if (LoginType.STUDENT_CODE.equals(loginType)) {
         if (LoginType.STUDENT_CODE.equals(loginType)) {
@@ -169,9 +169,11 @@ public class StudentService {
 
 
     private ResponseEntity<?> loginProcess(Student student, String password) {
     private ResponseEntity<?> loginProcess(Student student, String password) {
         if (student.getUser() == null) {
         if (student.getUser() == null) {
-            return new ResponseEntity(new ErrorMsg("该用户不存在"), HttpStatus.NOT_FOUND);
+        	new RuntimeException("该用户不存在");
+        	return null;
         } else if (!student.getUser().getPassword().equals(password)) {
         } else if (!student.getUser().getPassword().equals(password)) {
-            return new ResponseEntity(new ErrorMsg("密码错误"), HttpStatus.EXPECTATION_FAILED);
+        	new RuntimeException("密码错误");
+        	return null;
         } else {
         } else {
             String token = AccessCtrlUtil.buildToken();
             String token = AccessCtrlUtil.buildToken();
             userService.createAccessUser(token, student.getUser(), student.getId());
             userService.createAccessUser(token, student.getUser(), student.getId());

+ 6 - 5
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/UserService.java

@@ -1,5 +1,7 @@
 package cn.com.qmth.examcloud.service.core.service;
 package cn.com.qmth.examcloud.service.core.service;
 
 
+import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
+
 import java.util.Date;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Map;
@@ -18,7 +20,6 @@ import org.springframework.stereotype.Service;
 
 
 import cn.com.qmth.examcloud.common.uac.AccessCtrlUtil;
 import cn.com.qmth.examcloud.common.uac.AccessCtrlUtil;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-import cn.com.qmth.examcloud.common.util.ErrorMsg;
 import cn.com.qmth.examcloud.common.util.RedisUtil;
 import cn.com.qmth.examcloud.common.util.RedisUtil;
 import cn.com.qmth.examcloud.service.core.dto.UserInfo;
 import cn.com.qmth.examcloud.service.core.dto.UserInfo;
 import cn.com.qmth.examcloud.service.core.entity.Org;
 import cn.com.qmth.examcloud.service.core.entity.Org;
@@ -32,8 +33,6 @@ 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;
 import cn.com.qmth.examcloud.service.core.repo.UserRoleRepo;
 import cn.com.qmth.examcloud.service.core.repo.UserRoleRepo;
 
 
-import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
-
 /**
 /**
  * 用户服务类
  * 用户服务类
  * Created by songyue on 17/1/13.
  * Created by songyue on 17/1/13.
@@ -119,9 +118,11 @@ public class UserService {
     public ResponseEntity loginProcess(User user,
     public ResponseEntity loginProcess(User user,
                                        String password){
                                        String password){
         if(user == null){
         if(user == null){
-            return new ResponseEntity(new ErrorMsg("该用户不存在"),HttpStatus.NOT_FOUND);
+        	new RuntimeException("该用户不存在");
+            return null;
         }else if(!user.getPassword().equals(password)){
         }else if(!user.getPassword().equals(password)){
-            return new ResponseEntity(new ErrorMsg("密码错误"),HttpStatus.EXPECTATION_FAILED);
+        	new RuntimeException("密码错误");
+            return null;
         }else{
         }else{
             String token = AccessCtrlUtil.buildToken();
             String token = AccessCtrlUtil.buildToken();
             createAccessUser(token,user,null);
             createAccessUser(token,user,null);