use of io.choerodon.agile.api.vo.business.IssueListVO in project agile-service by open-hand.
the class SprintServiceImpl method queryIssueByOptions.
@Override
public Page<IssueListVO> queryIssueByOptions(Long projectId, Long sprintId, String status, PageRequest pageRequest, Long organizationId) {
SprintDTO sprintDTO = new SprintDTO();
sprintDTO.setProjectId(projectId);
sprintDTO.setSprintId(sprintId);
SprintDTO sprint = sprintMapper.selectOne(sprintDTO);
if (sprint == null || Objects.equals(sprint.getStatusCode(), SPRINT_PLANNING_CODE)) {
throw new CommonException(SPRINT_REPORT_ERROR);
}
Date actualEndDate = sprint.getActualEndDate() == null ? new Date() : sprint.getActualEndDate();
sprint.setActualEndDate(actualEndDate);
Date startDate = sprint.getStartDate();
Page<Long> reportIssuePage = new Page<>();
Map<String, String> maps = new HashMap<>();
maps.put("issueNum", "issue_num_convert");
Sort sort = PageUtil.sortResetOrder(pageRequest.getSort(), "ai", maps);
pageRequest.setSort(sort);
switch(status) {
case DONE:
reportIssuePage = PageHelper.doPageAndSort(pageRequest, () -> reportMapper.queryReportIssueIds(projectId, sprintId, actualEndDate, true));
break;
case UNFINISHED:
reportIssuePage = PageHelper.doPageAndSort(pageRequest, () -> reportMapper.queryReportIssueIds(projectId, sprintId, actualEndDate, false));
break;
case REMOVE:
reportIssuePage = PageHelper.doPageAndSort(pageRequest, () -> reportMapper.queryRemoveIssueIdsDuringSprintWithOutSubEpicIssue(sprint));
break;
default:
break;
}
List<Long> reportIssueIds = reportIssuePage.getContent();
if (reportIssueIds.isEmpty()) {
return new Page<>();
}
Map<Long, StatusVO> statusMapDTOMap = statusService.queryAllStatusMap(organizationId);
// 冲刺报告查询的issue
List<IssueDTO> reportIssues = reportMapper.queryIssueByIssueIds(projectId, reportIssueIds);
// 冲刺中新添加的issue
List<Long> issueIdBeforeSprintList = reportMapper.queryIssueIdsBeforeSprintStart(sprint, new BurnDownSearchVO(), null);
List<Long> issueIdAddList = issueIdBeforeSprintList.isEmpty() ? new ArrayList<>() : reportMapper.queryAddIssueIdsDuringSprint(sprint, new BurnDownSearchVO(), null);
// 冲刺报告中issue的故事点
List<SprintReportIssueStatusDO> reportIssueStoryPoints = reportMapper.queryIssueStoryPoints(projectId, reportIssueIds, actualEndDate);
Map<Long, SprintReportIssueStatusDO> reportIssueStoryPointsMap = reportIssueStoryPoints.stream().collect(Collectors.toMap(SprintReportIssueStatusDO::getIssueId, sprintReportIssueStatusDO -> sprintReportIssueStatusDO));
// 冲刺完成前issue的最后变更状态
List<SprintReportIssueStatusDO> reportIssueBeforeStatus = reportMapper.queryBeforeIssueStatus(projectId, reportIssueIds, startDate, actualEndDate);
Map<Long, SprintReportIssueStatusDO> reportIssueBeforeStatusMap = new HashMap<>();
for (SprintReportIssueStatusDO sprintReportIssueStatusDO : reportIssueBeforeStatus) {
StatusVO statusMapVO = statusMapDTOMap.get(sprintReportIssueStatusDO.getStatusId());
sprintReportIssueStatusDO.setCategoryCode(statusMapVO.getType());
sprintReportIssueStatusDO.setStatusName(statusMapVO.getName());
reportIssueBeforeStatusMap.put(sprintReportIssueStatusDO.getIssueId(), sprintReportIssueStatusDO);
}
// 冲刺完成后issue的最初变更状态
reportIssueIds.removeAll(reportIssueBeforeStatusMap.keySet());
List<SprintReportIssueStatusDO> reportIssueAfterStatus = reportIssueIds.isEmpty() ? new ArrayList<>() : reportMapper.queryAfterIssueStatus(projectId, reportIssueIds, actualEndDate);
Map<Long, SprintReportIssueStatusDO> reportIssueAfterStatusMap = new HashMap<>();
for (SprintReportIssueStatusDO sprintReportIssueStatusDO : reportIssueAfterStatus) {
StatusVO statusMapVO = statusMapDTOMap.get(sprintReportIssueStatusDO.getStatusId());
sprintReportIssueStatusDO.setCategoryCode(statusMapVO.getType());
sprintReportIssueStatusDO.setStatusName(statusMapVO.getName());
reportIssueAfterStatusMap.put(sprintReportIssueStatusDO.getIssueId(), sprintReportIssueStatusDO);
}
reportIssues = reportIssues.stream().map(reportIssue -> {
updateReportIssue(reportIssue, reportIssueStoryPointsMap, reportIssueBeforeStatusMap, reportIssueAfterStatusMap, issueIdAddList);
return reportIssue;
}).collect(Collectors.toList());
Map<Long, PriorityVO> priorityMap = priorityService.queryByOrganizationId(organizationId);
Map<Long, IssueTypeVO> issueTypeDTOMap = issueTypeService.listIssueTypeMap(organizationId, projectId);
return PageUtil.buildPageInfoWithPageInfoList(reportIssuePage, issueAssembler.issueDoToIssueListDto(reportIssues, priorityMap, statusMapDTOMap, issueTypeDTOMap));
}
use of io.choerodon.agile.api.vo.business.IssueListVO in project agile-service by open-hand.
the class IssuePredecessorServiceImpl method queryByIssueId.
@Override
public List<IssuePredecessorVO> queryByIssueId(Long projectId, Long currentIssueId, boolean withInfo) {
IssuePredecessorDTO dto = new IssuePredecessorDTO();
dto.setOrganizationId(ConvertUtil.getOrganizationId(projectId));
dto.setProjectId(projectId);
dto.setIssueId(currentIssueId);
List<IssuePredecessorDTO> dtoList = issuePredecessorMapper.select(dto);
ModelMapper modelMapper = new ModelMapper();
List<IssuePredecessorVO> result = modelMapper.map(dtoList, new TypeToken<List<IssuePredecessorVO>>() {
}.getType());
if (Boolean.TRUE.equals(withInfo) && !CollectionUtils.isEmpty(result)) {
Long organizationId = ConvertUtil.getOrganizationId(projectId);
List<Long> issueIds = result.stream().map(IssuePredecessorVO::getPredecessorId).collect(Collectors.toList());
// 类型、概要、编号、优先级、状态、经办人
List<IssueDTO> issueDTOList = issueMapper.queryIssueListWithSubByIssueIds(issueIds, null, false, false);
Map<Long, PriorityVO> priorityMap = priorityService.queryByOrganizationId(organizationId);
Map<Long, StatusVO> statusMapDTOMap = statusService.queryAllStatusMap(organizationId);
Map<Long, IssueTypeVO> issueTypeDTOMap = issueTypeService.listIssueTypeMap(organizationId, projectId);
List<IssueListVO> issueList = issueAssembler.issueDoToIssueListDto(issueDTOList, priorityMap, statusMapDTOMap, issueTypeDTOMap);
Map<Long, IssueListVO> issueMap = issueList.stream().collect(Collectors.toMap(IssueListVO::getIssueId, Function.identity()));
result.forEach(vo -> vo.setPredecessorIssueVO(issueMap.get(vo.getPredecessorId())));
}
return result;
}
use of io.choerodon.agile.api.vo.business.IssueListVO in project agile-service by open-hand.
the class IssueAssembler method issueDoToIssueListDto.
/**
* issueDO转换到IssueListDTO
*
* @param issueDTOList issueDetailDO
* @return IssueListVO
*/
public List<IssueListVO> issueDoToIssueListDto(List<IssueDTO> issueDTOList, Map<Long, PriorityVO> priorityMap, Map<Long, StatusVO> statusMapDTOMap, Map<Long, IssueTypeVO> issueTypeDTOMap) {
List<IssueListVO> issueListDTOList = new ArrayList<>(issueDTOList.size());
Set<Long> userIds = issueDTOList.stream().filter(issue -> issue.getAssigneeId() != null && !Objects.equals(issue.getAssigneeId(), 0L)).map(IssueDTO::getAssigneeId).collect(Collectors.toSet());
userIds.addAll(issueDTOList.stream().filter(issue -> issue.getReporterId() != null && !Objects.equals(issue.getReporterId(), 0L)).map(IssueDTO::getReporterId).collect(Collectors.toSet()));
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(Lists.newArrayList(userIds), true);
issueDTOList.forEach(issueDO -> {
UserMessageDTO assigneeUserDO = usersMap.get(issueDO.getAssigneeId());
UserMessageDTO reporterUserDO = usersMap.get(issueDO.getReporterId());
IssueListVO issueListVO = toTarget(issueDO, IssueListVO.class);
if (!ObjectUtils.isEmpty(assigneeUserDO)) {
issueListVO.setAssigneeName(assigneeUserDO.getName());
issueListVO.setAssigneeLoginName(assigneeUserDO.getLoginName());
issueListVO.setAssigneeRealName(assigneeUserDO.getRealName());
issueListVO.setAssigneeImageUrl(assigneeUserDO.getImageUrl());
}
if (!ObjectUtils.isEmpty(reporterUserDO)) {
issueListVO.setReporterName(reporterUserDO.getName());
issueListVO.setReporterLoginName(reporterUserDO.getLoginName());
issueListVO.setReporterRealName(reporterUserDO.getRealName());
issueListVO.setReporterImageUrl(reporterUserDO.getImageUrl());
}
issueListVO.setPriorityVO(priorityMap.get(issueDO.getPriorityId()));
issueListVO.setIssueTypeVO(issueTypeDTOMap.get(issueDO.getIssueTypeId()));
issueListVO.setStatusVO(statusMapDTOMap.get(issueDO.getStatusId()));
issueListVO.setVersionIssueRelVOS(toTargetList(issueDO.getVersionIssueRelDTOS(), VersionIssueRelVO.class));
issueListVO.setIssueComponentBriefVOS(toTargetList(issueDO.getIssueComponentBriefDTOS(), IssueComponentBriefVO.class));
issueListVO.setIssueSprintVOS(toTargetList(issueDO.getIssueSprintDTOS(), IssueSprintVO.class));
issueListVO.setLabelIssueRelVOS(toTargetList(issueDO.getLabelIssueRelDTOS(), LabelIssueRelVO.class));
issueListDTOList.add(issueListVO);
});
return issueListDTOList;
}
Aggregations