WANG 6 年之前
父节点
当前提交
8dbacd61cb

+ 19 - 0
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java

@@ -44,6 +44,7 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
 import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
 import cn.com.qmth.examcloud.core.basic.service.AuthService;
+import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
 import cn.com.qmth.examcloud.core.basic.service.UserService;
 import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
 
@@ -87,6 +88,9 @@ public class AuthServiceImpl implements AuthService {
 	@Autowired
 	PrivilegeRepo privilegeRepo;
 
+	@Autowired
+	SysConfigService sysConfigService;
+
 	@Override
 	public User login(LoginInfo loginInfo) {
 
@@ -111,6 +115,21 @@ public class AuthServiceImpl implements AuthService {
 			throw new StatusException("B-001204", "accountType is wrong");
 		}
 
+		// 系统级别登陆限制
+		if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)
+				|| AccountType.STUDENT_IDENTITY_NUMBER.equals(accountTypeEnum)
+				|| AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
+			Boolean stuClientLoginLimit = (Boolean) sysConfigService.get("STU_CLIENT_LOGIN_LIMIT");
+			if (stuClientLoginLimit) {
+				throw new StatusException("B-001505", "系统维护中... ...");
+			}
+		} else if (AccountType.COMMON_LOGIN_NAME.equals(accountTypeEnum)) {
+			Boolean commonLoginLimit = (Boolean) sysConfigService.get("COMMON_LOGIN_LIMIT");
+			if (commonLoginLimit) {
+				throw new StatusException("B-001506", "系统维护中... ...");
+			}
+		}
+
 		if (limited(accountTypeEnum, accountValue, clientIp)) {
 			throw new StatusException("B-001205", "密码重试次数已达到上限,请1分钟后重试");
 		}