| | |
| | | import kr.wisestone.owl.domain.enumType.IssueHistoryType; |
| | | import kr.wisestone.owl.domain.enumType.IssueStatusType; |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.mapper.DepartmentMapper; |
| | | import kr.wisestone.owl.mapper.IssueMapper; |
| | | import kr.wisestone.owl.mapper.ProjectMapper; |
| | | import kr.wisestone.owl.repository.IssueRelationRepository; |
| | |
| | | private UserDepartmentRepository userDepartmentRepository; |
| | | |
| | | @Autowired |
| | | private DepartmentMapper departmentMapper; |
| | | |
| | | @Autowired |
| | | private WorkflowDepartmentRepository workflowDepartmentRepository; |
| | | |
| | | @Override |
| | |
| | | |
| | | // 상위일감에 사용할 중복값 설정 |
| | | List<CustomFieldApiOverlap> customFieldApiOverlaps = this.customFieldApiOverlapService.find(user.getId(), issueApiForm.getIssueTypeId()); |
| | | if (customFieldApiOverlaps == null || customFieldApiOverlaps.size() == 0){ |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_OVERLAP_SETTING_NOT_EXIST)); |
| | | } |
| | | for(int i=0; i < customFieldApiOverlaps.size() ; i++ ){ |
| | | CustomFieldApiOverlap customFieldApiOverlap = customFieldApiOverlaps.get(i); |
| | | issueApiForm.addUseIssueCustomFieldId(customFieldApiOverlap.getCustomField().getId()); |
| | | } |
| | | // if (customFieldApiOverlaps == null || customFieldApiOverlaps.size() == 0){ |
| | | // throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_OVERLAP_SETTING_NOT_EXIST)); |
| | | // } |
| | | if (customFieldApiOverlaps != null && customFieldApiOverlaps.size() > 0) { |
| | | for (int i = 0; i < customFieldApiOverlaps.size(); i++) { |
| | | CustomFieldApiOverlap customFieldApiOverlap = customFieldApiOverlaps.get(i); |
| | | issueApiForm.addUseIssueCustomFieldId(customFieldApiOverlap.getCustomField().getId()); |
| | | } |
| | | |
| | | // 중복된 이슈검색 |
| | | List<Issue> issues = this.findIssue(issueApiForm, customFieldApiOverlaps, user.getId()); |
| | | int size = issues.size(); |
| | | if (size > 0) { |
| | | Issue targetIssue = issues.get(0); |
| | | if (targetIssue.getParentIssue() != null) { |
| | | issueForm.setParentIssueId(targetIssue.getParentIssue().getId()); |
| | | } else { |
| | | issueForm.setParentIssueId(targetIssue.getId()); |
| | | // 중복된 이슈검색 |
| | | List<Issue> issues = this.findIssue(issueApiForm, customFieldApiOverlaps, user.getId()); |
| | | int size = issues.size(); |
| | | if (size > 0) { |
| | | Issue targetIssue = issues.get(0); |
| | | if (targetIssue.getParentIssue() != null) { |
| | | issueForm.setParentIssueId(targetIssue.getParentIssue().getId()); |
| | | } else { |
| | | issueForm.setParentIssueId(targetIssue.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | for(UserDepartment myDepartment : myDepartments){ |
| | | myDepartmentIds.add(myDepartment.getDepartmentId()); |
| | | } |
| | | } else { |
| | | myDepartmentIds.add(-1L); |
| | | } |
| | | issueCondition.setMyDepartmentIds(myDepartmentIds); |
| | | } |
| | | |
| | | void SetAllDepartmentId(IssueCondition issueCondition){ |
| | | List<Long> departmentIds = Lists.newArrayList(); |
| | | List<Map<String, Object>> departmentList = this.departmentMapper.find(null); |
| | | |
| | | if(departmentList != null && departmentList.size() > 0){ |
| | | for(Map<String, Object> department : departmentList){ |
| | | departmentIds.add((Long) department.get("id")); |
| | | } |
| | | } |
| | | issueCondition.setMyDepartmentIds(departmentIds); |
| | | } |
| | | |
| | | void SetWorkflowDepartment(List<IssueVo> issueVos){ |
| | |
| | | |
| | | if (this.userWorkspaceService.checkWorkspaceManager(user) |
| | | || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE_PROJECT_ALL)) { |
| | | results = this.issueMapper.find(issueCondition); |
| | | totalCount = this.issueMapper.count(issueCondition); |
| | | this.SetAllDepartmentId(issueCondition); |
| | | } else{ |
| | | this.SetMyDepartmentId(issueCondition); |
| | | results = this.issueMapper.findByDepartment(issueCondition); |
| | | totalCount = this.issueMapper.countByDepartment(issueCondition); |
| | | /*results = this.issueMapper.findByDepartment(issueCondition); |
| | | totalCount = this.issueMapper.countByDepartment(issueCondition);*/ |
| | | } |
| | | results = this.issueMapper.find(issueCondition); |
| | | totalCount = this.issueMapper.count(issueCondition); |
| | | |
| | | |
| | | // 튜닝 전 - 0.8, 0.9, 0.9, 0.9, 0.9 |
| | |
| | | this.setMapToIssueVo(results, issueVos, issueCondition, user); |
| | | |
| | | if (issueCondition.getTree()) { |
| | | this.setParentIssue(issueVos); |
| | | this.setDownIssues(user, issueVos); |
| | | this.setRelationIssues(issueVos); |
| | | } |
| | |
| | | IssueVo addIssueVo = ConvertUtil.copyProperties(downIssue, IssueVo.class); |
| | | addIssueVo.setIssueTypeId(downIssue.getIssueType().getId()); |
| | | downIssueVos.add(addIssueVo); |
| | | |
| | | } |
| | | issueVo.setIssueDownVos(downIssueVos); |
| | | |
| | | if (downIssueVos.size() > 0) { |
| | | this.setDownIssues(user, downIssueVos); |
| | | } |
| | |
| | | this.setIssueDepartmentList(issueVos, issueCondition, user); |
| | | // 등록자 정보 추가 |
| | | this.setRegister(issueVos); // 담당자 정보 셋팅 |
| | | |
| | | // 사용자 정의 필드 정보 추가 |
| | | this.setIssueCustomFieldValue(issueVos, issueCondition); |
| | | |
| | | this.SetWorkflowDepartment(issueVos); //워크플로우에 설정한 담당부서 가져오기 |
| | | //워크플로우에 설정한 담당부서 가져오기 |
| | | this.SetWorkflowDepartment(issueVos); |
| | | } |
| | | } |
| | | |
| | |
| | | List<IssueVo> relationIssues = this.issueRelationService.findRelationIssue(issueVo.getId()); |
| | | for(IssueVo relationIssue : relationIssues){ |
| | | issueVo.addRelationIssueVo(ConvertUtil.copyProperties(relationIssue, IssueVo.class)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 상위 이슈 체크 |
| | | private void setParentIssue(List<IssueVo> issueVos) { |
| | | for(IssueVo issueVo : issueVos) { |
| | | if(issueVo.getParentIssueId() != null) { |
| | | Issue parentIssue = this.getIssue(issueVo.getParentIssueId()); |
| | | //issueVo.setParentIssueVo(ConvertUtil.copyProperties(parentIssue, IssueVo.class)); |
| | | if(parentIssue.getIssueCustomFieldValues() == null || parentIssue.getIssueCustomFieldValues().size() == 0){ |
| | | issueVo.setIssueCustomFieldValueVos(null); |
| | | } |
| | | ConvertUtil.copyProperties(parentIssue, issueVo); |
| | | } |
| | | } |
| | | } |
| | |
| | | Issue parentIssue = modifyIssue.getParentIssue(); |
| | | IssueType issueType = modifyIssue.getIssueType(); |
| | | IssueStatus issueStatus = issueType.getIssueStatus(); |
| | | if (issueStatus == null) { |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST)); |
| | | } |
| | | |
| | | if (parentIssue != null) { |
| | | if (issueStatus == null) { |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST)); |
| | | } |
| | | IssueCondition issueCondition = new IssueCondition(issueVo.getId(), parentIssue.getId()); |
| | | List<Map<String, Object>> results = this.issueMapper.findNotCompleteByParentIssueId(issueCondition); |
| | | // 하위 일감이 모두 종료 상태일때 상위 일감도 종료 처리 |