| | |
| | | import kr.wisestone.owl.domain.enumType.EmailType; |
| | | import kr.wisestone.owl.domain.enumType.IssueHistoryType; |
| | | import kr.wisestone.owl.domain.enumType.IssueStatusType; |
| | | import kr.wisestone.owl.exception.ApiAuthException; |
| | | import kr.wisestone.owl.exception.ApiParameterException; |
| | | 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 kr.wisestone.owl.repository.UserDepartmentRepository; |
| | | import kr.wisestone.owl.repository.WorkflowDepartmentRepository; |
| | | import kr.wisestone.owl.repository.*; |
| | | import kr.wisestone.owl.service.*; |
| | | import kr.wisestone.owl.util.*; |
| | | import kr.wisestone.owl.util.DateUtil; |
| | |
| | | |
| | | @Autowired |
| | | private CompanyFieldService companyFieldService; |
| | | |
| | | @Autowired |
| | | private CompanyFieldCategoryService companyFieldCategoryService; |
| | | |
| | | @Autowired |
| | | private IspFieldService ispFieldService; |
| | |
| | | private IssueMapper issueMapper; |
| | | |
| | | @Autowired |
| | | private IssueCompanyRepository issueCompanyRepository; |
| | | |
| | | @Autowired |
| | | private IssueIspRepository issueIspRepository; |
| | | |
| | | @Autowired |
| | | private IssueHostingRepository issueHostingRepository; |
| | | |
| | | @Autowired |
| | | private ExcelConditionCheck excelConditionCheck; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private IssueRelationMapper issueRelationMapper; |
| | | |
| | | @Autowired |
| | | private WorkflowTransitionService workflowTransitionService; |
| | | |
| | | @Override |
| | | protected JpaRepository<Issue, Long> getRepository() { |
| | |
| | | |
| | | private IssueForm convertToIssueForm(IssueApiForm issueApiForm, User user) { |
| | | if (issueApiForm.getIssueTypeId() == null) { |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); |
| | | } |
| | | |
| | | IssueForm issueForm = ConvertUtil.copyProperties(issueApiForm, IssueForm.class); |
| | | // issueForm.setFiles(issueApiForm.getFiles()); |
| | | IssueType issueType = this.issueTypeService.getIssueType(issueApiForm.getIssueTypeId()); |
| | | if (issueType == null){ |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ISSUE_TYPE_ERROR)); |
| | | } |
| | | |
| | | Workflow workflow = issueType.getWorkflow(); |
| | |
| | | } |
| | | } |
| | | } else if (issueApiForm.getIssueStatusId() == null){ |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST)); |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST)); |
| | | } else if (!this.workflowTransitionService.contains(issueApiForm.getIssueStatusId(), workflow.getId())) { |
| | | //이슈 상태 유효성 확인 |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST_IN_WORKFLOW)); |
| | | } |
| | | |
| | | // 프로젝트 입력 |
| | | Project project = issueType.getProject(); |
| | | if (project == null){ |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_PROJECT_ERROR)); |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_PROJECT_ERROR)); |
| | | } |
| | | issueForm.setProjectId(project.getId()); |
| | | |
| | |
| | | return issueForm; |
| | | |
| | | } else { |
| | | throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); |
| | | throw new ApiAuthException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); |
| | | } |
| | | } |
| | | |
| | |
| | | List<Map<String, Object>> issueHostingFields = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> issueCustomField : issueForm.getIssueCustomFields()) { |
| | | int customFieldId = (Integer) issueCustomField.get("customFieldId"); |
| | | Long customId = (long) customFieldId; |
| | | CustomField customField = this.customFieldService.getCustomField(customId); |
| | | Long customFieldId = MapUtil.getLong(issueCustomField, "customFieldId"); |
| | | CustomField customField = this.customFieldService.getCustomField(customFieldId); |
| | | if(customField != null && customField.getCustomFieldType().toString().equals("SITE") && customField.getName().equals("도메인")) { |
| | | String useValue = issueCustomField.get("useValue").toString(); |
| | | if(companyFields != null && companyFields.size() > 0) { |
| | |
| | | issueForm.setIssueHostingFields(issueHostingFields); |
| | | } |
| | | } |
| | | |
| | | return issueForm; |
| | | } |
| | | |
| | |
| | | return Lists.newArrayList(); |
| | | } |
| | | |
| | | // 튜닝 전 - 1.3 / 1.2 / 1.1 |
| | | // 튜닝 후 (단일/다중 검색 조건 3개 기준) - 0.49 / 0.41 / 0.47 / 0.41 |
| | | |
| | | List<IssueVo> issueVos = Lists.newArrayList(); // 이슈 목록 데이터 저장 컬렉션 |
| | | // 사용자 정의 필드로 검색한 이슈 아이디 값 |
| | | List<String> issueKeys = Lists.newArrayList(issueIds); |
| | | issueCondition.setIssueIds(issueKeys); |
| | | |
| | | issueCondition.setLoginUserId(this.webAppUtil.getLoginId()); |
| | | issueCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | |
| | | issueCondition.setLoginUserId(user.getId()); |
| | | issueCondition.setWorkspaceId(user.getLastWorkspaceId()); |
| | | |
| | | |
| | | List<Map<String, Object>> results = Lists.newArrayList(); |
| | | Long totalCount = 0L; |
| | | UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); |
| | | // UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); |
| | | |
| | | // if (!this.userWorkspaceService.checkWorkspaceManager(user) |
| | | // && !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { //최고관리자 & 프로젝트,이슈 관리자 일 경우 모든 이슈 보기 |
| | |
| | | // results = this.issueMapper.findByDepartment(issueCondition); |
| | | // totalCount = this.issueMapper.countByDepartment(issueCondition); |
| | | // }*/ |
| | | // StopWatch serviceStart = new StopWatch(); |
| | | // serviceStart.start(); |
| | | results = this.issueMapper.find(issueCondition); |
| | | // serviceStart.stop(); |
| | | // log.error("result : " + serviceStart.toString()); |
| | | |
| | | // serviceStart = new StopWatch(); |
| | | // serviceStart.start(); |
| | | totalCount = this.issueMapper.count(issueCondition); |
| | | |
| | | |
| | | // 튜닝 전 - 0.8, 0.9, 0.9, 0.9, 0.9 |
| | | /*StopWatch serviceStart = new StopWatch(); |
| | | serviceStart.start();*/ |
| | | // 튜닝 전 - 1.1, 1.1, 1.3, 1.2 |
| | | |
| | | /*serviceStart.stop(); |
| | | log.debug("serviceENd1 : " + serviceStart.getTime());*/ |
| | | // serviceStart.stop(); |
| | | // log.error("totalCount : " + serviceStart.toString()); |
| | | |
| | | int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1; |
| | | // 이슈 아이디 초기화 |
| | |
| | | this.setDownIssues(user, issueVos); |
| | | this.setRelationIssues(issueVos); |
| | | } |
| | | this.setCountDownIssues(issueVos); |
| | | |
| | | this.setCountDownIssues(issueVos); |
| | | this.SetWorkflowDepartment(issueVos); //워크플로우에 설정한 담당부서 가져오기 |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, issueVos); |
| | |
| | | issueVo = ConvertUtil.copyProperties(issue, IssueVo.class); |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | |
| | | |
| | | issueVo.setRelPageNumber(relPageable.getPageNumber()); |
| | | issueVo.setRelPageSize(relPageable.getPageSize()); |
| | | issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); |
| | | |
| | | issueVo.setDownPageNumber(downPageable.getPageNumber()); |
| | | issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); |
| | | issueVo.setDownPageSize(downPageable.getPageSize()); |
| | | if (relPageable != null) { |
| | | issueVo.setRelPageNumber(relPageable.getPageNumber()); |
| | | issueVo.setRelPageSize(relPageable.getPageSize()); |
| | | issueVo.setRelPage(relPageable.getPageNumber() * relPageable.getPageSize()); |
| | | } |
| | | if (downPageable != null) { |
| | | issueVo.setDownPageNumber(downPageable.getPageNumber()); |
| | | issueVo.setDownPage(downPageable.getPageNumber() * downPageable.getPageSize()); |
| | | issueVo.setDownPageSize(downPageable.getPageSize()); |
| | | } |
| | | |
| | | switch (issueCondition.getDeep()) { |
| | | case "01": // 프로젝트, 이슈 유형, 이슈 상태, 우선순위, 중요도, 담당부서, 첨부파일, 사용자 정의 필드 정보를 셋팅한다. |
| | |
| | | |
| | | case "02": // 프로젝트, 이슈 유형, 이슈 상태, 우선순위, 중요도, 담당자, 첨부파일, 사용자 정의 필드 정보, 댓글, 기록을 셋팅한다. |
| | | this.setIssueDetail(issueVo, issue, user); // 이슈 상세 정보를 셋팅한다. |
| | | this.setIssueTableConfigs(issue, issueVo); |
| | | this.setIssueTableConfigs(issue, issueVo, issueCondition); |
| | | issueVo.setProjectVo(ConvertUtil.copyProperties(issue.getProject(), ProjectVo.class)); |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | // 테이블 설정 셋팅 |
| | | private void setIssueTableConfigs(Issue issue, IssueVo issueVo) { |
| | | Long IssueTypeId = issue.getIssueType().getId(); |
| | | private void setIssueTableConfigs(Issue issue, IssueVo issueVo, IssueCondition issueCondition) { |
| | | //Long IssueTypeId = issue.getIssueType().getId(); |
| | | Long IssueTypeId = issueCondition.getIssueTypeId(); |
| | | |
| | | for (int tableConfigType : IssueTableConfig.IssueTableTypes) { |
| | | if (tableConfigType != IssueTableConfig.ISSUE_TABLE_TYPE_MAIN) { |
| | |
| | | |
| | | // 하위 이슈 정보를 셋팅한다 |
| | | private void setDownIssues(Issue issue, IssueVo issueVo) { |
| | | //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()); |
| | | Page<Issue> downIssues = null; |
| | | |
| | | List<Issue> downIssueList = this.issueRepository.findByParentIssueId(issue.getId()); |
| | | if(downIssueList != null && downIssueList.size() > 0) { |
| | | int startPage = 0; |
| | | if (issueVo.getDownPage() != 0) { |
| | | startPage = (int) Math.floor(issueVo.getDownPage()/issueVo.getDownPageSize()); |
| | | } |
| | | Pageable pageable = PageRequest.of(startPage, issueVo.getDownPageSize()); |
| | | downIssues = this.issueRepository.findByParentIssueId(issue.getId(), pageable); |
| | | } |
| | | if(downIssues != null){ |
| | | issueVo.setDownTotalPage(downIssues.getTotalPages()); |
| | | issueVo.setDownTotalCount(downIssues.getTotalElements()); |
| | | |
| | | 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(); |
| | | |
| | | List<Map<String, Object>> results = this.issueRelationMapper.findByIssueId(issueVo); |
| | | Long totalCount = this.issueRelationMapper.count(issueVo); |
| | | |
| | | int totalPage = (int) Math.ceil((totalCount - 1) / issueVo.getRelPageSize()) + 1; |
| | | issueVo.setRelTotalPage(totalPage); |
| | | issueVo.setRelTotalCount(totalCount); |
| | | |
| | | if (issue != null && issueVo != null && results.size() > 0) { |
| | | int totalPage = (int) Math.ceil((totalCount - 1) / issueVo.getRelPageSize()) + 1; |
| | | issueVo.setRelTotalPage(totalPage); |
| | | issueVo.setRelTotalCount(totalCount); |
| | | for (Map<String, Object> result : results) { |
| | | IssueRelationVo issueRelationVo = ConvertUtil.convertMapToClass(result, IssueRelationVo.class); |
| | | Issue relationIssue = this.findOne(issueRelationVo.getId()); |
| | | Issue relationIssue = this.findOne(MapUtil.getLong(result, "relationIssueId")); |
| | | IssueVo relIssueVo = ConvertUtil.copyProperties(relationIssue, IssueVo.class); |
| | | Project project = this.projectService.getProject(relationIssue.getProject().getId()); |
| | | relIssueVo.setProjectId(project.getId()); |
| | |
| | | CompanyField companyField = issueCompany.getCompanyField(); |
| | | if (companyField != null) { |
| | | issueCompanyVo.setCompanyId(issueCompany.getCompanyField().getId()); |
| | | if (issueCompany.getCompanyTypeId() != null) { |
| | | CompanyFieldCategory companyType = this.companyFieldCategoryService.find(issueCompany.getCompanyTypeId()); |
| | | issueCompanyVo.setCompanyTypeName(companyType.getUseValue()); |
| | | } |
| | | if (issueCompany.getParentSectorId() != null) { |
| | | CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(issueCompany.getParentSectorId()); |
| | | issueCompanyVo.setParentSectorName(parentSector.getUseValue()); |
| | | } |
| | | if (issueCompany.getChildSectorId() != null) { |
| | | CompanyFieldCategory childSector = this.companyFieldCategoryService.find(issueCompany.getChildSectorId()); |
| | | issueCompanyVo.setChildSectorName(childSector.getUseValue()); |
| | | } |
| | | if (issueCompany.getRegionId() != null) { |
| | | CompanyFieldCategory region = this.companyFieldCategoryService.find(issueCompany.getRegionId()); |
| | | issueCompanyVo.setRegionName(region.getUseValue()); |
| | | } |
| | | if (issueCompany.getStatusId() != null) { |
| | | CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId()); |
| | | issueCompanyVo.setStatusName(status.getUseValue()); |
| | | } |
| | | } |
| | | issueCompanyVos.add(issueCompanyVo); |
| | | } |
| | |
| | | this.bulkInsertIssueCustomFieldValue(issueForms, issueTypeCustomFieldMaps); |
| | | // 3.628 - 3.445 |
| | | |
| | | // 업체,ISP,호스팅 추가 |
| | | |
| | | /*serviceStart.stop(); |
| | | log.debug("2차 저장 시간 : " + serviceStart.getTime());*/ |
| | | |
| | |
| | | issueCustomField.put("registerId", this.webAppUtil.getLoginId()); |
| | | issueCustomFieldValueMaps.add(issueCustomField); |
| | | } |
| | | IssueForm partners = this.findCompanyField(issueForm); // 같은 도메인 업체 찾기 |
| | | Issue issue = this.findOne(issueForm.getId()); |
| | | if (partners.getIssueCompanyFields() != null && partners.getIssueCompanyFields().size() > 0) { |
| | | for (Map<String, Object> company : partners.getIssueCompanyFields()) { |
| | | IssueCompany issueCompany = ConvertUtil.convertMapToClass(company, IssueCompany.class); |
| | | issueCompany.setIssue(issue); |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | } |
| | | } |
| | | if (partners.getIssueIspFields() != null && partners.getIssueIspFields().size() > 0) { |
| | | for (Map<String, Object> isp : partners.getIssueIspFields()) { |
| | | IssueIsp issueIsp = ConvertUtil.convertMapToClass(isp, IssueIsp.class); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | | } |
| | | } |
| | | if (partners.getIssueHostingFields() != null && partners.getIssueHostingFields().size() > 0) { |
| | | for (Map<String, Object> hosting : partners.getIssueHostingFields()) { |
| | | IssueHosting issueHosting = ConvertUtil.convertMapToClass(hosting, IssueHosting.class); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (issueCustomFieldValueMaps.size() > 0) { |
| | |
| | | break;*/ |
| | | case 4: |
| | | // 시작일을 IssueForm 에 저장한다. |
| | | if (cell != null) { |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | this.setIssueFormPeriod(cell, issueForm, true, rowIndex); |
| | | } |
| | | break; |
| | | case 5: |
| | | // 종료일을 IssueForm 에 저장한다. |
| | | if (cell != null) { |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | this.setIssueFormPeriod(cell, issueForm, false, rowIndex); |
| | | } |
| | | break; |
| | |
| | | @Override |
| | | public void findPartner(Map<String, Object> resJsonData, Map<String, Object> params) { |
| | | Long issueTypeId = MapUtil.getLong(params, "issueTypeId"); |
| | | IssueType issueType = this.issueTypeService.getIssueType(issueTypeId); // 이슈의 이슈유형 객체 |
| | | Integer using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; // 이슈유형별로 사용중인 업체/ISP/호스팅 값 |
| | | |
| | | List<UsePartnerVo> usePartnerVos = Lists.newArrayList(); |
| | | Integer using = 0; |
| | | |
| | | if (issueTypeId != null) { |
| | | IssueType issueType = this.issueTypeService.getIssueType(issueTypeId); // 이슈의 이슈유형 객체 |
| | | using = issueType.getUsePartner() != null ? issueType.getUsePartner().intValue() : 0; // 이슈유형별로 사용중인 업체/ISP/호스팅 값 |
| | | } else { |
| | | for (int partner : UsePartner.partners) { |
| | | using += partner; |
| | | } |
| | | } |
| | | |
| | | for (Integer usePartner : UsePartner.partners) { //1(업체), 2(ISP), 4(호스팅) |
| | | UsePartnerVo usePartnerVo = UsePartner.checkUsePartner(using, usePartner); |
| | | if (usePartnerVo != null) { |
| | | usePartnerVos.add(usePartnerVo); |
| | | } |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); |
| | | } |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos); |
| | | } |
| | | |
| | | @Override |