Search in sources :

Example 1 with WikiRelationDTO

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

the class WikiRelationServiceImpl method checkRepeat.

private Boolean checkRepeat(WikiRelationDTO wikiRelationDTO) {
    WikiRelationDTO wikiRelation = new WikiRelationDTO();
    wikiRelation.setProjectId(wikiRelationDTO.getProjectId());
    wikiRelation.setIssueId(wikiRelationDTO.getIssueId());
    wikiRelation.setSpaceId(wikiRelationDTO.getSpaceId());
    WikiRelationDTO res = wikiRelationMapper.selectOne(wikiRelation);
    return res != null;
}
Also used : WikiRelationDTO(io.choerodon.agile.infra.dto.WikiRelationDTO)

Example 2 with WikiRelationDTO

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

the class WikiRelationServiceImpl method deleteByWorkSpaceId.

@Override
public void deleteByWorkSpaceId(Long projectId, Long workSpaceId) {
    WikiRelationDTO wikiRelationDTO = new WikiRelationDTO();
    wikiRelationDTO.setSpaceId(workSpaceId);
    List<WikiRelationDTO> wikiRelationDTOS = wikiRelationMapper.select(wikiRelationDTO);
    if (!CollectionUtils.isEmpty(wikiRelationDTOS)) {
        wikiRelationDTOS.forEach(v -> iWikiRelationService.deleteBase(wikiRelationDTO));
    }
}
Also used : WikiRelationDTO(io.choerodon.agile.infra.dto.WikiRelationDTO)

Example 3 with WikiRelationDTO

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

the class WikiRelationServiceImpl method deleteById.

@Override
public void deleteById(Long projectId, Long id) {
    WikiRelationDTO wikiRelationDTO = new WikiRelationDTO();
    wikiRelationDTO.setProjectId(projectId);
    wikiRelationDTO.setId(id);
    iWikiRelationService.deleteBase(wikiRelationDTO);
    BaseFieldUtil.updateIssueLastUpdateInfo(wikiRelationDTO.getIssueId(), projectId);
}
Also used : WikiRelationDTO(io.choerodon.agile.infra.dto.WikiRelationDTO)

Example 4 with WikiRelationDTO

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

the class WikiRelationServiceImpl method queryByIssueId.

@Override
public KnowledgeRelationVO queryByIssueId(Long projectId, Long issueId) {
    WikiRelationDTO wikiRelationDTO = new WikiRelationDTO();
    wikiRelationDTO.setIssueId(issueId);
    List<WikiRelationDTO> wikiRelationDTOList = wikiRelationMapper.select(wikiRelationDTO);
    List<WikiRelationVO> result = new ArrayList<>();
    if (wikiRelationDTOList != null && !wikiRelationDTOList.isEmpty()) {
        List<Long> spaceIds = wikiRelationDTOList.stream().map(WikiRelationDTO::getSpaceId).collect(Collectors.toList());
        Map<Long, WorkSpaceVO> workSpaceMap = new HashMap<>();
        workSpaceMap.putAll(knowledgebaseClientOperator.querySpaceByIds(projectId, spaceIds).stream().collect(Collectors.toMap(WorkSpaceVO::getId, Function.identity())));
        for (WikiRelationDTO wikiRelation : wikiRelationDTOList) {
            WorkSpaceVO workSpaceVO = workSpaceMap.get(wikiRelation.getSpaceId());
            if (!ObjectUtils.isEmpty(workSpaceVO)) {
                WikiRelationVO wikiRelationVO = new WikiRelationVO();
                BeanUtils.copyProperties(wikiRelation, wikiRelationVO);
                wikiRelationVO.setWorkSpaceVO(workSpaceVO);
                result.add(wikiRelationVO);
            }
        }
    }
    KnowledgeRelationVO knowledgeRelation = new KnowledgeRelationVO();
    knowledgeRelation.setKnowledgeRelationList(result);
    return knowledgeRelation;
}
Also used : KnowledgeRelationVO(io.choerodon.agile.api.vo.KnowledgeRelationVO) HashMap(java.util.HashMap) WikiRelationDTO(io.choerodon.agile.infra.dto.WikiRelationDTO) ArrayList(java.util.ArrayList) WikiRelationVO(io.choerodon.agile.api.vo.WikiRelationVO) WorkSpaceVO(io.choerodon.agile.api.vo.WorkSpaceVO)

Example 5 with WikiRelationDTO

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

the class WikiRelationServiceImpl method create.

@Override
public void create(Long projectId, List<WikiRelationVO> wikiRelationVOList) {
    List<WikiRelationDTO> wikiRelationDTOList = modelMapper.map(wikiRelationVOList, new TypeToken<List<WikiRelationDTO>>() {
    }.getType());
    if (wikiRelationDTOList != null && !wikiRelationDTOList.isEmpty()) {
        for (WikiRelationDTO wikiRelationDTO : wikiRelationDTOList) {
            if (!checkRepeat(wikiRelationDTO)) {
                iWikiRelationService.createBase(wikiRelationDTO);
                BaseFieldUtil.updateIssueLastUpdateInfo(wikiRelationDTO.getIssueId(), wikiRelationDTO.getProjectId());
            }
        }
    }
}
Also used : TypeToken(org.modelmapper.TypeToken) WikiRelationDTO(io.choerodon.agile.infra.dto.WikiRelationDTO)

Aggregations

WikiRelationDTO (io.choerodon.agile.infra.dto.WikiRelationDTO)5 KnowledgeRelationVO (io.choerodon.agile.api.vo.KnowledgeRelationVO)1 WikiRelationVO (io.choerodon.agile.api.vo.WikiRelationVO)1 WorkSpaceVO (io.choerodon.agile.api.vo.WorkSpaceVO)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TypeToken (org.modelmapper.TypeToken)1