| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.vci.ubcs.system.cache.DictCache; |
| | | import com.vci.ubcs.system.cache.NacosConfigCache; |
| | | import com.vci.ubcs.system.cache.ParamCache; |
| | | import com.vci.ubcs.system.cache.SysCache; |
| | | import com.vci.ubcs.system.entity.Strategy; |
| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private final IUserOauthService userOauthService; |
| | | private final ISysClient sysClient; |
| | | private final BladeTenantProperties tenantProperties; |
| | | //拿到配置的超管id |
| | | @Value("${user-info.id}") |
| | | private String adminUserId; |
| | | @Value("${user-info.tenant-id}") |
| | | private String tenantId; |
| | | //拿到配置的超管 |
| | | private final NacosConfigCache nacosConfigCache; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | if (StringUtil.isBlank(user.getTenantId())) { |
| | | // user.setTenantId(BladeConstant.ADMIN_TENANT_ID); |
| | | // 默认设置为管理组下的用户 |
| | | user.setTenantId(this.tenantId); |
| | | user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId()); |
| | | } |
| | | String tenantId = user.getTenantId(); |
| | | //Tenant tenant = SysCache.getTenant(tenantId); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importUser(List<UserExcel> data, Boolean isCovered) { |
| | | ArrayList<User> addUsers = new ArrayList<>(); |
| | | data.forEach(userExcel -> { |
| | | User user = Objects.requireNonNull(BeanUtil.copy(userExcel, User.class)); |
| | | // 设置用户平台 |
| | |
| | | // 获取默认密码配置 |
| | | String initPassword = ParamCache.getValue(DEFAULT_PARAM_PASSWORD); |
| | | user.setPassword(initPassword); |
| | | this.submit(user); |
| | | addUsers.add(user); |
| | | //this.submit(user); |
| | | }); |
| | | this.submitList(addUsers); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public Long checkRenAndExpr(Long userId) { |
| | | //超级管理员直接返回不需要提醒密码修改 |
| | | if(adminUserId.equals(userId)){ |
| | | if(nacosConfigCache.getAdminUserInfo().getUserId().equals(userId)){ |
| | | return 0L; |
| | | } |
| | | QueryWrapper<User> wrapper = Wrappers.<User>query().eq("ID", userId); |