|
|
|
@ -11,6 +11,7 @@ import com.cloud.kicc.common.core.constant.CacheConstants;
@@ -11,6 +11,7 @@ import com.cloud.kicc.common.core.constant.CacheConstants;
|
|
|
|
|
import com.cloud.kicc.common.core.constant.SecurityConstants; |
|
|
|
|
import com.cloud.kicc.common.core.exception.CheckedException; |
|
|
|
|
import com.cloud.kicc.common.core.exception.ValidateCodeException; |
|
|
|
|
import com.cloud.kicc.common.data.entity.KiccUser; |
|
|
|
|
import com.cloud.kicc.common.data.entity.SsoUser; |
|
|
|
|
import com.cloud.kicc.system.api.entity.Dept; |
|
|
|
|
import com.cloud.kicc.system.api.entity.User; |
|
|
|
@ -86,11 +87,15 @@ public class AppServiceImpl implements AppService {
@@ -86,11 +87,15 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
String initDeptId = configService.getValueByKey("app.init.deptId"); |
|
|
|
|
Dept dept = deptService.getById(initDeptId); |
|
|
|
|
Optional.ofNullable(dept).orElseThrow(() -> new CheckedException("当前部门无效请重新在参数管理中配置!")); |
|
|
|
|
String execAdminUserId = configService.getValueByKey("app.exec.admin.userId"); |
|
|
|
|
KiccUser kiccUser = userService.getUserById(execAdminUserId); |
|
|
|
|
Optional.ofNullable(kiccUser).orElseThrow(() -> new CheckedException("当前系统管理执行用户无效请重新在参数管理中配置!")); |
|
|
|
|
String initUserType = configService.getValueByKey("app.init.deptId"); |
|
|
|
|
String initTenantId = configService.getValueByKey("app.init.tenantId"); |
|
|
|
|
String initRoleIds = configService.getValueByKey("app.init.roleIds"); |
|
|
|
|
String initPassword = configService.getValueByKey("appid.password"); |
|
|
|
|
|
|
|
|
|
// 用户已注册直接返回进行登陆
|
|
|
|
|
List<SsoUser> findSsoUser = iSsoUserService.list(Wrappers.<SsoUser>lambdaQuery() |
|
|
|
|
.eq(SsoUser::getPhone, phone) |
|
|
|
|
.eq(SsoUser::getTenantId, initTenantId) |
|
|
|
@ -107,6 +112,8 @@ public class AppServiceImpl implements AppService {
@@ -107,6 +112,8 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
ssoUser.setPhone(phone); |
|
|
|
|
ssoUser.setIdentityProvider(identityProvider); |
|
|
|
|
ssoUser.setTenantId(initTenantId); |
|
|
|
|
ssoUser.setCreateById(kiccUser.getUsername()); |
|
|
|
|
ssoUser.setCreateByName(kiccUser.getId()); |
|
|
|
|
iSsoUserService.save(ssoUser); |
|
|
|
|
|
|
|
|
|
User user = new User(); |
|
|
|
@ -115,6 +122,8 @@ public class AppServiceImpl implements AppService {
@@ -115,6 +122,8 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
user.setDeptName(dept.getName()); |
|
|
|
|
user.setUserType(initUserType); |
|
|
|
|
user.setTenantId(initTenantId); |
|
|
|
|
user.setCreateById(kiccUser.getUsername()); |
|
|
|
|
user.setCreateByName(kiccUser.getId()); |
|
|
|
|
userService.save(user); |
|
|
|
|
|
|
|
|
|
// 处理角色授权
|
|
|
|
|