use of com.webank.wedatasphere.qualitis.project.response.ProjectResponse in project Qualitis by WeBankFinTech.
the class ProjectServiceImpl method getAllProjectByUserReal.
@Override
public GetAllResponse<ProjectResponse> getAllProjectByUserReal() {
// Get username
String loginUser = HttpUtils.getUserName(httpServletRequest);
// Find project user in different permissions.
List<Integer> permissions = new ArrayList<>();
permissions.add(ProjectUserPermissionEnum.CREATOR.getCode());
permissions.add(ProjectUserPermissionEnum.DEVELOPER.getCode());
permissions.add(ProjectUserPermissionEnum.OPERATOR.getCode());
permissions.add(ProjectUserPermissionEnum.BUSSMAN.getCode());
List<Project> projects = projectUserDao.findByUsernameAndPermission(loginUser, permissions);
long total = projectUserDao.countByUsernameAndPermission(loginUser, permissions);
List<ProjectResponse> projectResponses = new ArrayList<>();
for (Project project : projects) {
projectResponses.add(new ProjectResponse(project));
}
GetAllResponse<ProjectResponse> response = new GetAllResponse<>();
response.setTotal(total);
response.setData(projectResponses);
return response;
}
use of com.webank.wedatasphere.qualitis.project.response.ProjectResponse in project Qualitis by WeBankFinTech.
the class ProjectServiceImpl method getAllProjectByUserReal.
@Override
public GetAllResponse<ProjectResponse> getAllProjectByUserReal(PageRequest request, Integer projectType) throws UnExpectedRequestException {
// Check Arguments
PageRequest.checkRequest(request);
// Get user name
String userName = HttpUtils.getUserName(httpServletRequest);
// Paging get project
int page = request.getPage();
int size = request.getSize();
List<ProjectUser> projectUsers = projectUserDao.findByUsernameAndPermissionAndProjectType(userName, projectType, page, size);
long total = projectUserDao.countByUsernameAndPermissionAndProjectType(userName, projectType);
List<ProjectResponse> projectResponses = new ArrayList<>();
for (ProjectUser projectUser : projectUsers) {
projectResponses.add(new ProjectResponse(projectUser.getProject()));
}
GetAllResponse<ProjectResponse> response = new GetAllResponse<>();
response.setData(projectResponses);
response.setTotal(total);
return response;
}
Aggregations