From fab2f56f5631335d5ac5b1497fa996fbe63d0b1f Mon Sep 17 00:00:00 2001 From: jhjang <jhjang@maprex.co.kr> Date: 화, 11 1월 2022 14:45:33 +0900 Subject: [PATCH] - 이슈 검색 속도 개선 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 61 ++++++++++++++++-------------- 1 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java index 874669b..4cf7a5d 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java @@ -11,6 +11,8 @@ 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; @@ -235,14 +237,14 @@ 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(); @@ -256,13 +258,13 @@ } } } 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)); } // �봽濡쒖젥�듃 �엯�젰 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()); @@ -321,7 +323,7 @@ return issueForm; } else { - throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); + throw new ApiAuthException(this.messageAccessor.getMessage(MsgConstants.API_USER_ERROR)); } } @@ -367,6 +369,7 @@ issueForm.setIssueHostingFields(issueHostingFields); } } + return issueForm; } @@ -930,22 +933,19 @@ 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)) { //理쒓퀬愿�由ъ옄 & �봽濡쒖젥�듃,�씠�뒋 愿�由ъ옄 �씪 寃쎌슦 紐⑤뱺 �씠�뒋 蹂닿린 @@ -955,17 +955,18 @@ // 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; // �씠�뒋 �븘�씠�뵒 珥덇린�솕 @@ -981,8 +982,8 @@ this.setDownIssues(user, issueVos); this.setRelationIssues(issueVos); } - this.setCountDownIssues(issueVos); + this.setCountDownIssues(issueVos); this.SetWorkflowDepartment(issueVos); //�썙�겕�뵆濡쒖슦�뿉 �꽕�젙�븳 �떞�떦遺��꽌 媛��졇�삤湲� resJsonData.put(Constants.RES_KEY_CONTENTS, issueVos); @@ -1487,14 +1488,16 @@ 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": // �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦遺��꽌, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� �뀑�똿�븳�떎. -- Gitblit v1.8.0