Search in sources :

Example 1 with SysUser

use of vip.mate.system.entity.SysUser in project matecloud by matevip.

the class SysUserServiceImpl method export.

@Override
public List<SysUserPOI> export() {
    LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.eq(SysUser::getIsDeleted, "0");
    List<SysUser> sysUsers = this.baseMapper.selectList(queryWrapper);
    return sysUsers.stream().map(sysUser -> {
        SysUserPOI sysUserPoi = new SysUserPOI();
        BeanUtils.copyProperties(sysUser, sysUserPoi);
        sysUserPoi.setDepartName(sysDepartService.getById(sysUser.getDepartId()).getName());
        sysUserPoi.setRoleName(sysRoleService.getById(sysUser.getRoleId()).getRoleName());
        sysUserPoi.setStatusName(dictService.getValue("status", sysUser.getStatus()).getData());
        return sysUserPoi;
    }).collect(Collectors.toList());
}
Also used : ISysUserService(vip.mate.system.service.ISysUserService) SysUser(vip.mate.system.entity.SysUser) BaseException(vip.mate.core.common.exception.BaseException) ISysDictService(vip.mate.system.service.ISysDictService) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) SysUserMapper(vip.mate.system.mapper.SysUserMapper) ISysDepartService(vip.mate.system.service.ISysDepartService) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Service(org.springframework.stereotype.Service) ISysRoleService(vip.mate.system.service.ISysRoleService) ServiceImpl(com.baomidou.mybatisplus.extension.service.impl.ServiceImpl) Wrappers(com.baomidou.mybatisplus.core.toolkit.Wrappers) Search(vip.mate.core.database.entity.Search) SysUserPOI(vip.mate.system.poi.SysUserPOI) Collection(java.util.Collection) PageUtil(vip.mate.core.database.util.PageUtil) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) StrUtil(cn.hutool.core.util.StrUtil) List(java.util.List) AllArgsConstructor(lombok.AllArgsConstructor) IPage(com.baomidou.mybatisplus.core.metadata.IPage) SystemConstant(vip.mate.core.common.constant.SystemConstant) BeanUtils(org.springframework.beans.BeanUtils) OrderTypeEnum(vip.mate.core.database.enums.OrderTypeEnum) CollectionUtil(vip.mate.core.web.util.CollectionUtil) SysUserPOI(vip.mate.system.poi.SysUserPOI) SysUser(vip.mate.system.entity.SysUser) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 2 with SysUser

use of vip.mate.system.entity.SysUser in project matecloud by matevip.

the class SysUserServiceImpl method status.

@Override
public boolean status(String ids, String status) {
    Collection<? extends Serializable> collection = CollectionUtil.stringToCollection(ids);
    if (ObjectUtils.isEmpty(collection)) {
        throw new BaseException("传入的ID值不能为空!");
    }
    collection.forEach(id -> {
        SysUser sysUser = this.baseMapper.selectById(CollectionUtil.objectToLong(id, 0L));
        sysUser.setStatus(status);
        this.baseMapper.updateById(sysUser);
    });
    return true;
}
Also used : BaseException(vip.mate.core.common.exception.BaseException) SysUser(vip.mate.system.entity.SysUser)

Example 3 with SysUser

use of vip.mate.system.entity.SysUser in project matecloud by matevip.

the class SysUserProvider method getUserById.

@Override
@GetMapping(ProviderConstant.PROVIDER_USER_ID)
@Log(value = "用户ID查询", exception = "用户ID查询请求失败")
@ApiOperation(value = "用户ID查询", notes = "用户ID查询")
public Result<SysUser> getUserById(Long id) {
    SysUser sysUser = sysUserService.getById(id);
    // 测试日志埋点
    TrackUtil.info(SysUserProvider.class.getName(), "userInfoById", JSON.toJSONString(sysUser));
    return Result.data(sysUser);
}
Also used : SysUser(vip.mate.system.entity.SysUser) GetMapping(org.springframework.web.bind.annotation.GetMapping) Log(vip.mate.core.log.annotation.Log) ApiOperation(io.swagger.annotations.ApiOperation)

Example 4 with SysUser

use of vip.mate.system.entity.SysUser in project matecloud by matevip.

the class UserDetailsServiceImpl method getUserDetails.

private UserDetails getUserDetails(UserInfo userInfo) {
    if (ObjectUtils.isEmpty(userInfo)) {
        log.info("该用户:{} 不存在!", userInfo.getUserName());
        throw new TokenException("该用户:" + userInfo.getUserName() + "不存在");
    } else if (DISABLE.equals(userInfo.getSysUser().getStatus())) {
        log.info("该用户:{} 已被停用!", userInfo.getUserName());
        throw new TokenException("对不起,您的账号:" + userInfo.getUserName() + " 已停用");
    }
    SysUser user = userInfo.getSysUser();
    log.info("用户名:{}", userInfo.getSysUser().getAccount());
    Collection<? extends GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(Convert.toStrArray(userInfo.getRoleIds()));
    log.info("authorities: {}", authorities);
    return new MateUser(user.getId(), userInfo.getType(), user.getDepartId(), user.getRoleId(), user.getTelephone(), user.getAvatar(), user.getTenantId(), userInfo.getUserName(), user.getPassword(), ENABLE.equals(user.getStatus()), true, true, true, authorities);
}
Also used : MateUser(vip.mate.core.security.userdetails.MateUser) SysUser(vip.mate.system.entity.SysUser) TokenException(vip.mate.core.common.exception.TokenException)

Aggregations

SysUser (vip.mate.system.entity.SysUser)4 BaseException (vip.mate.core.common.exception.BaseException)2 StrUtil (cn.hutool.core.util.StrUtil)1 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 IPage (com.baomidou.mybatisplus.core.metadata.IPage)1 Wrappers (com.baomidou.mybatisplus.core.toolkit.Wrappers)1 ServiceImpl (com.baomidou.mybatisplus.extension.service.impl.ServiceImpl)1 ApiOperation (io.swagger.annotations.ApiOperation)1 Serializable (java.io.Serializable)1 Collection (java.util.Collection)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1 ObjectUtils (org.apache.commons.lang3.ObjectUtils)1 BeanUtils (org.springframework.beans.BeanUtils)1 Service (org.springframework.stereotype.Service)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 SystemConstant (vip.mate.core.common.constant.SystemConstant)1 TokenException (vip.mate.core.common.exception.TokenException)1 Search (vip.mate.core.database.entity.Search)1