| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Validator; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.domain.SysUserPost; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserMapper userMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysPostMapper postMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserPostMapper userPostMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | protected Validator validator; |
| | | |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber) { |
| | | return this.baseMapper.getList(pageInfo,phonenumber); |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, GetSysUserList getSysUserList) { |
| | | List<SysUser> list = this.baseMapper.getList(pageInfo, getSysUserList); |
| | | for (SysUser sysUser : list) { |
| | | List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId())); |
| | | List<Integer> data1 = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | for (SysUserRole sysUserRole : list1) { |
| | | List<Integer> data = roleSiteClient.getSiteIds(sysUserRole.getRoleId()).getData(); |
| | | data1.addAll(data); |
| | | } |
| | | Set<Integer> siteIds = new HashSet<>(data1); |
| | | List<Site> data = siteClient.getSiteByIds(siteIds.stream().collect(Collectors.toList())).getData(); |
| | | List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); |
| | | sysUser.setSiteNames(siteNames); |
| | | |
| | | Set<Long> collect = list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet()); |
| | | List<SysRole> sysRoles = roleMapper.selectBatchIds(collect); |
| | | List<String> roleNames = sysRoles.stream().map(SysRole::getRoleName).collect(Collectors.toList()); |
| | | sysUser.setRoleNames(roleNames); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | @Override |