From 34351d822ce35efe2488004e586beeb074fbe5ae Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 화, 04 1월 2022 13:25:28 +0900 Subject: [PATCH] - API 수정 명령시 댓글 추가 가능(comment) - API 이슈 입력시 상위 이슈에 같은 도메인 업체 등록되도록 수정 --- src/main/java/kr/wisestone/owl/service/impl/WorkspaceServiceImpl.java | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/WorkspaceServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/WorkspaceServiceImpl.java index 01c08e2..a1a3ee2 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/WorkspaceServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/WorkspaceServiceImpl.java @@ -300,8 +300,13 @@ @Override @Transactional(readOnly = true) public void findMyWorkspace(Map<String, Object> resJsonData) { - UserWorkspace userWorkspace = this.userWorkspaceService.findMyWorkspace(this.webAppUtil.getLoginId()); + + UserWorkspace userWorkspace = this.userWorkspaceService.findWorkspaceManager(this.webAppUtil.getLoginId()); //�썙�겕�뒪�럹�씠�뒪 愿�由ъ옄 + if(userWorkspace == null){ + userWorkspace = this.userWorkspaceService.findMyWorkspace(this.webAppUtil.getLoginId()); + } Workspace workspace = userWorkspace.getWorkspace(); + WorkspaceVo workspaceVo = ConvertUtil.copyProperties(workspace, WorkspaceVo.class); workspaceVo.setServiceType((workspace.getServiceType().toString())); workspaceVo.setExpireDateTerm(DateUtil.getDateDiff(new Date(), workspace.getExpireDate())); // 異붽� 寃곗젣瑜� 吏꾪뻾�븷 �븣 湲덉븸 怨꾩궛�쓣 �쐞�빐 �궗�슜 @@ -553,25 +558,56 @@ @Override @Transactional public void checkUseWorkspace() { - Workspace workspace = this.getWorkspace(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); + User user = this.webAppUtil.getLoginUserObject(); + Workspace workspace = this.getWorkspace(user.getLastWorkspaceId()); + + this.checkUseWorkspace(user, workspace.getId()); + } + + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. + @Override + @Transactional + public void checkUseWorkspace(User user) { + Workspace workspace = this.getWorkspace(user.getLastWorkspaceId()); + + this.checkUseWorkspace(user, workspace.getId()); + } + + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. + @Override + @Transactional + public Workspace checkUseWorkspace(User user, Long workspaceId) { + if (user == null) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.USER_NOT_EXIST)); + } + + if (workspaceId == null) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.WORKSPACE_NOT_EXIST)); + } + + Workspace workspace = this.getWorkspace(workspaceId); if (workspace.getServiceType().equals(ServiceType.UNUSED)) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.WORKSPACE_USE_PERIOD_EXCESS)); } - UserWorkspace userWorkspace = this.userWorkspaceService.findByUserIdAndWorkspaceId(this.webAppUtil.getLoginId(), workspace.getId()); + UserWorkspace userWorkspace = this.userWorkspaceService.findByUserIdAndWorkspaceId(user.getId(), workspace.getId()); if (!userWorkspace.getUseYn()) { // �빐�떦 �궗�슜�옄媛� 愿�由ы븯�뒗 �뾽臾� 怨듦컙瑜� 留덉�留� �젒洹� �뾽臾� 怨듦컙濡� 蹂�寃쏀븳�떎. this.userService.updateLastMyWorkspace(userWorkspace.getUser()); // 鍮꾪솢�꽦 �궗�슜�옄�뒗 �뜑�씠�긽 �빐�떦 �뾽臾� 怨듦컙�뿉 �엳�쑝硫� �븞�맂�떎. - this.simpMessagingTemplate.convertAndSendToUser(this.webAppUtil.getLoginUser().getAccount(), "/notification/workspace-remove", this.messageAccessor.getMessage(MsgConstants.WORKSPACE_OUT, workspace.getName())); + this.simpMessagingTemplate.convertAndSendToUser(user.getAccount(), "/notification/workspace-remove", this.messageAccessor.getMessage(MsgConstants.WORKSPACE_OUT, workspace.getName())); throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.WORKSPACE_INCLUDE_DISABLED)); } + + return workspace; } // �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븯怨� 鍮꾪솢�꽦�씪 寃쎌슦 �뿊�� �떎�슫濡쒕뱶瑜� 湲덉��븳�떎. -- Gitblit v1.8.0