|
@@ -107,6 +107,10 @@ public class AuthServiceImpl implements AuthService {
|
|
|
if (AccountType.COMMON_LOGIN_NAME.getCode().equals(accountType)) {
|
|
|
user.setUserType(UserType.COMMON.getCode());
|
|
|
userEntity = userService.getUser(Long.parseLong(rootOrgId), accountValue);
|
|
|
+ if (null == userEntity) {
|
|
|
+ throw new StatusException("B-001004", "用户不存在");
|
|
|
+ }
|
|
|
+ user.setDisplayName(userEntity.getLoginName());
|
|
|
} else {
|
|
|
// 学生学号登录
|
|
|
if (AccountType.STUDENT_CODE.getCode().equals(accountType)) {
|
|
@@ -121,30 +125,31 @@ public class AuthServiceImpl implements AuthService {
|
|
|
if (null == student) {
|
|
|
throw new StatusException("B-001110", "学生不存在");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
user.setUserType(UserType.STUDENT.getCode());
|
|
|
user.setStudentId(student.getId());
|
|
|
user.setStudentCode(student.getStudentCode());
|
|
|
user.setIdentityNumber(student.getIdentityNumber());
|
|
|
|
|
|
userEntity = userRepo.findOne(student.getUser().getId());
|
|
|
+ if (null == userEntity) {
|
|
|
+ throw new StatusException("B-001004", "用户不存在");
|
|
|
+ }
|
|
|
+ user.setDisplayName(userEntity.getName());
|
|
|
List<UserRole> roleList = Lists.newArrayList();
|
|
|
UserRole userRole = new UserRole();
|
|
|
userRole.setRoleCode(RoleMeta.STUDENT.name());
|
|
|
roleList.add(userRole);
|
|
|
userEntity.setUserRoles(roleList);
|
|
|
}
|
|
|
-
|
|
|
- if (null == userEntity) {
|
|
|
- throw new StatusException("B-001004", "用户不存在");
|
|
|
- }
|
|
|
+
|
|
|
String rightPassword = userEntity.getPassword();
|
|
|
if (!rightPassword.equals(password)) {
|
|
|
throw new StatusException("B-001003", "密码错误");
|
|
|
}
|
|
|
|
|
|
user.setUserId(userEntity.getId());
|
|
|
- user.setDisplayName(userEntity.getLoginName());
|
|
|
+
|
|
|
user.setRootOrgId(userEntity.getRootOrgId());
|
|
|
user.setRootOrgName(rootOrg.getName());
|
|
|
user.setOrgId(userEntity.getOrgId());
|