Search in sources :

Example 1 with SprintConvertDTO

use of io.choerodon.agile.infra.dto.business.SprintConvertDTO in project agile-service by open-hand.

the class SprintServiceImpl method startSprint.

@Override
public SprintDetailVO startSprint(Long projectId, SprintUpdateVO sprintUpdateVO, boolean noticeIam) {
    if (!Objects.equals(projectId, sprintUpdateVO.getProjectId())) {
        throw new CommonException(NOT_EQUAL_ERROR);
    }
    if (sprintMapper.selectCountByStartedSprint(projectId) != 0) {
        throw new CommonException(START_SPRINT_ERROR);
    }
    SprintConvertDTO sprintConvertDTO = sprintUpdateAssembler.toTarget(sprintUpdateVO, SprintConvertDTO.class);
    sprintConvertDTO.checkDate();
    sprintConvertDTO.startSprint();
    if (sprintUpdateVO.getWorkDates() != null && !sprintUpdateVO.getWorkDates().isEmpty()) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        if (agilePluginService != null) {
            agilePluginService.handlerSprintStartDate(projectId, sprintConvertDTO);
        }
        sprintUpdateVO.getWorkDates().forEach(workDates -> {
            WorkCalendarRefDTO workCalendarRefDTO = new WorkCalendarRefDTO();
            workCalendarRefDTO.setSprintId(sprintConvertDTO.getSprintId());
            workCalendarRefDTO.setProjectId(sprintConvertDTO.getProjectId());
            workCalendarRefDTO.setWorkDay(workDates.getWorkDay());
            try {
                calendar.setTime(dateFormat.parse(workDates.getWorkDay()));
            } catch (ParseException e) {
                throw new CommonException("ParseException{}", e);
            }
            workCalendarRefDTO.setYear(calendar.get(Calendar.YEAR));
            workCalendarRefDTO.setStatus(workDates.getStatus());
            workCalendarRefService.create(workCalendarRefDTO);
        });
    }
    issueAccessDataService.updateStayDate(projectId, sprintConvertDTO.getSprintId(), new Date());
    if (agilePluginService != null && noticeIam) {
        agilePluginService.sprintStarted(projectId);
    }
    return sprintUpdateAssembler.toTarget(update(sprintConvertDTO), SprintDetailVO.class);
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) CommonException(io.choerodon.core.exception.CommonException) ParseException(java.text.ParseException) SprintConvertDTO(io.choerodon.agile.infra.dto.business.SprintConvertDTO) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with SprintConvertDTO

use of io.choerodon.agile.infra.dto.business.SprintConvertDTO in project agile-service by open-hand.

the class SprintServiceImpl method createSprintByDetails.

@Override
public synchronized SprintDetailVO createSprintByDetails(Long projectId, SprintCreateVO sprintCreateVO) {
    SprintConvertDTO sprint = new SprintConvertDTO(projectId, sprintCreateVO.getSprintName(), sprintCreateVO.getSprintGoal(), sprintCreateVO.getStartDate(), sprintCreateVO.getEndDate(), STATUS_SPRINT_PLANNING_CODE);
    if (Boolean.TRUE.equals(checkName(projectId, sprintCreateVO.getSprintName()))) {
        throw new CommonException("error.sprintName.exist");
    }
    SprintConvertDTO sprintConvertDTO = null;
    if (agilePluginService != null) {
        sprintConvertDTO = agilePluginService.createSubProjectSprint(projectId, sprint);
    } else {
        sprintConvertDTO = create(sprint);
    }
    return sprintCreateAssembler.toTarget(sprintConvertDTO, SprintDetailVO.class);
}
Also used : CommonException(io.choerodon.core.exception.CommonException) SprintConvertDTO(io.choerodon.agile.infra.dto.business.SprintConvertDTO)

Example 3 with SprintConvertDTO

use of io.choerodon.agile.infra.dto.business.SprintConvertDTO in project agile-service by open-hand.

the class SprintServiceImpl method createSprint.

