|
|
|
@ -13,11 +13,13 @@ import com.cloud.kicc.common.core.api.R;
@@ -13,11 +13,13 @@ import com.cloud.kicc.common.core.api.R;
|
|
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
|
import com.cloud.kicc.common.core.exception.CheckedException; |
|
|
|
|
import com.cloud.kicc.common.data.entity.KiccUser; |
|
|
|
|
import com.cloud.kicc.common.data.entity.SsoUser; |
|
|
|
|
import com.cloud.kicc.common.log.annotation.SysLog; |
|
|
|
|
import com.cloud.kicc.common.security.annotation.Inner; |
|
|
|
|
import com.cloud.kicc.common.security.util.SecurityUtils; |
|
|
|
|
import com.cloud.kicc.commonbiz.api.feign.RemotePushConcernFanService; |
|
|
|
|
import com.cloud.kicc.system.api.entity.*; |
|
|
|
|
import com.cloud.kicc.system.api.enums.IdentityProviderEnum; |
|
|
|
|
import com.cloud.kicc.system.api.enums.UserTypeEnum; |
|
|
|
|
import com.cloud.kicc.system.api.vo.ResultVo; |
|
|
|
|
import com.cloud.kicc.system.service.*; |
|
|
|
@ -27,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
@@ -27,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.SneakyThrows; |
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
@ -114,6 +117,8 @@ public class UserController {
@@ -114,6 +117,8 @@ public class UserController {
|
|
|
|
|
@GetMapping("/oneClickAccess/{casUserId:\\w+}") |
|
|
|
|
public R oneClickAccess(@PathVariable String casUserId) { |
|
|
|
|
if (ObjectUtil.isNotEmpty(iSsoUserService.getById(casUserId)) && ObjectUtil.isEmpty(userService.getOne(Wrappers.<User>lambdaQuery().eq(User::getCasUserId, casUserId)))) { |
|
|
|
|
SsoUser kicsSsoUser = iSsoUserService.getKicsSsoUser(casUserId); |
|
|
|
|
Optional.ofNullable(kicsSsoUser).orElseThrow(() -> new CheckedException("当前casUserId无效请重新检查配置!")); |
|
|
|
|
String initDeptId = configService.getValueByKey("app.init.deptId"); |
|
|
|
|
Dept dept = deptService.getById(initDeptId); |
|
|
|
|
Optional.ofNullable(dept).orElseThrow(() -> new CheckedException("当前部门无效请重新在参数管理中配置!")); |
|
|
|
@ -123,6 +128,21 @@ public class UserController {
@@ -123,6 +128,21 @@ public class UserController {
|
|
|
|
|
String initUserType = configService.getValueByKey("app.init.normal.userType"); |
|
|
|
|
String initTenantId = configService.getValueByKey("app.init.tenantId"); |
|
|
|
|
String initRoleIds = configService.getValueByKey("app.init.roleIds"); |
|
|
|
|
String initPassword = configService.getValueByKey("appid.password"); |
|
|
|
|
|
|
|
|
|
// 修改扩展用户信息
|
|
|
|
|
SsoUser ssoUser = new SsoUser(); |
|
|
|
|
ssoUser.setUserName(kicsSsoUser.getUserName()); |
|
|
|
|
ssoUser.setNickName(kicsSsoUser.getNickName()); |
|
|
|
|
ssoUser.setPassword(new BCryptPasswordEncoder().encode(initPassword)); |
|
|
|
|
ssoUser.setEmail(kicsSsoUser.getEmail()); |
|
|
|
|
ssoUser.setPhone(kicsSsoUser.getPhone()); |
|
|
|
|
ssoUser.setIdentityProvider(IdentityProviderEnum.CUSTOMER.getValue()); |
|
|
|
|
ssoUser.setAvatar(kiccUser.getAvatar()); |
|
|
|
|
ssoUser.setTenantId(initTenantId); |
|
|
|
|
ssoUser.setCreateById(kiccUser.getUsername()); |
|
|
|
|
ssoUser.setCreateByName(kiccUser.getId()); |
|
|
|
|
iSsoUserService.save(ssoUser); |
|
|
|
|
|
|
|
|
|
User user = new User(); |
|
|
|
|
user.setCasUserId(casUserId); |
|
|
|
|