| | |
| | | import kr.wisestone.owl.domain.enumType.SocialType; |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.mapper.UserMapper; |
| | | import kr.wisestone.owl.repository.DepartmentRepository; |
| | | import kr.wisestone.owl.repository.UserRepository; |
| | | import kr.wisestone.owl.service.*; |
| | | import kr.wisestone.owl.util.*; |
| | | import kr.wisestone.owl.vo.*; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | | import kr.wisestone.owl.web.form.DepartmentManageForm; |
| | | import kr.wisestone.owl.web.form.UserForm; |
| | | import kr.wisestone.owl.web.view.ExcelView; |
| | | import org.apache.commons.validator.routines.EmailValidator; |
| | |
| | | private UserRepository userRepository; |
| | | |
| | | @Autowired |
| | | private DepartmentRepository departmentRepository; |
| | | |
| | | @Autowired |
| | | private UserLevelService userLevelService; |
| | | |
| | | @Autowired |
| | | private DepartmentManageService departmentManageService; |
| | | private DepartmentService departmentService; |
| | | |
| | | @Autowired |
| | | private SystemRoleService systemRoleService; |
| | |
| | | private ProjectService projectService; |
| | | |
| | | @Autowired |
| | | private IssueTypeService issueTypeService; |
| | | |
| | | @Autowired |
| | | private UserSecurityService userSecurityService; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private AttachedFileService attachedFileService; |
| | | |
| | | @Autowired |
| | | private UserDepartmentService userDepartmentService; |
| | | |
| | | @Autowired |
| | | private IssueService issueService; |
| | |
| | | /*user.setPermission(MngPermission.USER_PERMISSION_MNG_NONE);*/ |
| | | |
| | | } else if(validAdmin == 1) { // 라이센스 입력 관리자 |
| | | |
| | | /*DepartmentForm departmentForm = new DepartmentForm(); |
| | | |
| | | departmentForm.setDepartmentName("부서 없음"); |
| | | Department department = this.departmentService.add(departmentForm); |
| | | this.departmentRepository.saveAndFlush(department);*/ |
| | | |
| | | Workspace primaryWorkspace = this.workspaceService.getPrimaryWorkspace(); |
| | | |
| | | UserLevel userLevel = this.userLevelService.addSuperUserLevel(); |
| | |
| | | this.userWorkspaceService.addUserWorkspace(user, workspace, true, true); |
| | | |
| | | // 기본으로 제공되는 프로젝트를 생성한다. |
| | | // this.projectService.addDefaultProject(user, workspace); |
| | | this.projectService.addDefaultProject(user, workspace); |
| | | |
| | | // 기본으로 제공되는 프로젝트를 이슈 유형의 사용 프로젝트로 설정 |
| | | this.issueTypeService.addDefaultUsedProject(workspace); |
| | | |
| | | user.setLastWorkspaceId(workspace.getId()); |
| | | |
| | |
| | | /*user.setPermission(MngPermission.makeSubAllPermission());*/ |
| | | } |
| | | } |
| | | DepartmentManageForm departmentManageForm = new DepartmentManageForm(); |
| | | |
| | | departmentManageForm.setDepartmentName("부서 없음"); |
| | | DepartmentManage departmentManage = this.departmentManageService.addDepartmentManage(departmentManageForm); |
| | | user.setDepartmentManage(departmentManage); |
| | | this.userRepository.saveAndFlush(user); |
| | | |
| | | // 이메일 알림 예정 시간이 공백이면 디폴트 이메일 알림 예정 시간으로 설정한다. |
| | |
| | | User user = this.getUser(userCondition.getId()); |
| | | userVo = ConvertUtil.copyProperties(user, UserVo.class, "password"); |
| | | userVo.setAccount(CommonUtil.decryptAES128(userVo.getAccount())); |
| | | } |
| | | |
| | | Map<String, Object> projectManagerYN = this.projectRoleUserService.findProjectManager((userCondition.getId())); |
| | | if(projectManagerYN != null){ |
| | | userVo.setProjectManagerYN(true); |
| | | } |
| | | } |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, userVo); |
| | | } |
| | | |
| | |
| | | return this.convertUserVoToMap(results, totalUsersCount, pageable, resJsonData); |
| | | } |
| | | |
| | | // 사용자 정보를 가져온다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public void findMyLevelAndDepartment(Map<String, Object> resJsonData) { |
| | | Long loginId = this.webAppUtil.getLoginId(); |
| | | Map<String, Object> result = this.userMapper.findByMyLevelAndDepartment(loginId); |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, result); |
| | | } |
| | | |
| | | // 사용자 아이디로 사용자를 조회한다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, userVo); |
| | | } |
| | | |
| | | // 마지막으로 선택한 이슈 타입 정보를 저장한다. |
| | | @Override |
| | | @Transactional |
| | | public void updateLastIssueType(Map<String, Object> resJsonData, UserForm userForm) { |
| | | User user = this.getUser(this.webAppUtil.getLoginId()); |
| | | |
| | | if (userForm.getLastIssueTypeId() != null) { |
| | | user.setLastIssueTypeId(userForm.getLastIssueTypeId()); |
| | | } |
| | | |
| | | this.userRepository.saveAndFlush(user); |
| | | // 세션 업데이트 |
| | | SecurityUtils.setUserToSession(user); |
| | | // 클라이언트의 사용자 정보 업데이트 |
| | | UserVo userVo = ConvertUtil.copyProperties(user, UserVo.class, "password"); |
| | | |
| | | if (user.getSocialType() != null) { |
| | | userVo.setSocialType(user.getSocialType().toString()); |
| | | } |
| | | |
| | | userVo.setAccount(CommonUtil.decryptAES128(userVo.getAccount())); |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, userVo); |
| | | } |
| | | // 특정 아이디에 해당하는 사용자 목록을 가져온다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | |
| | | @Transactional(readOnly = true) |
| | | public User getUserSession(Map<String, Object> resJsonData, HttpServletRequest httpServletRequest) { |
| | | User user = this.getUser(this.webAppUtil.getLoginId()); |
| | | UserVo userVo = ConvertUtil.copyProperties(user, UserVo.class, "password","permission"); // wyu - ignores permission ?? |
| | | UserVo userVo = ConvertUtil.copyProperties(user, UserVo.class, "password"); |
| | | // user에서 Permission 값을 가져와서 userVo 에 setPermission 함 |
| | | userVo.setPermission(user.getPermission()); |
| | | userVo.setAccount(CommonUtil.decryptAES128(userVo.getAccount())); |
| | | |
| | | UserLevel userLevel = user.getUserLevel(); |
| | | if (userLevel != null) { |
| | | userVo.setLevelName(userLevel.getLevelName()); |
| | | } |
| | | |
| | | List<Department> departments = this.userDepartmentService.findDepartment(user.getId()); |
| | | if (departments != null) { |
| | | userVo.setDepartmentVos(ConvertUtil.convertObjectsToClasses(departments, DepartmentVo.class)); |
| | | } |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, userVo); |
| | | // 사용자 세션 정보를 분석해서 로그에 남긴다. |
| | | log.info(ElasticSearchUtil.makeUserSessionHistoryMessage(httpServletRequest, userVo)); |
| | |
| | | conditions.put("endTime", DateUtil.convertDateToStr(endCal.getTime(), "HH:mm")); |
| | | |
| | | List<Map<String, Object>> users = this.userMapper.findByReservationNotifyTime(conditions); |
| | | List<String> results = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> user : users) { |
| | | results.add(MapUtil.getString(user, "account")); |
| | | } |
| | | |
| | | return results; |
| | | } |
| | | |
| | | // 이메일 알림 예정 시간을 실시간으로 설정한 사용자를 조회한다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public List<String> findByRealTimeNotifyTime() { |
| | | Map<String, Object> conditions = new HashMap<>(); |
| | | |
| | | List<Map<String, Object>> users = this.userMapper.findByRealTimeNotifyTime(conditions); |
| | | List<String> results = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> user : users) { |
| | |
| | | userMap.put("newUserCount", joinUsers.size()); |
| | | userMap.put("joinUsers", userVos); |
| | | |
| | | String[] sendEmails = this.userJoinStatisticsEmail.replaceAll("\\p{Z}", "").split(","); |
| | | List<String> encryptSendEmail = Lists.newArrayList(); |
| | | if (this.userJoinStatisticsEmail != null && !this.userJoinStatisticsEmail.equals("")) { |
| | | String[] sendEmails = this.userJoinStatisticsEmail.replaceAll("\\p{Z}", "").split(","); |
| | | List<String> encryptSendEmail = Lists.newArrayList(); |
| | | |
| | | for (String sendEmail : sendEmails) { |
| | | encryptSendEmail.add(CommonUtil.encryptAES128(sendEmail)); |
| | | for (String sendEmail : sendEmails) { |
| | | encryptSendEmail.add(CommonUtil.encryptAES128(sendEmail)); |
| | | } |
| | | // 결제 성공 메일 발송 |
| | | this.systemEmailService.directEmail(encryptSendEmail.toArray(new String[encryptSendEmail.size()]), EmailType.USER_JOIN_STATISTICS, userMap, null); |
| | | } |
| | | |
| | | // 결제 성공 메일 발송 |
| | | this.systemEmailService.directEmail(encryptSendEmail.toArray(new String[encryptSendEmail.size()]), EmailType.USER_JOIN_STATISTICS, userMap, null); |
| | | } |
| | | |
| | | // 전체 사용자, 프로젝트 수, 이슈 수를 이메일로 보낸다. |
| | |
| | | userMap.put("projectCount", CommonUtil.getDecimalFormat(projectCount)); |
| | | userMap.put("userCount", CommonUtil.getDecimalFormat(activeUsers.size())); |
| | | |
| | | String[] sendEmails = this.totalStatisticsEmail.replaceAll("\\p{Z}", "").split(","); |
| | | List<String> encryptSendEmail = Lists.newArrayList(); |
| | | if (this.totalStatisticsEmail != null && !this.totalStatisticsEmail.equals("")) { |
| | | String[] sendEmails = this.totalStatisticsEmail.replaceAll("\\p{Z}", "").split(","); |
| | | List<String> encryptSendEmail = Lists.newArrayList(); |
| | | |
| | | for (String sendEmail : sendEmails) { |
| | | encryptSendEmail.add(CommonUtil.encryptAES128(sendEmail)); |
| | | for (String sendEmail : sendEmails) { |
| | | encryptSendEmail.add(CommonUtil.encryptAES128(sendEmail)); |
| | | } |
| | | |
| | | // 결제 성공 메일 발송 |
| | | this.systemEmailService.directEmail(encryptSendEmail.toArray(new String[encryptSendEmail.size()]), EmailType.TOTAL_STATISTICS, userMap, null); |
| | | } |
| | | |
| | | // 결제 성공 메일 발송 |
| | | this.systemEmailService.directEmail(encryptSendEmail.toArray(new String[encryptSendEmail.size()]), EmailType.TOTAL_STATISTICS, userMap, null); |
| | | } |
| | | |
| | | |