| | |
| | | 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; |
| | |
| | | import org.springframework.util.DigestUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static com.vci.ubcs.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD; |
| | | |
| | |
| | | if (ObjectUtil.isEmpty(user)) { |
| | | return null; |
| | | } |
| | | user.setDeptName(Func.join(SysCache.getDeptNames(user.getDeptId()))); |
| | | UserInfo userInfo = new UserInfo(); |
| | | userInfo.setUser(user); |
| | | if (Func.isNotEmpty(user)) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 时间格式转天 |
| | | * 获取到指定身份权限的用户列表 |
| | | * @param user 用户查询的用户信息,如租户信息,通常为自动注入,前端可选择不传 |
| | | * @param roleName 要查询的角色身份 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String,String>> getByRoleUserList(BladeUser user, String roleName) { |
| | | // 考虑到一个用户可以拥有多种角色权限,而用户关联角色权限是用role_id字段用逗号分隔角色id的,直接采用子查询来in查询不能实现,所以先查询角色id |
| | | R<String> roleIds = sysClient.getRoleIds(user.getTenantId(), roleName); |
| | | if(roleIds.getCode() != 200){ |
| | | throw new ServiceException("系统服务feign接口调用错误!"); |
| | | } |
| | | if(Func.isBlank(roleIds.getData())){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Map<String,String>> list = new ArrayList<>(); |
| | | Arrays.stream(roleIds.getData().split(",")).forEach(item->{ |
| | | list.addAll(this.baseMapper.getUserMap(item,user.getUserId().toString())); |
| | | }); |
| | | // 去除重复 |
| | | return list.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 日期时间格式转天 |
| | | * @param date |
| | | * @return |
| | | */ |