| | |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public List<IssueVo> findIssue(Map<String, Object> resJsonData, IssueCondition issueCondition, Pageable pageable) { |
| | | |
| | | // 검색 조건을 만든다 |
| | | if (!this.makeIssueSearchCondition(issueCondition, Lists.newArrayList("01", "02", "03"), pageable)) { |
| | | // 이슈 목록을 찾지 못할 경우 기본 정보로 리턴한다. |
| | |
| | | Long totalCount = 0L; |
| | | UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); |
| | | |
| | | if (this.userWorkspaceService.checkWorkspaceManager(user) |
| | | || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { |
| | | this.SetAllDepartmentId(issueCondition); |
| | | } else{ |
| | | this.SetMyDepartmentId(issueCondition); |
| | | /*results = this.issueMapper.findByDepartment(issueCondition); |
| | | totalCount = this.issueMapper.countByDepartment(issueCondition);*/ |
| | | } |
| | | // if (!this.userWorkspaceService.checkWorkspaceManager(user) |
| | | // && !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { //최고관리자 & 프로젝트,이슈 관리자 일 경우 모든 이슈 보기 |
| | | // this.SetMyDepartmentId(issueCondition); |
| | | //this.SetAllDepartmentId(issueCondition); |
| | | // } /*else{ |
| | | // results = this.issueMapper.findByDepartment(issueCondition); |
| | | // totalCount = this.issueMapper.countByDepartment(issueCondition); |
| | | // }*/ |
| | | results = this.issueMapper.find(issueCondition); |
| | | totalCount = this.issueMapper.count(issueCondition); |
| | | |
| | |
| | | condition.setLoginUserId(this.webAppUtil.getLoginId()); |
| | | condition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); |
| | | |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); |
| | | |
| | | // 프로젝트 키가 존재할 경우 프로젝트 키에 해당하는 프로젝트를 조회하고 검색 조건에 셋팅한다. |
| | | if (!this.getProjectByProjectKey(condition.getProjectKey(), condition)) { |
| | | return false; |
| | |
| | | |
| | | // 프로젝트를 선택하지 않았으면 해당 업무 공간에서 참여하고 있는 프로젝트를 찾는다. |
| | | if (condition.getProjectIds().size() < 1) { |
| | | List<Map<String, Object>> projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectStatues, condition.getProjectType()); |
| | | List<Long> projectIds = Lists.newArrayList(); |
| | | List<Map<String, Object>> projects = Lists.newArrayList(); |
| | | if (this.userWorkspaceService.checkWorkspaceManager(user) || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)){ |
| | | return true; |
| | | }/*else if (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)){ |
| | | projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectStatues, condition.getProjectType()); |
| | | }*/ |
| | | else { |
| | | projects = this.projectService.findByWorkspaceIdAndIncludeProject(projectStatues, condition.getProjectType()); |
| | | } |
| | | |
| | | List<Long> projectIds = Lists.newArrayList(); |
| | | for (Map<String, Object> result : projects) { |
| | | Long projectId = MapUtil.getLong(result, "id"); |
| | | |
| | |
| | | List<Map<String, Object>> projects = null; |
| | | UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); |
| | | if (this.userWorkspaceService.checkWorkspaceManager(user) |
| | | || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { |
| | | || (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT) && |
| | | MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE))) { |
| | | projects = this.projectMapper.findByWorkspaceManagerAll(projectCondition); |
| | | } else { |
| | | projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectCondition); |
| | |
| | | String comma = ","; |
| | | |
| | | if (issueCustomFieldValueForms.size() > 0) { |
| | | IssueCustomFieldValueFormComparator comp = new IssueCustomFieldValueFormComparator(); |
| | | Collections.sort(issueCustomFieldValueForms, comp); |
| | | |
| | | String concatUseValue = ""; |
| | | for (int i = 0; i < issueCustomFieldValueForms.size(); i++) { |
| | | IssueCustomFieldValueForm issueCustomFieldValueForm = issueCustomFieldValueForms.get(i); |
| | |
| | | List<Issue> issues = Lists.newArrayList(); |
| | | for (Issue issueVo : issue) { |
| | | issueForm.setId(issueVo.getId()); |
| | | issueForm.setTitle(issueVo.getTitle()); |
| | | |
| | | // 자동 종료 상태 설정이 되어 있지 않으면 오류발생 |
| | | Issue modifyIssue = this.modifyIssueForApi(user, issueForm, files); |
| | | Issue parentIssue = modifyIssue.getParentIssue(); |
| | | IssueType issueType = modifyIssue.getIssueType(); |
| | | IssueStatus issueStatus = issueType.getIssueStatus(); |
| | | |
| | | Set<IssueTypeApiEndStatus> issueTypeApiEndStatuses = issueType.getIssueTypeApiEndStatuses(); |
| | | IssueTypeApiEndStatus issueStatus = null; |
| | | if (issueTypeApiEndStatuses != null && issueTypeApiEndStatuses.size() > 0) { |
| | | issueStatus = issueTypeApiEndStatuses.iterator().next(); |
| | | } else { |
| | | 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); |
| | | // 하위 일감이 모두 종료 상태일때 상위 일감도 종료 처리 |
| | | if (results == null || results.size() == 0) { |
| | | parentIssue.setIssueStatus(issueType.getIssueStatus()); |
| | | parentIssue.setIssueStatus(issueStatus.getIssueStatus()); |
| | | this.issueRepository.saveAndFlush(parentIssue); |
| | | } |
| | | } |
| | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void findReadyDepartments(Map<String, Object> resJsonData, DepartmentCondition condition, Pageable pageable) { |
| | | IssueType issueType = this.issueTypeService.getIssueType(condition.getIssueTypeId()); |
| | | if (issueType != null) { |
| | | // 이슈 상태 유형이 '대기' 인 이슈 상태 가져오기 |
| | | IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(issueType.getWorkflow()); |
| | | condition.setIssueStatusId(issueStatus.getId()); |
| | | condition.setWorkflowId(issueType.getWorkflow().getId()); |
| | | } |
| | | List<Map<String, Object>> departmentVos = this.departmentMapper.findByIssueStatusId(condition); |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, departmentVos); |
| | | } |
| | | } |