|
@@ -20,6 +20,7 @@ import com.qmth.boot.tools.uuid.FastUUID;
|
|
|
|
|
|
import cn.com.qmth.mps.bean.User;
|
|
import cn.com.qmth.mps.bean.User;
|
|
import cn.com.qmth.mps.config.SysProperty;
|
|
import cn.com.qmth.mps.config.SysProperty;
|
|
|
|
+import cn.com.qmth.mps.entity.SchoolEntity;
|
|
import cn.com.qmth.mps.entity.UserEntity;
|
|
import cn.com.qmth.mps.entity.UserEntity;
|
|
import cn.com.qmth.mps.entity.WxappAccessTokenEntity;
|
|
import cn.com.qmth.mps.entity.WxappAccessTokenEntity;
|
|
import cn.com.qmth.mps.entity.WxappInfoEntity;
|
|
import cn.com.qmth.mps.entity.WxappInfoEntity;
|
|
@@ -72,6 +73,10 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
throw new StatusException("该用户不是科组长");
|
|
throw new StatusException("该用户不是科组长");
|
|
}
|
|
}
|
|
|
|
+ SchoolEntity school=schoolService.getById(userEntity.getSchoolId());
|
|
|
|
+ if (!school.getEnable()) {
|
|
|
|
+ throw new StatusException("该学校已禁用");
|
|
|
|
+ }
|
|
User user = new User();
|
|
User user = new User();
|
|
user.setName(userEntity.getName());
|
|
user.setName(userEntity.getName());
|
|
user.setSchoolId(userEntity.getSchoolId());
|
|
user.setSchoolId(userEntity.getSchoolId());
|
|
@@ -86,7 +91,7 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setRole(user.getRole());
|
|
vo.setRole(user.getRole());
|
|
- vo.setSchoolName(schoolService.getById(user.getSchoolId()).getName());
|
|
|
|
|
|
+ vo.setSchoolName(school.getName());
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -102,6 +107,10 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
if (userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
if (userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
throw new StatusException("科组长无权限登录");
|
|
throw new StatusException("科组长无权限登录");
|
|
}
|
|
}
|
|
|
|
+ SchoolEntity school=schoolService.getById(userEntity.getSchoolId());
|
|
|
|
+ if (!school.getEnable()) {
|
|
|
|
+ throw new StatusException("该学校已禁用");
|
|
|
|
+ }
|
|
byte[] bytes = SHA256.encode(password);
|
|
byte[] bytes = SHA256.encode(password);
|
|
String encodePassword = ByteUtil.toHexAscii(bytes);
|
|
String encodePassword = ByteUtil.toHexAscii(bytes);
|
|
if (!encodePassword.equals(userEntity.getPassword())) {
|
|
if (!encodePassword.equals(userEntity.getPassword())) {
|
|
@@ -121,7 +130,7 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setRole(user.getRole());
|
|
vo.setRole(user.getRole());
|
|
- vo.setSchoolName(schoolService.getById(user.getSchoolId()).getName());
|
|
|
|
|
|
+ vo.setSchoolName(school.getName());
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -186,6 +195,10 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
throw new StatusException("该用户不是科组长");
|
|
throw new StatusException("该用户不是科组长");
|
|
}
|
|
}
|
|
|
|
+ SchoolEntity school=schoolService.getById(userEntity.getSchoolId());
|
|
|
|
+ if (!school.getEnable()) {
|
|
|
|
+ throw new StatusException("该学校已禁用");
|
|
|
|
+ }
|
|
WxappInfoEntity wi=wxappInfoService.getByOpenId(openid);
|
|
WxappInfoEntity wi=wxappInfoService.getByOpenId(openid);
|
|
if(wi==null) {
|
|
if(wi==null) {
|
|
wi=new WxappInfoEntity();
|
|
wi=new WxappInfoEntity();
|
|
@@ -207,7 +220,7 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setRole(user.getRole());
|
|
vo.setRole(user.getRole());
|
|
- vo.setSchoolName(schoolService.getById(user.getSchoolId()).getName());
|
|
|
|
|
|
+ vo.setSchoolName(school.getName());
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -288,6 +301,10 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
if (!userEntity.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
throw new StatusException("该用户不是科组长");
|
|
throw new StatusException("该用户不是科组长");
|
|
}
|
|
}
|
|
|
|
+ SchoolEntity school=schoolService.getById(userEntity.getSchoolId());
|
|
|
|
+ if (!school.getEnable()) {
|
|
|
|
+ throw new StatusException("该学校已禁用");
|
|
|
|
+ }
|
|
JSONObject auth=getAuthorization(loginCode);
|
|
JSONObject auth=getAuthorization(loginCode);
|
|
String openid=ByteUtil.toHexAscii(SHA256.encode(auth.getString("openid")));
|
|
String openid=ByteUtil.toHexAscii(SHA256.encode(auth.getString("openid")));
|
|
WxappInfoEntity wi=wxappInfoService.getByOpenId(openid);
|
|
WxappInfoEntity wi=wxappInfoService.getByOpenId(openid);
|
|
@@ -311,7 +328,7 @@ public class AuthServiceImpl implements AuthorizationService<User>, AuthService
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSessionId(user.getSessionId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setSchoolId(user.getSchoolId());
|
|
vo.setRole(user.getRole());
|
|
vo.setRole(user.getRole());
|
|
- vo.setSchoolName(schoolService.getById(user.getSchoolId()).getName());
|
|
|
|
|
|
+ vo.setSchoolName(school.getName());
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
}
|
|
}
|