| | |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.mapper.DepartmentMapper; |
| | | import kr.wisestone.owl.mapper.IssueMapper; |
| | | import kr.wisestone.owl.mapper.IssueRelationMapper; |
| | | import kr.wisestone.owl.mapper.ProjectMapper; |
| | | import kr.wisestone.owl.repository.IssueRelationRepository; |
| | | import kr.wisestone.owl.repository.IssueRepository; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.messaging.simp.SimpMessagingTemplate; |
| | |
| | | |
| | | @Autowired |
| | | private WorkflowDepartmentRepository workflowDepartmentRepository; |
| | | |
| | | @Autowired |
| | | private IssueRelationMapper issueRelationMapper; |
| | | |
| | | @Override |
| | | protected JpaRepository<Issue, Long> getRepository() { |
| | |
| | | // 이슈 상세 정보를 조회한다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public void detailIssue(Map<String, Object> resJsonData, IssueCondition issueCondition) { |
| | | public void detailIssue(Map<String, Object> resJsonData, IssueCondition issueCondition, Pageable relPageable, Pageable downPageable) { |
| | | IssueVo issueVo = new IssueVo(); |
| | | |
| | | if (issueCondition.getId() != null) { |
| | | Issue issue = this.getIssue(issueCondition.getId()); |
| | | issueVo = ConvertUtil.copyProperties(issue, IssueVo.class); |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | |
| | | issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); |
| | | issueVo.setRelPageSize(relPageable.getPageSize()); |
| | | |
| | | issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); |
| | | issueVo.setDownPageSize(downPageable.getPageSize()); |
| | | |
| | | switch (issueCondition.getDeep()) { |
| | | case "01": // 프로젝트, 이슈 유형, 이슈 상태, 우선순위, 중요도, 담당부서, 첨부파일, 사용자 정의 필드 정보를 셋팅한다. |
| | |
| | | this.setIssueCustomFields(issue, issueVo); // 사용자 정의 필드 값 정보 셋팅 |
| | | this.setRelationIssue(issue, issueVo); //연관 일감 셋팅 |
| | | this.setDownIssues(issue, issueVo); //하위 이슈 세팅 |
| | | |
| | | break; |
| | | |
| | | case "02": // 프로젝트, 이슈 유형, 이슈 상태, 우선순위, 중요도, 담당자, 첨부파일, 사용자 정의 필드 정보, 댓글, 기록을 셋팅한다. |
| | |
| | | break; |
| | | } |
| | | } |
| | | Long relTotalCount = issueVo.getRelTotalCount(); |
| | | int relTotalPage = issueVo.getRelTotalPage(); |
| | | |
| | | Long downTotalCount = issueVo.getDownTotalCount(); |
| | | int downTotalPage = issueVo.getDownTotalPage(); |
| | | // 사용자 시스템 기능 사용 정보 수집 |
| | | log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(this.webAppUtil.getLoginUser(), ElasticSearchConstants.ISSUE_DETAIL)); |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, issueVo); |
| | | resJsonData.put(Constants.REQ_KEY_RELATION_ISSUE_PAGE_VO, new ResPage(relPageable.getPageNumber(), relPageable.getPageSize(), |
| | | relTotalPage, relTotalCount)); |
| | | resJsonData.put(Constants.REQ_KEY_DOWN_ISSUE_PAGE_VO, new ResPage(downPageable.getPageNumber(), downPageable.getPageSize(), |
| | | downTotalPage, downTotalCount)); |
| | | } |
| | | |
| | | // 테이블 설정 셋팅 |
| | |
| | | |
| | | // 하위 이슈 정보를 셋팅한다 |
| | | private void setDownIssues(Issue issue, IssueVo issueVo) { |
| | | List<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId()); |
| | | if(downIssues != null && downIssues.size()>0){ |
| | | //List<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId()); |
| | | int startPage = (int) Math.floor(issueVo.getDownPage()/issueVo.getDownPageSize()); |
| | | Pageable pageable = PageRequest.of(startPage, issueVo.getDownPageSize()); |
| | | Page<Issue> downIssues = this.issueRepository.findByParentIssueId(issue.getId(), pageable); |
| | | issueVo.setDownTotalPage(downIssues.getTotalPages()); |
| | | issueVo.setDownTotalCount(downIssues.getTotalElements()); |
| | | if(downIssues != null){ |
| | | List<IssueVo> resultList = new ArrayList<>(); |
| | | for(Issue downIssue : downIssues){ |
| | | IssueVo downIssueVo = ConvertUtil.copyProperties(downIssue, IssueVo.class); |
| | |
| | | |
| | | // 연관 이슈 정보를 셋팅한다 |
| | | private void setRelationIssue(Issue issue, IssueVo issueVo) { |
| | | Set<IssueRelation> issueRelations = issue.getIssueRelations(); |
| | | if (issue != null && issueVo != null && issueRelations.size() > 0) { |
| | | for (IssueRelation issueRelation : issueRelations) { |
| | | IssueRelationVo issueRelationVo = ConvertUtil.copyProperties(issueRelation, IssueRelationVo.class); |
| | | //Set<IssueRelation> issueRelations = issue.getIssueRelations(); |
| | | List<Map<String, Object>> results = this.issueRelationMapper.findByIssueId(issueVo); |
| | | Long totalCount = this.issueRelationMapper.count(issueVo); |
| | | |
| | | Issue relationIssue = issueRelation.getRelationIssue(); |
| | | int totalPage = (int) Math.ceil((totalCount - 1) / issueVo.getRelPageSize()) + 1; |
| | | issueVo.setRelTotalPage(totalPage); |
| | | issueVo.setRelTotalCount(totalCount); |
| | | |
| | | if (issue != null && issueVo != null && results.size() > 0) { |
| | | for (Map<String, Object> result : results) { |
| | | IssueRelationVo issueRelationVo = ConvertUtil.convertMapToClass(result, IssueRelationVo.class); |
| | | Issue relationIssue = this.findOne(issueRelationVo.getId()); |
| | | IssueVo relIssueVo = ConvertUtil.copyProperties(relationIssue, IssueVo.class); |
| | | Project project = this.projectService.getProject(relationIssue.getProject().getId()); |
| | | relIssueVo.setProjectId(project.getId()); |