use of io.choerodon.agile.infra.dto.business.IssueConvertDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method createSubIssue.
/**
* 创建subIssue,用于敏捷
*
* @param issueSubCreateVO
* @return
*/
@Override
public IssueSubVO createSubIssue(IssueSubCreateVO issueSubCreateVO) {
IssueConvertDTO subIssueConvertDTO = issueAssembler.toTarget(issueSubCreateVO, IssueConvertDTO.class);
Long projectId = subIssueConvertDTO.getProjectId();
Long issueId = handlerSubIssue(projectId, subIssueConvertDTO, issueSubCreateVO);
Set<Long> influenceIssueIds = new HashSet<>();
issueService.doStateMachineCustomFlow(projectId, issueId, SchemeApplyType.AGILE, influenceIssueIds, new TriggerCarrierVO());
// 前端请求创建issue和创建自定义字段是两个接口,issue创建不走切面,解决issue创建和自定义字段创建都走切面导致某个触发器失败的问题
IssueSubVO issueSubVO = issueService.queryIssueSubByCreateWithoutRuleNotice(subIssueConvertDTO.getProjectId(), issueId);
issueSubVO.setInfluenceIssueIds(new ArrayList<>(influenceIssueIds));
return issueSubVO;
}
use of io.choerodon.agile.infra.dto.business.IssueConvertDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method createSubIssueWithoutRuleNotice.
@Override
public IssueSubVO createSubIssueWithoutRuleNotice(IssueSubCreateVO issueSubCreateVO) {
IssueConvertDTO subIssueConvertDTO = issueAssembler.toTarget(issueSubCreateVO, IssueConvertDTO.class);
Long projectId = subIssueConvertDTO.getProjectId();
Long issueId = handlerSubIssue(projectId, subIssueConvertDTO, issueSubCreateVO);
Set<Long> influenceIssueIds = new HashSet<>();
issueService.doStateMachineCustomFlow(projectId, issueId, SchemeApplyType.AGILE, influenceIssueIds, new TriggerCarrierVO());
IssueSubVO issueSubVO = issueService.queryIssueSubByCreateWithoutRuleNotice(subIssueConvertDTO.getProjectId(), issueId);
issueSubVO.setInfluenceIssueIds(new ArrayList<>(influenceIssueIds));
return issueSubVO;
}
use of io.choerodon.agile.infra.dto.business.IssueConvertDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method handlerIssue.
private Long handlerIssue(IssueCreateVO issueCreateVO, String applyType) {
issueValidator.checkIssueCreate(issueCreateVO, applyType);
if (agilePluginService != null) {
agilePluginService.checkBeforeCreateIssue(issueCreateVO, applyType);
}
if (agileWaterfallService != null) {
agileWaterfallService.checkBeforeCreateIssue(issueCreateVO, applyType);
}
IssueConvertDTO issueConvertDTO = issueAssembler.toTarget(issueCreateVO, IssueConvertDTO.class);
Long projectId = issueConvertDTO.getProjectId();
Long organizationId = ConvertUtil.getOrganizationId(projectId);
// 获取状态机id
Long stateMachineId = statusMachineSchemeConfigMapper.selectStatusMachineIdByIssueTypeId(organizationId, projectId, applyType, issueConvertDTO.getIssueTypeId());
if (stateMachineId == null) {
throw new CommonException(ERROR_ISSUE_STATE_MACHINE_NOT_FOUND);
}
Long initStatusId = issueCreateVO.getStatusId();
if (ObjectUtils.isEmpty(initStatusId)) {
// 获取初始状态
initStatusId = instanceService.queryInitStatusId(organizationId, stateMachineId);
if (initStatusId == null) {
throw new CommonException(ERROR_ISSUE_STATUS_NOT_FOUND);
}
}
// 获取项目信息
ProjectInfoDTO projectInfoDTO = new ProjectInfoDTO();
projectInfoDTO.setProjectId(projectId);
ProjectInfoDTO projectInfo = projectInfoMapper.selectOne(projectInfoDTO);
if (projectInfo == null) {
throw new CommonException(ERROR_PROJECT_INFO_NOT_FOUND);
}
// 创建issue
issueConvertDTO.setApplyType(applyType);
issueService.handleInitIssue(issueConvertDTO, initStatusId, projectInfo);
Long issueId = issueAccessDataService.create(issueConvertDTO).getIssueId();
BaseFieldUtil.updateIssueLastUpdateInfo(issueConvertDTO.getRelateIssueId(), issueConvertDTO.getProjectId());
// 创建史诗,初始化排序
if ("issue_epic".equals(issueCreateVO.getTypeCode())) {
initRank(issueCreateVO, issueId, "epic");
}
CreateIssuePayload createIssuePayload = new CreateIssuePayload(issueCreateVO, issueConvertDTO, projectInfo);
InputDTO inputDTO = new InputDTO(issueId, JSON.toJSONString(createIssuePayload));
// 通过状态机客户端创建实例, 反射验证/条件/后置动作
StateMachineTransformDTO initTransform = modelMapper.map(instanceService.queryInitTransform(organizationId, stateMachineId), StateMachineTransformDTO.class);
stateMachineClient.createInstance(initTransform, inputDTO);
issueService.afterCreateIssue(issueId, issueConvertDTO, issueCreateVO, projectInfo);
if (agilePluginService != null) {
agilePluginService.handlerBusinessAfterCreateIssue(issueConvertDTO, projectId, issueId, issueCreateVO);
}
if (agileWaterfallService != null) {
agileWaterfallService.handlerWaterfallAfterCreateIssue(projectId, issueId, issueCreateVO);
}
// 创建交付物
if (agileWaterfallService != null && issueCreateVO.getTypeCode().equals(IssueTypeCode.MILESTONE.value()) && !ObjectUtils.isEmpty(issueCreateVO.getWaterfallIssueVO()) && !CollectionUtils.isEmpty(issueCreateVO.getWaterfallIssueVO().getWfDeliverableVOS())) {
agileWaterfallService.createDeliverableService(issueId, issueCreateVO.getWaterfallIssueVO().getWfDeliverableVOS());
}
return issueId;
}
use of io.choerodon.agile.infra.dto.business.IssueConvertDTO in project agile-service by open-hand.
the class IssueServiceImpl method handlerStatus.
private void handlerStatus(Long projectId, IssueUpdateTypeVO issueUpdateTypeVO) {
IssueConvertDTO issueConvertDTO = queryIssueByProjectIdAndIssueId(projectId, issueUpdateTypeVO.getIssueId());
Long currentStateMachineId = projectConfigService.queryStateMachineId(projectId, issueUpdateTypeVO.getApplyType(), issueUpdateTypeVO.getIssueTypeId());
// 查询状态机里面的状态
List<StatusMachineNodeVO> statusMachineNodeVOS = stateMachineNodeService.queryByStateMachineId(ConvertUtil.getOrganizationId(projectId), currentStateMachineId, false);
if (CollectionUtils.isEmpty(statusMachineNodeVOS)) {
throw new CommonException("error.current.state.machine.node.null");
}
List<Long> list = statusMachineNodeVOS.stream().map(StatusMachineNodeVO::getStatusId).collect(Collectors.toList());
if (!list.contains(issueConvertDTO.getStatusId())) {
StatusMachineNodeVO statusMachineNodeVO = statusMachineNodeVOS.stream().filter(v -> NodeType.INIT.equals(v.getType())).findAny().orElse(null);
if (ObjectUtils.isEmpty(statusMachineNodeVO)) {
throw new CommonException("error.init.node.not.found");
}
issueConvertDTO.setStatusId(statusMachineNodeVO.getStatusId());
issueAccessDataService.update(issueConvertDTO, new String[] { STATUS_ID });
}
}
use of io.choerodon.agile.infra.dto.business.IssueConvertDTO in project agile-service by open-hand.
the class IssueServiceImpl method dragEpic.
@Override
public synchronized EpicDataVO dragEpic(Long projectId, EpicSequenceVO epicSequenceVO) {
if (epicSequenceVO.getAfterSequence() == null && epicSequenceVO.getBeforeSequence() == null) {
throw new CommonException("error.dragEpic.noSequence");
}
IssueDTO issueDTO = new IssueDTO();
issueDTO.setIssueId(epicSequenceVO.getEpicId());
issueDTO.setProjectId(projectId);
IssueConvertDTO issueConvertDTO = modelMapper.map(issueMapper.selectOne(issueDTO), IssueConvertDTO.class);
if (issueConvertDTO == null) {
throw new CommonException("error.issue.notFound");
} else {
if (epicSequenceVO.getAfterSequence() == null) {
Integer maxSequence = productVersionMapper.queryMaxAfterSequence(epicSequenceVO.getBeforeSequence(), projectId);
epicSequenceVO.setAfterSequence(maxSequence);
} else if (epicSequenceVO.getBeforeSequence() == null) {
Integer minSequence = productVersionMapper.queryMinBeforeSequence(epicSequenceVO.getAfterSequence(), projectId);
epicSequenceVO.setBeforeSequence(minSequence);
}
handleSequence(epicSequenceVO, projectId, issueConvertDTO);
}
return epicDataAssembler.toTarget(issueMapper.queryEpicListByEpic(epicSequenceVO.getEpicId(), projectId), EpicDataVO.class);
}
Aggregations