Ver Fonte

优化登录退出性能

宋悦 há 7 anos atrás
pai
commit
b5b9339baf

+ 1 - 1
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/StudentFaceInfoApi.java

@@ -62,7 +62,7 @@ public class StudentFaceInfoApi {
     @ApiOperation(value = "按学号查询", notes = "查询")
     @GetMapping("/studentCode")
     public ResponseEntity findByStudentCode(@RequestParam Long orgId, @RequestParam String studentCode) {
-        Student student = studentRepo.findByUserRootOrgIdAndStudentCode(orgId, studentCode);
+        Student student = studentRepo.findByStudentCodeAndRootOrgId(studentCode,orgId);
         if (student == null) {
             return new ResponseEntity(new ErrorMsg("该学生不存在"), HttpStatus.OK);
         }

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

@@ -98,7 +98,7 @@ public class StudentService {
                 }
                 String fileName = file.getName().split(JPG)[0];
                 //先查学号
-                Student student = studentRepo.findByUserRootOrgIdAndStudentCode(rootOrgId, fileName);
+                Student student = studentRepo.findByStudentCodeAndRootOrgId(fileName, rootOrgId);
                 if (student == null) {//学号不存在查身份证号
                     student = studentRepo.findByIdentityNumber(fileName);
                 }
@@ -185,9 +185,8 @@ public class StudentService {
         }
         Student student = null;
         if (LoginType.STUDENT_CODE.equals(loginType)) {
-            student = studentRepo.findByUserRootOrgIdAndStudentCode(org.getId(), loginName);
-        }
-        if (LoginType.IDENTITY_NUMBER.equals(loginType)) {
+            student = studentRepo.findByStudentCodeAndRootOrgId(loginName, org.getId());
+        }else if (LoginType.IDENTITY_NUMBER.equals(loginType)) {
             student = studentRepo.findByIdentityNumberAndRootOrgId(loginName, org.getId());
         }
         if (student == null) {

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

@@ -265,7 +265,6 @@ public class UserService {
         }else{
             String token = AccessCtrlUtil.buildToken();
             initUserLogin(user);
-            createUserOpsLog(user,"登录");
             createAccessUser(token,user,null);
             createUserLogin(token,user);
             return getUserInfo(user,token);
@@ -385,10 +384,6 @@ public class UserService {
 	public void logout(AccessUser accessUser) {
         accessUserOps.delete(accessUser.getToken());
         userLoginRepo.deleteByUserId(accessUser.getUserId());
-        User user = new User();
-        user.setId(accessUser.getUserId());
-        user.setName(accessUser.getName());
-        createUserOpsLog(user,"退出");
 	}
 
 	public List<User> getMarker(Long rootOrgId) {

+ 1 - 1
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/repo/StudentRepo.java

@@ -16,7 +16,7 @@ public interface StudentRepo extends JpaRepository<Student,Long>,QueryByExampleE
 
 	Student findByIdentityNumberAndRootOrgId(String identityNumber,Long rootOrgId);
 
-	Student findByUserRootOrgIdAndStudentCode(Long rootOrgId, String studentCode);
+	Student findByStudentCodeAndRootOrgId(String studentCode,Long rootOrgId);
 
 	Student findByRootOrgIdAndStudentCode(Long rootOrgId, String studentCode);
 }