use of io.kenxue.cicd.coreclient.dto.sys.user.UserDTO in project cicd-platform by ken-xue.
the class UserInfoGetQryExe method execute.
public SingleResponse<UserDTO> execute(UserFullGetQry qry) {
// 查询用户信息
User user = userRepository.getByUserId(qry.getUserId());
Assert.notNull(user.getUuid(), "查询用户信息失败");
// 查询对应的角色
Set<Role> roles = userOfRoleRepository.getByUserId(user.getUuid());
UserDTO userDTO = user2DTOAssembler.toDTO(user);
userDTO.setRoles(roles.stream().map(v -> role2DTOAssembler.toDTO(v)).collect(Collectors.toSet()));
return SingleResponse.of(userDTO);
}
use of io.kenxue.cicd.coreclient.dto.sys.user.UserDTO in project cicd-platform by ken-xue.
the class ContextInterceptorTest method testNoOperatorContext.
@Test
public void testNoOperatorContext() {
UserAddCmd userAddCmd = new UserAddCmd();
userAddCmd.setUserDTO(new UserDTO());
// ContextInterceptor contextInterceptor = new ContextInterceptor();
// contextInterceptor.preIntercept(userProfileAddCmd);
}
use of io.kenxue.cicd.coreclient.dto.sys.user.UserDTO in project cicd-platform by ken-xue.
the class ContextInterceptorTest method testOperatorContext.
@Test
public void testOperatorContext() {
UserAddCmd userAddCmd = new UserAddCmd();
userAddCmd.setUserDTO(new UserDTO());
userAddCmd.setOperator("Frank");
// ContextInterceptor contextInterceptor = new ContextInterceptor();
// contextInterceptor.preIntercept(userProfileAddCmd);
}
use of io.kenxue.cicd.coreclient.dto.sys.user.UserDTO in project cicd-platform by ken-xue.
the class UserGetQryExe method execute.
public SingleResponse<UserDTO> execute(UserGetQry qry) {
User user = userRepository.getById(qry.getId());
// 查询所属角色
Set<Role> roles = userOfRoleRepository.getByUserId(user.getUuid());
List<String> roleUuids = roles.stream().map(v -> v.getUuid()).collect(Collectors.toList());
UserDTO userDTO = user2DTOAssembler.toDTO(user);
userDTO.setRoleIdList(roleUuids);
userDTO.setRoles(roles.stream().map(v -> role2DTOAssembler.toDTO(v)).collect(Collectors.toSet()));
return SingleResponse.of(userDTO);
}
use of io.kenxue.cicd.coreclient.dto.sys.user.UserDTO in project cicd-platform by ken-xue.
the class ProjectInfoRepositoryImpl method page.
@Override
public Page<ProjectInfo> page(ProjectInfoPageQry qry) {
QueryWrapper<ProjectInfoDO> qw = new QueryWrapper<>();
UserDTO user = UserThreadContext.getUser();
UserDO userDO = userMapper.selectOne(new QueryWrapper<UserDO>().eq("user_id", user.getUserId()));
String uuid = userDO.getUuid();
qw.eq("user_uuid", uuid);
ProjectTypeEnum projectType = qry.getProjectType();
IPage<ProjectInfoDO> doPage;
PageDTO pageDTO = new PageDTO(qry.getPageIndex(), qry.getPageSize());
if (projectType == ProjectTypeEnum.JOIN) {
doPage = projectInfoMapper.queryRelatedProject(pageDTO, userDO.getUuid(), qry.getProjectInfoDTO().getUsername(), qry.getProjectInfoDTO().getProjectName());
} else {
if (Objects.nonNull(qry.getProjectInfoDTO()) && StringUtils.isNotBlank(qry.getProjectInfoDTO().getProjectName()))
qw.like("project_name", qry.getProjectInfoDTO().getProjectName());
doPage = projectInfoMapper.selectPage(pageDTO, qw);
doPage.getRecords().forEach(v -> v.setUsername(userDO.getUserName()));
}
return Page.of(doPage.getCurrent(), doPage.getSize(), doPage.getTotal(), projectInfo2DOConvector.toDomainList(doPage.getRecords()));
}
Aggregations