From 3955206191fdeb3a0609bd2170ed97f3f283d860 Mon Sep 17 00:00:00 2001 From: jhjang <jhjang@maprex.co.kr> Date: 월, 10 1월 2022 11:47:35 +0900 Subject: [PATCH] - api 관련 Exception 수정 - swagger 추가 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 48 +++++++++++++++++++++++++++++++----------------- 1 files changed, 31 insertions(+), 17 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 935974a..9bb8241 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; } @@ -1487,14 +1490,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": // �봽濡쒖젥�듃, �씠�뒋 �쑀�삎, �씠�뒋 �긽�깭, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦遺��꽌, 泥⑤��뙆�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� �뀑�똿�븳�떎. @@ -3862,17 +3867,26 @@ @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 -- Gitblit v1.8.0