| | |
| | | private DepartmentService departmentService; |
| | | |
| | | @Autowired |
| | | private UserDepartmentService userDepartmentService; |
| | | |
| | | @Autowired |
| | | private ProjectRoleService projectRoleService; |
| | | |
| | | @Autowired |
| | |
| | | project.setDefaultYn(true); |
| | | this.projectRepository.saveAndFlush(project); |
| | | // 프로젝트 기본 역할과 관리자 역할을 생성한다. 관리자는 생성한 사용자 |
| | | this.projectRoleService.addDefaultProjectRole(project, Lists.newArrayList(user), Lists.newArrayList()); |
| | | this.projectRoleService.addDefaultProjectRoleUser(project, Lists.newArrayList(user), Lists.newArrayList()); |
| | | // 각 프로젝트의 이슈 번호를 자동으로 생성한다. |
| | | this.issueNumberGeneratorService.generateIssueNumber(project); |
| | | |
| | |
| | | sendEmails.add(user.getAccount()); |
| | | } |
| | | |
| | | List<Department> departments = Lists.newArrayList(); |
| | | // 부서 등록 |
| | | for (Long departmentId : projectForm.getDepartmentIds()) { |
| | | Department department = this.departmentService.getDepartment(departmentId); |
| | | departments.add(department); |
| | | } |
| | | |
| | | // 기본, 관리자 프로젝트 역할을 생성하고 사용자를 해당 역할에 배정한다. |
| | | //this.projectRoleService.addDefaultProjectRole(project, managers, users); |
| | | this.projectRoleService.addDefaultProjectRole(project, managers, departments); |
| | | this.projectRoleService.addDefaultProjectRoleUser(project, managers, users); |
| | | |
| | | // 프로젝트 참여자들에게 이메일 발송을 예약한다. |
| | | Map<String, Object> projectMap = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | List<Department> departments = Lists.newArrayList(); |
| | | List<String> sendEmails = Lists.newArrayList(); // 메일 대상자 |
| | | // 부서 등록 |
| | | for (Long departmentId : projectForm.getDepartmentIds()) { |
| | | Department department = this.departmentService.getDepartment(departmentId); |
| | | /*List<UserDepartment> userDepartments = this.userDepartmentService.getUserDepartments(departmentId); |
| | | if(userDepartments != null){ |
| | | for (UserDepartment userDepartment : userDepartments){ |
| | | User user = this.userService.getUser(userDepartment.getUserId()); |
| | | sendEmails.add(user.getAccount()); |
| | | } |
| | | }*/ |
| | | departments.add(department); |
| | | } |
| | | |
| | | // 기본, 관리자 프로젝트 역할을 생성하고 사용자를 해당 역할에 배정한다. |
| | | //this.projectRoleService.addDefaultProjectRole(project, managers, users); |
| | | this.projectRoleService.addDefaultProjectRole(project, managers, departments); |
| | | // 기본, 관리자 프로젝트 역할을 생성하고 담당부서를 해당 역할에 배정한다. |
| | | this.projectRoleService.addDefaultProjectRoleDepartment(project, managers, departments); |
| | | |
| | | // 프로젝트 참여자들에게 이메일 발송을 예약한다. |
| | | Map<String, Object> projectMap = new HashMap<>(); |
| | |
| | | stringBuilder.append(")"); |
| | | |
| | | projectMap.put("projectManagerName", stringBuilder.toString()); |
| | | // 프로젝트 담당부서 메일 발송 예약 |
| | | this.systemEmailService.reservationEmail(sendEmails.toArray(new String[sendEmails.size()]), EmailType.PROJECT_DEFAULT_INCLUDE, projectMap); |
| | | } |
| | | |
| | | |
| | |
| | | this.checkExcludeDepartmentAndRemoveIssueDepartment(project, existDepartmentIds, changeDepartmentIds); |
| | | |
| | | // 관리자/일반 사용자 변경 내역을 통지한다. |
| | | this.notificationProjectRoleUser(changeProjectManagerNotifications, changeProjectUserNotifications, project); |
| | | //this.notificationProjectRoleUser(changeProjectManagerNotifications, changeProjectUserNotifications, project); |
| | | // 관리자/담당부서 변경 내역을 통지한다. |
| | | this.notificationProjectRoleDepartment(changeProjectManagerNotifications, changeProjectDepartmentNotifications, project); |
| | | |
| | | return project; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | // 관리자를 변경한다. |
| | | // 담당부서를 변경한다. |
| | | private Map<String, Object> modifyProjectDepartments(Project project, ProjectForm projectForm) { |
| | | ProjectRole projectRole = this.projectRoleService.findByProjectIdAndRoleType(project.getId(), ProjectRole.TYPE_DEFAULT); |
| | | List<Department> oldDepartment = Lists.newArrayList(); |
| | |
| | | department.addProjectRole(projectRole); |
| | | } |
| | | |
| | | // 제외 대상자 찾기, oldManager 에는 있는데 newManager 에 없으면 제외 대상 |
| | | // 제외 대상자 찾기, oldDepartment 에는 있는데 newDepartment 에 없으면 제외 대상 |
| | | List<String> excludeDepartments = this.systemEmailService.notificationDepartmentChange(oldDepartment, newDepartment); |
| | | // 참여 대상자 찾기, newManager 에는 있는데 oldManager 에 없으면 초대받은 대상 |
| | | // 참여 대상자 찾기, newDepartment 에는 있는데 oldDepartment 에 없으면 초대받은 대상 |
| | | List<String> includeDepartments = this.systemEmailService.notificationDepartmentChange(newDepartment, oldDepartment); |
| | | |
| | | results.put("excludeDepartments", excludeDepartments); |
| | |
| | | this.sendEmailProjectRoleChange(this.checkDuplicationEmails(projectUserIncludeUsers, excludeManagerAndIncludeUser, excludeUserAndIncludeManager), EmailType.PROJECT_DEFAULT_INCLUDE, projectMap); |
| | | } |
| | | |
| | | // 프로젝트 참여, 제외 통지 정보 체크 |
| | | private void notificationProjectRoleDepartment(Map<String, Object> changeProjectManagerNotifications, Map<String, Object> changeProjectDepartmentNotifications, Project project) { |
| | | List<String> projectManagerExcludeUsers = (List<String>) changeProjectManagerNotifications.get("excludeUsers"); // 관리자 제외 사용자 |
| | | List<String> projectManagerIncludeUsers = (List<String>) changeProjectManagerNotifications.get("includeUsers"); // 관리자 참여 사용자 |
| | | List<String> projectDepartmentExcludeDepartments = (List<String>) changeProjectDepartmentNotifications.get("excludeDepartments"); // 제외된 담당 부서 |
| | | List<String> projectDepartmentIncludeDepartments = (List<String>) changeProjectDepartmentNotifications.get("includeDepartments"); // 참여된 담당 부서 |
| | | Map<String, Object> projectMap = new HashMap<>(); |
| | | projectMap.put("workspaceName", project.getWorkspace().getName()); |
| | | projectMap.put("projectName", project.getName()); |
| | | projectMap.put("registerDate", DateUtil.convertDateToStr(new Date())); |
| | | |
| | | Map<String, Object> projectRoleManagerMap = new HashMap<>(); |
| | | projectRoleManagerMap.put("id", project.getId()); |
| | | projectRoleManagerMap.put("statuses", Lists.newArrayList("02")); // 관리자 조회 |
| | | |
| | | // 관리자 정보 셋팅 |
| | | List<Map<String, Object>> projectRoleManagers = this.projectRoleUserService.findProjectRoleUser(projectRoleManagerMap); |
| | | |
| | | if (projectRoleManagers != null && !projectRoleManagers.isEmpty()) { |
| | | for (Map<String, Object> projectRoleManager : projectRoleManagers) { |
| | | UserVo userVo = ConvertUtil.convertMapToClass(projectRoleManager, UserVo.class); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.append(userVo.getName()); |
| | | stringBuilder.append("("); |
| | | stringBuilder.append(CommonUtil.decryptAES128(userVo.getAccount())); |
| | | stringBuilder.append(")"); |
| | | |
| | | projectMap.put("projectManagerName", stringBuilder.toString()); |
| | | } |
| | | } |
| | | |
| | | // 관리자 제외 메일 |
| | | this.sendEmailProjectRoleChange(projectManagerExcludeUsers, EmailType.PROJECT_MANAGER_EXCLUDE, projectMap); |
| | | // 관리차 참여 메일 |
| | | this.sendEmailProjectRoleChange(projectManagerIncludeUsers, EmailType.PROJECT_MANAGER_INCLUDE, projectMap); |
| | | // 담당 부서 제외 메일 |
| | | this.sendEmailProjectRoleChange(projectDepartmentExcludeDepartments, EmailType.PROJECT_DEFAULT_EXCLUDE, projectMap); |
| | | // 담당 부서 참여 메일 |
| | | this.sendEmailProjectRoleChange(projectDepartmentIncludeDepartments, EmailType.PROJECT_DEFAULT_INCLUDE, projectMap); |
| | | } |
| | | |
| | | // 중복으로 나가는 메일이 있는지 체크한다. |
| | | private List<String> checkDuplicationEmails(List<String> checkEmails, List<String> excludeManagerAndIncludeUser, List<String> excludeUserAndIncludeManager) { |
| | | List<String> sendProjectManagerExcludeUserEmails = Lists.newArrayList(); |