Search in sources :

Example 1 with ProjectVO

use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.

the class ProjectCategory method isWaterfallProject.

public static boolean isWaterfallProject(Long projectId) {
    ProjectVO projectVO = ConvertUtil.queryProject(projectId);
    List<ProjectCategoryDTO> categories = projectVO.getCategories();
    if (CollectionUtils.isEmpty(categories)) {
        throw new CommonException(ERROR_CATEGORIES_IS_NULL);
    }
    Set<String> codes = categories.stream().map(ProjectCategoryDTO::getCode).collect(Collectors.toSet());
    return codes.contains(MODULE_WATERFALL) || codes.contains(MODULE_WATERFALL_AGILE);
}
Also used : ProjectCategoryDTO(io.choerodon.agile.infra.feign.vo.ProjectCategoryDTO) CommonException(io.choerodon.core.exception.CommonException) ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Example 2 with ProjectVO

use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.

the class ProjectCategory method getProjectApplyType.

public static List<String> getProjectApplyType(Long projectId) {
    ProjectVO projectVO = ConvertUtil.queryProject(projectId);
    if (CollectionUtils.isEmpty(projectVO.getCategories())) {
        throw new CommonException(ERROR_CATEGORIES_IS_NULL);
    }
    List<String> applyTypes = new ArrayList<>();
    Set<String> codes = projectVO.getCategories().stream().map(ProjectCategoryDTO::getCode).collect(Collectors.toSet());
    if (codes.contains(ProjectCategory.MODULE_PROGRAM)) {
        applyTypes.add(SchemeApplyType.PROGRAM);
    }
    if (codes.contains(ProjectCategory.MODULE_AGILE) || codes.contains(ProjectCategory.MODULE_WATERFALL_AGILE)) {
        applyTypes.add(SchemeApplyType.AGILE);
    }
    if (codes.contains(ProjectCategory.MODULE_WATERFALL)) {
        applyTypes.add(SchemeApplyType.WATERFALL);
    }
    return applyTypes;
}
Also used : ArrayList(java.util.ArrayList) CommonException(io.choerodon.core.exception.CommonException) ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Example 3 with ProjectVO

use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.

the class ProjectCategory method getProjectIssueTypeList.

public static String getProjectIssueTypeList(Long projectId) {
    ProjectVO projectVO = ConvertUtil.queryProject(projectId);
    if (CollectionUtils.isEmpty(projectVO.getCategories())) {
        throw new CommonException(ERROR_CATEGORIES_IS_NULL);
    }
    String issueTypeList = "agileIssueType";
    Set<String> codes = projectVO.getCategories().stream().map(ProjectCategoryDTO::getCode).collect(Collectors.toSet());
    if (codes.contains(ProjectCategory.MODULE_WATERFALL_AGILE)) {
        return "waterfallAgileIssueType";
    }
    if (codes.contains(ProjectCategory.MODULE_WATERFALL)) {
        return "waterfallIssueType";
    }
    return issueTypeList;
}
Also used : CommonException(io.choerodon.core.exception.CommonException) ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Example 4 with ProjectVO

use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.

the class FixDataServiceImpl method fixCreateProject.

@Override
public void fixCreateProject() {
    // 查询有问题的项目id列表
    List<Long> configProjectIds = projectConfigMapper.selectAll().stream().map(ProjectConfigDTO::getProjectId).collect(Collectors.toList());
    List<Long> projectIds = projectInfoMapper.selectAll().stream().map(ProjectInfoDTO::getProjectId).collect(Collectors.toList());
    projectIds.removeAll(configProjectIds);
    Collections.sort(projectIds, Comparator.reverseOrder());
    LOGGER.info("查询出有问题的项目共有{}个,开始修复数据", projectIds.size());
    int count = 0;
    for (Long projectId : projectIds) {
        ProjectVO project = baseFeignClient.queryProject(projectId).getBody();
        LOGGER.info("项目id:{},项目信息:{}", projectId, project);
        if (!project.getCode().equals("def-ops-proj") || !project.getCategory().equals(ProjectCategory.GENERAL) || !project.getCreatedBy().equals(0L)) {
            LOGGER.info("项目id:{},该项目不符合规定,跳过", projectId);
            continue;
        }
        singleFix(projectId, project);
        count++;
    }
    LOGGER.info("完成修复数据,共计修复项目{}个", count);
}
Also used : ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Example 5 with ProjectVO

use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.

the class FixDataServiceImpl method fixCreateProjectSingle.

@Override
public void fixCreateProjectSingle(Long projectId) {
    ProjectInfoDTO projectInfo = new ProjectInfoDTO();
    projectInfo.setProjectId(projectId);
    if (projectInfoMapper.select(projectInfo).isEmpty()) {
        LOGGER.info("项目id:{},该项目不符合规定,跳过", projectId);
        return;
    }
    ProjectConfigDTO projectConfig = new ProjectConfigDTO();
    projectConfig.setProjectId(projectId);
    if (!projectConfigMapper.select(projectConfig).isEmpty()) {
        LOGGER.info("项目id:{},该项目不符合规定,跳过", projectId);
        return;
    }
    ProjectVO project = baseFeignClient.queryProject(projectId).getBody();
    LOGGER.info("项目id:{},项目信息:{}", projectId, project);
    if (!project.getCode().equals("def-ops-proj") || !project.getCategory().equals(ProjectCategory.GENERAL) || !project.getCreatedBy().equals(0L)) {
        LOGGER.info("项目id:{},该项目不符合规定,跳过", projectId);
        return;
    }
    singleFix(projectId, project);
}
Also used : ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Aggregations

ProjectVO (io.choerodon.agile.api.vo.ProjectVO)31 Async (org.springframework.scheduling.annotation.Async)11 IssueVO (io.choerodon.agile.api.vo.business.IssueVO)7 CommonException (io.choerodon.core.exception.CommonException)6 MessageSender (org.hzero.boot.message.entity.MessageSender)6 ArrayList (java.util.ArrayList)4 UserMessageDTO (io.choerodon.agile.infra.dto.UserMessageDTO)3 BaseFeignClient (io.choerodon.agile.infra.feign.BaseFeignClient)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IssueTypeSearchVO (io.choerodon.agile.api.vo.IssueTypeSearchVO)1 IssueTypeVO (io.choerodon.agile.api.vo.IssueTypeVO)1 ProjectRelationshipVO (io.choerodon.agile.api.vo.ProjectRelationshipVO)1 StateMachineSchemeVO (io.choerodon.agile.api.vo.StateMachineSchemeVO)1 StatusMachineNodeVO (io.choerodon.agile.api.vo.StatusMachineNodeVO)1 StatusMachineSchemeConfigVO (io.choerodon.agile.api.vo.StatusMachineSchemeConfigVO)1 WorkItemSearchVO (io.choerodon.agile.api.vo.WorkItemSearchVO)1 WorkItemVO (io.choerodon.agile.api.vo.WorkItemVO)1 RuleLogRelVO (io.choerodon.agile.api.vo.business.RuleLogRelVO)1 ProjectEvent (io.choerodon.agile.api.vo.event.ProjectEvent)1