Commit c161b251 by guojuxing

新建商户:新建超级管理员接口修改

parent 92c438f2
......@@ -60,6 +60,33 @@ public class UserApiServiceImpl implements UserApiService {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
//如果是普通管理员,则需要验证角色权限和资源权限
if (userDTO.getSuperAdmin().intValue() == 0) {
if (StringUtils.isBlank(userDTO.getUserRoleIds())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "角色权限不能为空");
}
if (StringUtils.isBlank(userDTO.getUserResourceIds())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "资源权限不能为空");
}
}
if (userDTO.getSuperAdmin() == null) {
//默认是普通管理员
userDTO.setSuperAdmin(0);
}
if (userDTO.getSuperAdmin().intValue() == 1) {
//超级官员
TabSysUser adminUser = userService.getUserByEnterpriseId(userDTO.getEnterpriseId());
if (adminUser != null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已存在超级管理员,重复创建");
}
}
if (userDTO.getPasswordType() == null) {
//默认自定义创建密码类型
userDTO.setPasswordType(2);
}
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("86");
}
......@@ -97,6 +124,15 @@ public class UserApiServiceImpl implements UserApiService {
if (userService.isPhoneRepeat(userDTO.getUserId(), userDTO.getPhoneNumber())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
if (userDTO.getSuperAdmin() != null && userDTO.getSuperAdmin().intValue() == 1) {
//超级官员
TabSysUser adminUser = userService.getUserByEnterpriseId(userDTO.getEnterpriseId());
if (adminUser != null && adminUser.getUserId().intValue() != tabUser.getUserId().intValue()) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已存在超级管理员,参数有误");
}
}
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("86");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment