| | |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tenant.BladeTenantProperties; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | //拿到配置的超管id |
| | | @Value("${user-info.id}") |
| | | private String adminUserId; |
| | | |
| | | @Value("${user-info.tenant-id}") |
| | | private String tenantId; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean submit(User user) { |
| | | if (StringUtil.isBlank(user.getTenantId())) { |
| | | user.setTenantId(BladeConstant.ADMIN_TENANT_ID); |
| | | // user.setTenantId(BladeConstant.ADMIN_TENANT_ID); |
| | | // 默认设置为管理组下的用户 |
| | | user.setTenantId(this.tenantId); |
| | | } |
| | | String tenantId = user.getTenantId(); |
| | | //Tenant tenant = SysCache.getTenant(tenantId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<User> selectAllUser(User user, Long deptId){ |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | List<User> users = baseMapper.selectUserPage(user, deptIdList, (AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : AuthUtil.getTenantId())); |
| | | return users; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<UserVO> selectUserSearch(UserVO user, Query query) { |
| | | LambdaQueryWrapper<User> queryWrapper = Wrappers.<User>query().lambda(); |
| | | String tenantId = AuthUtil.getTenantId(); |
| | |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account) { |
| | | User user = baseMapper.getUser(tenantId, account); |
| | | User user = baseMapper.getUser(tenantId, account,null); |
| | | return buildUserInfo(user); |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account,String name) { |
| | | User user = baseMapper.getUser(tenantId, account,name); |
| | | UserInfo userInfo = buildUserInfo(user); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account, UserEnum userEnum) { |
| | | User user = baseMapper.getUser(tenantId, account); |
| | | User user = baseMapper.getUser(tenantId, account,null); |
| | | return buildUserInfo(user, userEnum); |
| | | } |
| | | |
| | |
| | | } |
| | | //获取用户采用的密码策略 |
| | | Strategy strategy = sysClient.getByUserId(userId).getData(); |
| | | // 几乎不会出现这种情况 |
| | | if(ObjectUtil.isEmpty(strategy)) { |
| | | throw new ServiceException("当前用户未应用密码策略!"); |
| | | } |
| | |
| | | if(reqType>=strategy.getRequiredType()){ |
| | | break; |
| | | } |
| | | if(!Func.isEmpty(RegexUtil.findResult(regexs.get(i),newPassword1))){ |
| | | if(RegexUtil.find(regexs.get(i),newPassword1)){ |
| | | reqType++; |
| | | } |
| | | } |
| | |
| | | if(reqType<strategy.getRequiredType()){ |
| | | throw new ServiceException(resException); |
| | | } |
| | | // 是否属于组合方式中的类型 |
| | | // 是否属于组合方式中的类型,以前是密码必须是包含在组合方式中的类型 |
| | | String regex = sysClient.getRegex(Arrays.asList(strategy.getCombinationIds().split(","))).getData(); |
| | | regex = "^"+regex+"{"+strategy.getRequiredType()+",}$"; |
| | | boolean result = RegexUtil.find(regex, newPassword1); |
| | | if(!result){ |
| | | throw new ServiceException("密码中只能存在【"+strategy.getCombinationNames()+"】中包含的字符!"); |
| | | //throw new ServiceException(resException); |
| | | } |
| | | //修改密码同时,改变用户信息中的密码修改状态字段,密码修改时间 |
| | |
| | | boolean oauthTemp = userOauthService.updateById(userOauth); |
| | | return (userTemp && oauthTemp); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updatePlatform(Long userId, Integer userType, String userExt) { |
| | | if (userType.equals(UserEnum.WEB.getCategory())) { |
| | |
| | | return this.update(Wrappers.<User>lambdaUpdate().in(User::getId, userIds).set(User::getStrategyUpdateStatus,CommonConstant.IS_DEFAULT)); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserVO> getByRoleUserList(BladeUser user, String roleName) { |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 时间格式转天 |
| | | * 日期时间格式转天 |
| | | * @param date |
| | | * @return |
| | | */ |