use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class IssueServiceImpl method handleUpdateIssueWithoutRuleNotice.
@Override
public void handleUpdateIssueWithoutRuleNotice(IssueUpdateVO issueUpdateVO, List<String> fieldList, Long projectId) {
fieldList = new ArrayList<>(fieldList);
CustomUserDetails customUserDetails = DetailsHelper.getUserDetails();
IssueDTO originIssue = issueMapper.queryIssueWithNoCloseSprint(issueUpdateVO.getIssueId());
IssueConvertDTO issueConvertDTO = issueAssembler.toTarget(issueUpdateVO, IssueConvertDTO.class);
String issueType = originIssue.getTypeCode();
// 处理用户,前端可能会传0,处理为null
issueConvertDTO.initializationIssueUser();
if (fieldList.contains(SPRINT_ID_FIELD)) {
IssueConvertDTO oldIssue = modelMapper.map(originIssue, IssueConvertDTO.class);
Long sprintId = issueConvertDTO.getSprintId();
// 处理子任务的冲刺
List<Long> issueIds = issueMapper.querySubIssueIdsByIssueId(projectId, issueConvertDTO.getIssueId());
List<Long> subBugIds = issueMapper.querySubBugIdsByIssueId(projectId, issueConvertDTO.getIssueId());
if (subBugIds != null && !subBugIds.isEmpty()) {
issueIds.addAll(subBugIds);
}
Boolean exitSprint = issueConvertDTO.getSprintId() != null && !Objects.equals(issueConvertDTO.getSprintId(), 0L);
Boolean condition = (!Objects.equals(oldIssue.getSprintId(), issueUpdateVO.getSprintId()));
issueIds.add(issueConvertDTO.getIssueId());
if (condition) {
BatchRemoveSprintDTO batchRemoveSprintDTO = new BatchRemoveSprintDTO(projectId, issueConvertDTO.getSprintId(), issueIds);
issueAccessDataService.removeIssueFromSprintByIssueIds(batchRemoveSprintDTO);
if (agilePluginService != null) {
agilePluginService.updateIssueSprintChanged(oldIssue, projectId, sprintId, issueType);
}
}
if (exitSprint) {
issueAccessDataService.issueToDestinationByIds(projectId, issueConvertDTO.getSprintId(), issueIds, new Date(), customUserDetails.getUserId());
}
if (oldIssue.isIssueRank()) {
calculationRank(projectId, issueConvertDTO);
fieldList.add(RANK_FIELD);
issueConvertDTO.setOriginSprintId(originIssue.getSprintId());
}
}
if (fieldList.contains("estimateTime") && !ObjectUtils.isEmpty(issueConvertDTO.getEstimateTime()) && ObjectUtils.isEmpty(originIssue.getRemainingTime())) {
fieldList.add("remainingTime");
issueConvertDTO.setRemainingTime(issueConvertDTO.getEstimateTime());
}
if (agilePluginService != null) {
agilePluginService.handlerBusinessUpdateIssue(issueType, fieldList, projectId, issueUpdateVO, originIssue);
agilePluginService.issueSyncByIssueId(ConvertUtil.getOrganizationId(projectId), issueConvertDTO.getIssueId(), OpenAppIssueSyncConstant.AppType.DIND.getValue(), OpenAppIssueSyncConstant.OperationType.UPDATE);
}
if (agileWaterfallService != null) {
agileWaterfallService.handlerWaterfallUpdateIssue(issueType, fieldList, projectId, issueUpdateVO, originIssue);
}
// 处理issue改变状态时,满足条件改变 is_pre_sprint_done 的值
handleHistorySprintCompleted(projectId, issueConvertDTO, fieldList, originIssue);
// 处理预计、实际时间
handleEstimateTimeAndActualTime(issueConvertDTO);
issueAccessDataService.update(issueConvertDTO, fieldList.toArray(new String[fieldList.size()]));
}
use of io.choerodon.agile.infra.dto.business.IssueDTO 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);
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class IssueServiceImpl method buildTriggerCarrierVO.
@Override
public void buildTriggerCarrierVO(Long projectId, Long issueId, List<TriggerCarrierVO> list, List<Long> customFieldIds) {
IssueDTO issueDTO = issueMapper.selectByPrimaryKey(issueId);
if (ObjectUtils.isEmpty(issueDTO)) {
return;
}
TriggerCarrierVO triggerCarrierVO = new TriggerCarrierVO();
triggerCarrierVO.setInstanceId(issueId);
triggerCarrierVO.setProjectId(projectId);
triggerCarrierVO.setIssueTypeId(issueDTO.getIssueTypeId());
triggerCarrierVO.setNoticeInstanceId(issueId);
triggerCarrierVO.setFieldList(new ArrayList<>());
triggerCarrierVO.setExecutedRules(new ArrayList<>());
triggerCarrierVO.setMemberFieldIds(new HashSet<>(customFieldIds));
triggerCarrierVO.setAuditDomain(issueDTO);
list.add(triggerCarrierVO);
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class IssueUserRelServiceImpl method createUserRel.
@Override
@DataLog(type = "createUserRel")
public void createUserRel(Long projectId, Long issueId, List<Long> userIds, String userType) {
if (!RELATED_PARTIES.equals(userType)) {
throw new CommonException("error.issue.user.rel.type.illegal");
}
IssueDTO issueDTO = issueMapper.selectByPrimaryKey(issueId);
if (Objects.isNull(issueDTO)) {
throw new CommonException("error.issue.not.exist");
}
if (ObjectUtils.isEmpty(userIds)) {
return;
}
Long organizationId = ConvertUtil.getOrganizationId(projectId);
userIds.forEach(v -> {
IssueUserRelDTO issueUserRelDTO = new IssueUserRelDTO();
issueUserRelDTO.setIssueId(issueId);
issueUserRelDTO.setUserType(userType);
issueUserRelDTO.setUserId(v);
issueUserRelDTO.setProjectId(projectId);
issueUserRelDTO.setOrganizationId(organizationId);
baseCreate(issueUserRelDTO);
});
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class IssueAccessDataServiceImpl method create.
@Override
@DataLog(type = "issueCreate")
public IssueConvertDTO create(IssueConvertDTO issueConvertDTO) {
// 临时存个优先级code
issueConvertDTO.setPriorityCode("priority-" + issueConvertDTO.getPriorityId());
IssueDTO issueDTO = modelMapper.map(issueConvertDTO, IssueDTO.class);
if (issueMapper.insertSelective(issueDTO) != 1) {
throw new CommonException(INSERT_ERROR);
}
return modelMapper.map(issueMapper.selectByPrimaryKey(issueDTO.getIssueId()), IssueConvertDTO.class);
}
Aggregations