From b8ab6de032d3a6ee029331dbb58d764a5409189b Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 월, 28 2월 2022 15:51:13 +0900 Subject: [PATCH] - api로 하위이슈 추가 시 상위이슈의 파트너 정보 적용 --- src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java | 67 +++++++++++++++++++++++---------- 1 files changed, 46 insertions(+), 21 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java index a5d6f06..b192044 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java @@ -9,8 +9,10 @@ import kr.wisestone.owl.service.*; import kr.wisestone.owl.util.CommonUtil; import kr.wisestone.owl.util.ConvertUtil; +import kr.wisestone.owl.vo.DepartmentVo; import kr.wisestone.owl.vo.ResPage; import kr.wisestone.owl.vo.UserWorkspaceVo; +import kr.wisestone.owl.web.condition.UserCondition; import kr.wisestone.owl.web.condition.UserWorkspaceCondition; import kr.wisestone.owl.web.form.UserWorkspaceForm; import org.slf4j.Logger; @@ -40,7 +42,7 @@ private UserLevelService userLevelService; @Autowired - private DepartmentManageService departmentManageService; + private DepartmentService departmentService; @Autowired private UserWorkspaceMapper userWorkspaceMapper; @@ -77,7 +79,7 @@ public List<UserWorkspaceVo> findUserWorkspace(Map<String, Object> resJsonData, UserWorkspaceCondition condition, Pageable pageable) { - UserWorkspace userWorkspace = this.findMyWorkspace(this.webAppUtil.getLoginId()); + UserWorkspace userWorkspace = this.findWorkspaceManager(this.webAppUtil.getLoginId()); Workspace myWorkspace = userWorkspace.getWorkspace(); condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); condition.setPageSize(pageable.getPageSize()); @@ -91,6 +93,16 @@ for (UserWorkspaceVo userWorkspaceVo : userWorkspaceVos) { userWorkspaceVo.setAccount(CommonUtil.decryptAES128(userWorkspaceVo.getAccount())); + + // UserCondition �뒗 �썝�옒 userId 媛� �뾾�뿀�떎. + UserCondition con = new UserCondition(); + // 洹몃옒�꽌 Condition�뿉 異붽� �빐二쇨퀬 set �븯�뒗�뜲 洹멸굔 userWorkspaceVo �뿉�꽌 Id 瑜� 媛��졇�삩�떎 + con.setId(userWorkspaceVo.getUserId()); + // findByDepartmentIds �씪�뒗嫄� mapper濡� 留뚮뱾�뼱�꽌 荑쇰━ for臾몄쓣 �룎由ш퀬 us + List<Map<String, Object>> re = this.departmentService.findByDepartmentIds(con); + List<DepartmentVo> vos = ConvertUtil.convertListToListClass(re, DepartmentVo.class); + + userWorkspaceVo.setDepartmentVos(vos); } resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(), @@ -106,24 +118,30 @@ public void modifyUserWorkspace(UserWorkspaceForm userWorkspaceForm) { UserWorkspace userWorkspace = this.getUserWorkspace(userWorkspaceForm.getId()); - UserLevel currentUserlevel = userWorkspace.getUser().getUserLevel(); + User user = userWorkspace.getUser(); + + // �궗�슜�옄 �벑湲� 蹂�寃� + UserLevel currentUserlevel = user.getUserLevel(); if (currentUserlevel.getId() != userWorkspaceForm.getLevelId()) { - // �궗�슜�옄 �벑湲� 蹂�寃쎌떆 - User user = userWorkspace.getUser(); UserLevel userLevel = this.userLevelService.getUserLevel(userWorkspaceForm.getLevelId()); user.setUserLevel(userLevel); userWorkspace.setUser(user); + + // �벑湲� 蹂�寃� �맂 �쑀�� 濡쒓렇�븘�썐 �떆�궎湲� + this.simpMessagingTemplate.convertAndSendToUser(user.getAccount(), "/notification/changeUserLevel", this.messageAccessor.getMessage(MsgConstants.USER_LEVEL_CHANGE)); + + // �꽭�뀡 �뾽�뜲�씠�듃 + //SecurityUtils.setUserToSession(user); } - //todo 遺��꽌 蹂�寃쎌떆 - DepartmentManage currentDepartment = userWorkspace.getUser().getDepartmentManage(); - if (currentDepartment.getId() != userWorkspaceForm.getDepartmentId()) { - // 遺��꽌紐� 蹂�寃쎌떆 - User user = userWorkspace.getUser(); - DepartmentManage departmentManage = this.departmentManageService.getDepartment(userWorkspaceForm.getLevelId()); - user.setDepartmentManage(departmentManage); - userWorkspace.setUser(user); - } + // 遺��꽌 蹂�寃� +// DepartmentManage currentDepartment = user.getDepartmentManage(); +// if (currentDepartment == null || (userWorkspaceForm.getDepartmentId() != null && currentDepartment.getId() != userWorkspaceForm.getDepartmentId())) { +// // 遺��꽌紐� 蹂�寃쎌떆 +// DepartmentManage departmentManage = this.departmentService.getDepartment(userWorkspaceForm.getDepartmentId()); +// user.setDepartmentManage(departmentManage); +// userWorkspace.setUser(user); +// } // 李몄뿬濡� �긽�깭瑜� 蹂�寃쏀븯�젮怨� �븷�븣 if (userWorkspace.getUseYn() != userWorkspaceForm.getUseYn()) { @@ -137,7 +155,7 @@ this.messageAccessor.getMessage(MsgConstants.WORKSPACE_MAX_USER_EXCESS_NOT_INCLUDE)); } } else { - User user = userWorkspace.getUser(); + user = userWorkspace.getUser(); // 李몄뿬 ��湲� �궗�슜�옄媛� �쁽�옱 �빐�떦 �뾽臾� 怨듦컙�쓣 �궗�슜�븯怨� �엳�쓣 寃쎌슦 利됱떆 �빐�떦 �뾽臾� 怨듦컙�뿉�꽌 �뒘湲곌쾶 �븳�떎. if (user.getLastWorkspaceId().equals(userWorkspace.getWorkspace().getId())) { // �뾽臾� 怨듦컙�뿉 李몄뿬�븯�뜕 �궗�슜�옄�뿉寃� �젣�쇅 �븣由� 諛� �솕硫� �깉濡쒓퀬移� @@ -160,10 +178,10 @@ public void disabledUserWorkspace(User user, Workspace workspace) { UserWorkspace userWorkspace = this.userWorkspaceRepository.findByUserIdAndWorkspaceId(user.getId(), workspace.getId()); - if (userWorkspace.getManagerYn()) { + /*if (userWorkspace.getManagerYn()) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.WORKSPACE_MANAGER_NOT_CHANGE_USE_YN)); - } + }*/ userWorkspace.setUseYn(false); this.userWorkspaceRepository.saveAndFlush(userWorkspace); @@ -204,6 +222,13 @@ return this.userWorkspaceRepository.findByUserIdAndManagerYn(userId, true); } + // �썙�겕�뒪�럹�씠�뒪 愿�由ъ옄 議고쉶 + @Override + @Transactional(readOnly = true) + public UserWorkspace findWorkspaceManager(Long userId) { + return this.userWorkspaceRepository.findByUserId(userId); + } + // �뾽臾� 怨듦컙 �궗�슜�옄 �뿰寃� �븘�씠�뵒濡� �뾽臾� 怨듦컙 �궗�슜�옄 �뿰寃� �젙蹂대�� 議고쉶�븳�떎. @Override @Transactional(readOnly = true) @@ -226,15 +251,14 @@ // �뾽臾� 怨듦컙 �떞�떦�옄 �뿬遺�瑜� �솗�씤�븳�떎. @Override @Transactional(readOnly = true) - public boolean checkWorkspaceManager() { + public boolean checkWorkspaceManager(User user) { boolean bIsManager = false; - User loginUser = this.userService.getUser(this.webAppUtil.getLoginId()); try { - Workspace workspace = this.workspaceService.getWorkspace(loginUser.getLastWorkspaceId()); // �쁽�옱 �젒�냽�븳 �뾽臾� 怨듦컙 + Workspace workspace = this.workspaceService.getWorkspace(user.getLastWorkspaceId()); // �쁽�옱 �젒�냽�븳 �뾽臾� 怨듦컙 // 濡쒓렇�씤�븳 �궗�슜�옄媛� 愿�由ы븯�뒗 �뾽臾� 怨듦컙�쓣 李얜뒗�떎. - UserWorkspace userWorkspace = this.findMyWorkspace(this.webAppUtil.getLoginId()); + UserWorkspace userWorkspace = this.findMyWorkspace(user.getId()); bIsManager = workspace.getId().equals(userWorkspace.getWorkspace().getId()); } @@ -271,4 +295,5 @@ this.userWorkspaceRepository.saveAll(userWorkspaces); } } + } -- Gitblit v1.8.0