use of io.choerodon.agile.api.vo.StatusVO in project agile-service by open-hand.
the class IssueStatusServiceImpl method create.
@Override
public IssueStatusVO create(Long projectId, String applyType, IssueStatusVO issueStatusVO) {
IssueStatusValidator.checkCreateStatus(projectId, issueStatusVO);
StatusVO statusVO = new StatusVO();
statusVO.setType(issueStatusVO.getCategoryCode());
statusVO.setName(issueStatusVO.getName());
statusVO = projectConfigService.createStatusForAgile(projectId, applyType, statusVO);
if (statusVO != null && statusVO.getId() != null) {
Long statusId = statusVO.getId();
if (issueStatusMapper.selectByStatusId(projectId, statusId) != null) {
throw new CommonException("error.status.exist");
}
issueStatusVO.setCompleted(false);
issueStatusVO.setStatusId(statusId);
IssueStatusDTO issueStatusDTO = modelMapper.map(issueStatusVO, IssueStatusDTO.class);
return modelMapper.map(insertIssueStatus(issueStatusDTO), IssueStatusVO.class);
} else {
throw new CommonException("error.status.create");
}
}
use of io.choerodon.agile.api.vo.StatusVO in project agile-service by open-hand.
the class IssueLinkAssembler method issueLinkDTOToVO.
public List<IssueLinkVO> issueLinkDTOToVO(Long projectId, List<IssueLinkDTO> issueLinkDTOList) {
List<IssueLinkVO> issueLinkVOList = new ArrayList<>(issueLinkDTOList.size());
if (!issueLinkDTOList.isEmpty()) {
Map<Long, IssueTypeVO> testIssueTypeDTOMap = ConvertUtil.getIssueTypeMap(projectId, SchemeApplyType.TEST);
Map<Long, IssueTypeVO> agileIssueTypeDTOMap = ConvertUtil.getIssueTypeMap(projectId, SchemeApplyType.AGILE);
Map<Long, StatusVO> statusMapDTOMap = ConvertUtil.getIssueStatusMap(projectId);
Map<Long, PriorityVO> priorityDTOMap = ConvertUtil.getIssuePriorityMap(projectId);
List<Long> assigneeIds = issueLinkDTOList.stream().filter(issue -> issue.getAssigneeId() != null && !Objects.equals(issue.getAssigneeId(), 0L)).map(IssueLinkDTO::getAssigneeId).distinct().collect(Collectors.toList());
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(assigneeIds, true);
issueLinkDTOList.forEach(issueLinkDO -> {
String assigneeName = usersMap.get(issueLinkDO.getAssigneeId()) != null ? usersMap.get(issueLinkDO.getAssigneeId()).getName() : null;
String imageUrl = assigneeName != null ? usersMap.get(issueLinkDO.getAssigneeId()).getImageUrl() : null;
IssueLinkVO issueLinkVO = new IssueLinkVO();
BeanUtils.copyProperties(issueLinkDO, issueLinkVO);
if (issueLinkDO.getApplyType().equals(SchemeApplyType.TEST)) {
issueLinkVO.setIssueTypeVO(testIssueTypeDTOMap.get(issueLinkDO.getIssueTypeId()));
} else {
issueLinkVO.setIssueTypeVO(agileIssueTypeDTOMap.get(issueLinkDO.getIssueTypeId()));
}
issueLinkVO.setStatusVO(statusMapDTOMap.get(issueLinkDO.getStatusId()));
issueLinkVO.setPriorityVO(priorityDTOMap.get(issueLinkDO.getPriorityId()));
issueLinkVO.setAssigneeName(assigneeName);
issueLinkVO.setImageUrl(imageUrl);
issueLinkVOList.add(issueLinkVO);
});
}
return issueLinkVOList;
}
use of io.choerodon.agile.api.vo.StatusVO in project agile-service by open-hand.
the class IssueStatusServiceImpl method queryUnCorrespondStatus.
@Override
public List<StatusAndIssuesVO> queryUnCorrespondStatus(Long projectId, Long boardId, String applyType) {
List<StatusVO> statusMapVOList = projectConfigService.queryStatusByProjectId(projectId, applyType);
List<Long> realStatusIds = new ArrayList<>();
for (StatusVO statusMapVO : statusMapVOList) {
realStatusIds.add(statusMapVO.getId());
}
if (realStatusIds.isEmpty()) {
return new ArrayList<>();
}
List<StatusAndIssuesDTO> statusAndIssuesDTOList = issueStatusMapper.queryUnCorrespondStatus(projectId, boardId, realStatusIds);
if (statusAndIssuesDTOList != null && !statusAndIssuesDTOList.isEmpty()) {
List<Long> ids = new ArrayList<>();
for (StatusAndIssuesDTO statusAndIssuesDTO : statusAndIssuesDTOList) {
ids.add(statusAndIssuesDTO.getStatusId());
}
Map<Long, StatusDTO> map = statusService.batchStatusGet(ids);
for (StatusAndIssuesDTO statusAndIssuesDTO : statusAndIssuesDTOList) {
StatusDTO status = map.get(statusAndIssuesDTO.getStatusId());
statusAndIssuesDTO.setCategoryCode(status.getType());
statusAndIssuesDTO.setName(status.getName());
}
}
List<StatusAndIssuesVO> statusAndIssuesVOList = new ArrayList<>();
if (statusAndIssuesDTOList != null) {
statusAndIssuesVOList = modelMapper.map(statusAndIssuesDTOList, new TypeToken<List<StatusAndIssuesVO>>() {
}.getType());
}
return statusAndIssuesVOList;
}
Aggregations