|
@@ -4,6 +4,7 @@ import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.constants.LogConstants;
|
|
|
import api.common.pojo.param.system.UserParam;
|
|
|
import api.common.pojo.po.system.UserPO;
|
|
|
+import api.common.pojo.vo.system.ParameterVO;
|
|
|
import api.common.pojo.vo.system.UserVO;
|
|
|
import api.common.util.EncryptUtil;
|
|
|
import api.common.util.ObjectUtil;
|
|
@@ -38,6 +39,9 @@ public class UserService {
|
|
|
@Autowired
|
|
|
DictService dictService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ParameterService parameterService;
|
|
|
+
|
|
|
public UserVO getCurrentUserInfo() {
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
UserVO userVO = userMapper.getUserInfo(userId);
|
|
@@ -83,6 +87,17 @@ public class UserService {
|
|
|
}else if(DictConstants.ROLE_CODE_ADMIN.equals(currentUserRoleCode)){//子管理员
|
|
|
userPO.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
|
}else if(DictConstants.ROLE_CODE_UESR.equals(currentUserRoleCode)){//普通用户
|
|
|
+ //新增参数校验
|
|
|
+ if(ObjectUtil.isNull(userPO.getId())){
|
|
|
+ ParameterVO parameter = parameterService.getParameterByUserId();
|
|
|
+ int num = parameter.getNumCreateUser();//最大用户数
|
|
|
+ String userId = AuthUtil.getCurrentUserId();
|
|
|
+ int subUserNum = userMapper.getSubUserNum(userId);
|
|
|
+ if(subUserNum >= num ){
|
|
|
+ userPO.setId("subUserNum");
|
|
|
+ return userPO;
|
|
|
+ }
|
|
|
+ }
|
|
|
userPO.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
|
//普通用户创建子账户时,占用类型继承
|
|
|
userPO.setUseType(AuthUtil.getCurrentUseType());
|
|
@@ -92,7 +107,7 @@ public class UserService {
|
|
|
//重名校验
|
|
|
List<UserPO> list = userMapper.checkUsername(userPO);
|
|
|
if(ObjectUtil.isNotNull(list)){
|
|
|
- userPO.setId(null);
|
|
|
+ userPO.setId("checkUsername");
|
|
|
return userPO;
|
|
|
}
|
|
|
PoUtil.initAddPo(userPO);
|