| | |
| | | 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; |
| | |
| | | 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()); |
| | |
| | | |
| | | 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(), |
| | |
| | | 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); |
| | | } |
| | | |
| | | // 부서 변경 |
| | |
| | | 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); |
| | |
| | | return this.userWorkspaceRepository.findByUserIdAndManagerYn(userId, true); |
| | | } |
| | | |
| | | // 워크스페이스 관리자 조회 |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public UserWorkspace findWorkspaceManager(Long userId) { |
| | | return this.userWorkspaceRepository.findByUserId(userId); |
| | | } |
| | | |
| | | // 업무 공간 사용자 연결 아이디로 업무 공간 사용자 연결 정보를 조회한다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | |
| | | // 업무 공간 담당자 여부를 확인한다. |
| | | @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()); |
| | | } |
| | |
| | | this.userWorkspaceRepository.saveAll(userWorkspaces); |
| | | } |
| | | } |
| | | |
| | | } |