| | |
| | | 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; |
| | |
| | | private UserLevelService userLevelService; |
| | | |
| | | @Autowired |
| | | private DepartmentManageService departmentManageService; |
| | | private DepartmentService departmentService; |
| | | |
| | | @Autowired |
| | | private UserWorkspaceMapper userWorkspaceMapper; |
| | |
| | | |
| | | 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(), |
| | |
| | | } |
| | | |
| | | // 부서 변경 |
| | | DepartmentManage currentDepartment = user.getDepartmentManage(); |
| | | if (currentDepartment == null || (userWorkspaceForm.getDepartmentId() != null && currentDepartment.getId() != userWorkspaceForm.getDepartmentId())) { |
| | | // 부서명 변경시 |
| | | DepartmentManage departmentManage = this.departmentManageService.getDepartment(userWorkspaceForm.getDepartmentId()); |
| | | 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()) { |
| | |
| | | // 업무 공간 담당자 여부를 확인한다. |
| | | @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); |
| | | } |
| | | } |
| | | |
| | | } |