use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class DataLogAspect method batchUpdateIssueEpicId.
private void batchUpdateIssueEpicId(Object[] args) {
Long projectId = (Long) args[0];
Long issueId = (Long) args[1];
if (projectId != null && issueId != null) {
IssueDTO query = new IssueDTO();
query.setProjectId(projectId);
query.setEpicId(issueId);
List<IssueDTO> issueDTOList = issueMapper.select(query);
issueDTOList.forEach(issueDO -> createIssueEpicLog(0L, issueDO));
}
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class ReportServiceImpl method queryIssueByOptions.
@Override
public Page<IssueListVO> queryIssueByOptions(Long projectId, Long versionId, String status, String type, PageRequest pageRequest, Long organizationId) {
ProductVersionDTO versionDO = new ProductVersionDTO();
versionDO.setProjectId(projectId);
versionDO.setVersionId(versionId);
versionDO = versionMapper.selectOne(versionDO);
if (versionDO == null || Objects.equals(versionDO.getStatusCode(), VERSION_ARCHIVED_CODE)) {
throw new CommonException(VERSION_REPORT_ERROR);
}
Map<String, String> orders = new HashMap<>();
orders.put("issueNum", "issue_num_convert");
Sort sort = PageUtil.sortResetOrder(pageRequest.getSort(), "ai", orders);
pageRequest.setSort(sort);
Page<IssueDTO> reportIssuePage = PageHelper.doPageAndSort(pageRequest, () -> reportMapper.queryReportIssues(projectId, versionId, status, type));
Map<Long, PriorityVO> priorityMap = priorityService.queryByOrganizationId(organizationId);
Map<Long, IssueTypeVO> issueTypeDTOMap = issueTypeService.listIssueTypeMap(organizationId, projectId);
Map<Long, StatusVO> statusMapDTOMap = statusService.queryAllStatusMap(organizationId);
return PageUtil.buildPageInfoWithPageInfoList(reportIssuePage, issueAssembler.issueDoToIssueListDto(reportIssuePage.getContent(), priorityMap, statusMapDTOMap, issueTypeDTOMap));
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class ReportServiceImpl method handleSprintListAndStartDate.
private JSONObject handleSprintListAndStartDate(Long id, Long projectId, String type) {
Date startDate;
List<SprintDTO> sprintDTOList;
if (E_PIC.equals(type)) {
IssueDTO issueDTO = issueMapper.queryEpicWithStatusByIssueId(id, projectId);
if (issueDTO != null) {
startDate = issueDTO.getCreationDate();
if (issueDTO.getCompleted() && issueDTO.getDoneDate() != null) {
sprintDTOList = sprintMapper.queryNotPlanSprintByProjectId(projectId, startDate, issueDTO.getDoneDate());
} else {
sprintDTOList = sprintMapper.queryNotPlanSprintByProjectId(projectId, startDate, null);
}
} else {
throw new CommonException(EPIC_OR_VERSION_NOT_FOUND_ERROR);
}
} else {
ProductVersionDTO query = new ProductVersionDTO();
query.setProjectId(projectId);
query.setVersionId(id);
ProductVersionDTO productVersionDTO = versionMapper.selectOne(query);
if (productVersionDTO != null) {
startDate = productVersionDTO.getStartDate() == null ? productVersionDTO.getCreationDate() : productVersionDTO.getStartDate();
sprintDTOList = sprintMapper.queryNotPlanSprintByProjectId(projectId, startDate, productVersionDTO.getReleaseDate());
} else {
throw new CommonException(EPIC_OR_VERSION_NOT_FOUND_ERROR);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put(SPRINT_DO_LIST, sprintDTOList);
jsonObject.put(START_DATE, startDate);
return jsonObject;
}
use of io.choerodon.agile.infra.dto.business.IssueDTO 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.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method updateStatusMove.
@UpdateStatus(code = UPDATE_STATUS_MOVE)
public void updateStatusMove(Long instanceId, Long targetStatusId, String input) {
IssueDTO issue = issueMapper.selectByPrimaryKey(instanceId);
if (issue == null) {
throw new CommonException("error.updateStatus.instanceId.notFound");
}
if (targetStatusId == null) {
throw new CommonException("error.updateStatus.targetStateId.null");
}
IssueUpdateVO issueUpdateVO = issueAssembler.toTarget(issue, IssueUpdateVO.class);
if (input != null && !Objects.equals(input, "null")) {
JSONObject jsonObject = JSON.parseObject(input, JSONObject.class);
issueUpdateVO.setRank(jsonObject.getString(RANK));
}
if (!issue.getStatusId().equals(targetStatusId)) {
issueUpdateVO.setStatusId(targetStatusId);
issueUpdateVO.setStayDate(new Date());
issueService.handleUpdateIssueWithoutRuleNotice(issueUpdateVO, new ArrayList<>(Arrays.asList(STATUS_ID, RANK, STAY_DATE)), issue.getProjectId());
logger.info("stateMachine updateStatusMove successful");
} else {
issueService.handleUpdateIssueWithoutRuleNotice(issueUpdateVO, new ArrayList<>(Collections.singletonList(RANK)), issue.getProjectId());
}
}
Aggregations