@Override
public synchronized SprintDetailVO createSprint(Long projectId) {
    ProjectInfoDTO projectInfo = new ProjectInfoDTO();
    projectInfo.setProjectId(projectId);
    projectInfo = projectInfoMapper.selectOne(projectInfo);
    if (projectInfo == null) {
        throw new CommonException(PROJECT_NOT_FOUND_ERROR);
    }
    SprintDTO sprintDTO = sprintMapper.queryLastSprint(projectId);
    SprintConvertDTO sprint = new SprintConvertDTO();
    if (sprintDTO == null) {
        sprint.createSprint(projectInfo);
    } else {
        SprintConvertDTO sprintConvertDTO = sprintCreateAssembler.toTarget(sprintDTO, SprintConvertDTO.class);
        sprint.createSprint(sprintConvertDTO);
    }
    return sprintCreateAssembler.toTarget(create(sprint), SprintDetailVO.class);
}
Also used : CommonException(io.choerodon.core.exception.CommonException) SprintConvertDTO(io.choerodon.agile.infra.dto.business.SprintConvertDTO)

Example 4 with SprintConvertDTO

use of io.choerodon.agile.infra.dto.business.SprintConvertDTO in project agile-service by open-hand.

the class ReportServiceImpl method getBurnDownReport.

private List<ReportIssueConvertDTO> getBurnDownReport(Long projectId, Long sprintId, BurnDownSearchVO burnDownSearchVO) {
    String type = burnDownSearchVO.getType();
    List<ReportIssueConvertDTO> reportIssueConvertDTOList = new ArrayList<>();
    SprintDTO sprintDTO = new SprintDTO();
    sprintDTO.setSprintId(sprintId);
    sprintDTO.setProjectId(projectId);
    SprintConvertDTO sprintConvertDTO = modelMapper.map(sprintMapper.selectOne(sprintDTO), SprintConvertDTO.class);
    setFilterSql(burnDownSearchVO);
    setSearchList(burnDownSearchVO);
    if (sprintConvertDTO != null && !sprintConvertDTO.getStatusCode().equals(SPRINT_PLANNING_CODE)) {
        sprintConvertDTO.initStartAndEndTime();
        switch(type) {
            case STORY_POINTS:
                queryStoryPointsOrRemainingEstimatedTime(sprintConvertDTO, reportIssueConvertDTOList, FIELD_STORY_POINTS, burnDownSearchVO);
                break;
            case REMAINING_ESTIMATED_TIME:
                queryStoryPointsOrRemainingEstimatedTime(sprintConvertDTO, reportIssueConvertDTOList, FIELD_TIMEESTIMATE, burnDownSearchVO);
                break;
            case ISSUE_COUNT:
                queryIssueCount(sprintConvertDTO, reportIssueConvertDTOList, burnDownSearchVO);
                break;
            default:
                queryStoryPointsOrRemainingEstimatedTime(sprintConvertDTO, reportIssueConvertDTOList, FIELD_STORY_POINTS, burnDownSearchVO);
                break;
        }
    } else {
        throw new CommonException(REPORT_SPRINT_ERROR);
    }
    return reportIssueConvertDTOList;
}
Also used : CommonException(io.choerodon.core.exception.CommonException) SprintConvertDTO(io.choerodon.agile.infra.dto.business.SprintConvertDTO)

Example 5 with SprintConvertDTO

use of io.choerodon.agile.infra.dto.business.SprintConvertDTO in project agile-service by open-hand.

the class SprintServiceImpl method completeSprint.

@Override
public Boolean completeSprint(Long projectId, SprintCompleteVO sprintCompleteVO) {
    if (!Objects.equals(projectId, sprintCompleteVO.getProjectId())) {
        throw new CommonException(NOT_EQUAL_ERROR);
    }
    sprintValidator.judgeCompleteSprint(projectId, sprintCompleteVO.getIncompleteIssuesDestination());
    SprintDTO sprintDTO = new SprintDTO();
    sprintDTO.setProjectId(projectId);
    sprintDTO.setSprintId(sprintCompleteVO.getSprintId());
    SprintConvertDTO sprintConvertDTO = sprintUpdateAssembler.toTarget(sprintMapper.selectOne(sprintDTO), SprintConvertDTO.class);
    sprintConvertDTO.completeSprint();
    update(sprintConvertDTO);
    moveNotDoneIssueToTargetSprint(projectId, sprintCompleteVO);
    return true;
}
Also used : CommonException(io.choerodon.core.exception.CommonException) SprintConvertDTO(io.choerodon.agile.infra.dto.business.SprintConvertDTO)

Aggregations

SprintConvertDTO (io.choerodon.agile.infra.dto.business.SprintConvertDTO)8 CommonException (io.choerodon.core.exception.CommonException)8 DateFormat (java.text.DateFormat)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1