| | |
| | | Map<String, Priority> priorityMaps = new HashMap<>(); // 우선 순위 모음 |
| | | Map<String, Severity> severityMaps = new HashMap<>(); // 중요도 모음 |
| | | Map<String, Object> userMaps = new HashMap<>(); // 사용자 모음 |
| | | Map<String, Object> departmentMaps = new HashMap<>(); // 부서 모음 |
| | | Map<String, DepartmentVo> departmentMaps = new HashMap<>(); // 부서 모음 |
| | | Map<String, CustomField> customFieldMaps = new HashMap<>(); |
| | | Map<String, IssueStatus> issueStatusReadyMaps = new HashMap<>(); // 상태 속성 '대기'인 이슈 상태 |
| | | Map<Long, Long> issueNumberMaps = new HashMap<>(); // 이슈 번호 모음 |
| | |
| | | // 1번 헤더부터 데이터 영역 |
| | | if (rowIndex > 1) { |
| | | // 이슈로 등록하기 위해 IssueForm 에 데이터를 셋팅한다. |
| | | issueForms.add(this.setIssueFormToExcelField(row, (rowIndex + 1), issueStatusReadyMaps, projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, customFieldMaps, issueNumberMaps, headers)); |
| | | issueForms.add(this.setIssueFormToExcelField(row, (rowIndex + 1), issueStatusReadyMaps, projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, departmentMaps, customFieldMaps, issueNumberMaps, headers)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 이슈의 주요 속성을 map 에 저장하여 엑셀 import 에서 지정한 대상(이슈 속성)을 빠르게 찾을 수 있게 한다. |
| | | private void IssueAttributeMapToList(Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps, |
| | | Map<String, Object> userMaps, Map<String, Object> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, Map<String, Long> issueTypeCustomFieldMaps, Map<String, IssueStatus> issueStatusReadyMaps) { |
| | | Map<String, Object> userMaps, Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, Map<String, Long> issueTypeCustomFieldMaps, Map<String, IssueStatus> issueStatusReadyMaps) { |
| | | // 프로젝트 키로 바로 찾을 수 있게 준비 |
| | | List<Project> projects = this.projectService.findByWorkspaceId(); |
| | | List<Long> projectIds = Lists.newArrayList(); |
| | |
| | | for (Map<String, Object> user : users) { |
| | | userMap.put(CommonUtil.decryptAES128(MapUtil.getString(user, "account")), MapUtil.getLong(user, "userId")); |
| | | } |
| | | |
| | | userMaps.put(project.getProjectKey(), userMap); |
| | | |
| | | // 프로젝트에 참여하는 부서 정보 |
| | | List<Map<String, Object>> departments = this.departmentService.findProjectDepartment(project); |
| | | List<Long> departmentList = Lists.newArrayList(); |
| | | // 부서 정보를 저장 |
| | | for (Map<String, Object> department : departments) { |
| | | departmentList.add(MapUtil.getLong(department, "departmentId")); |
| | | } |
| | | } |
| | | |
| | | // 이슈 유형을 바로 찾을 수 있게 준비 |
| | |
| | | |
| | | IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(issueType.getWorkflow()); |
| | | issueStatusReadyMaps.put(issueType.getId().toString(), issueStatus); |
| | | |
| | | // 워크플로우에 속해있는 부서 정보 |
| | | List<DepartmentVo> departments = this.departmentService.findWorkflowDepartment(issueType.getId()); |
| | | // 부서 정보를 저장 |
| | | for (DepartmentVo department : departments) { |
| | | departmentMaps.put(department.getDepartmentName(), department); |
| | | } |
| | | } |
| | | |
| | | // 우선순위를 바로 찾을 수 있게 준비 |
| | |
| | | |
| | | // 엑셀 필드에 있는 정보를 이슈 form 으로 옮긴다. |
| | | private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, IssueStatus> issueStatusReadyMaps, Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String, |
| | | Priority> priorityMaps, Map<String, Severity> severityMaps, Map<String, Object> userMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, List<String> headers) { |
| | | Priority> priorityMaps, Map<String, Severity> severityMaps, Map<String, Object> userMaps, Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, List<String> headers) { |
| | | IssueForm issueForm = new IssueForm(); |
| | | issueForm.setRegisterId(this.webAppUtil.getLoginId()); |
| | | Project project = null; |
| | |
| | | // 중요도를 IssueForm 에 저장한다. |
| | | this.setIssueFormSeverity(cell, severityMaps, issueForm, rowIndex); |
| | | break; |
| | | /*case 6: |
| | | // 담당자를 IssueForm 에 저장한다. |
| | | this.setIssueFormAssignee(cell, userMaps, issueForm, project); |
| | | break;*/ |
| | | case 6: |
| | | // 담당부서를 IssueForm 에 저장한다. |
| | | this.setIssueFormAssignee(cell, userMaps, issueForm, project); |
| | | this.setIssueFormDepartment(cell, departmentMaps, issueForm, project); |
| | | break; |
| | | case 7: |
| | | // 시작일을 IssueForm 에 저장한다. |
| | |
| | | this.setIssueFormPeriod(cell, issueForm, false, rowIndex); |
| | | break; |
| | | default: |
| | | // 8번 이상부터는 사용자 정의 필드. 사용자 정의 필드 정보를 IssueForm 에 저장한다. |
| | | // 9번 부터는 사용자 정의 필드. 사용자 정의 필드 정보를 IssueForm 에 저장한다. |
| | | this.setIssueFormCustomFieldValue(cell, customFieldMaps, issueForm, headers.get(cellIndex), rowIndex); |
| | | } |
| | | } |
| | |
| | | issueForm.setSeverityId(severity.getId()); |
| | | } |
| | | |
| | | // 담당부서를 IssueForm 에 저장한다. |
| | | private void setIssueFormAssignee(Cell cell, Map<String, Object> userMaps, IssueForm issueForm, Project project) { |
| | | if (cell != null) { |
| | | String[] splitAssignee = CommonUtil.convertExcelStringToCell(cell).split("#"); |
| | | Map<String, Object> userMap = (Map<String, Object>) MapUtil.getObject(userMaps, project.getProjectKey()); |
| | | |
| | | List<Long> departmentIds = Lists.newArrayList(); |
| | | List<Long> userIds = Lists.newArrayList(); |
| | | |
| | | for (String account : splitAssignee) { |
| | | if (MapUtil.getLong(userMap, account) != null) { |
| | | departmentIds.add(MapUtil.getLong(userMap, account)); |
| | | userIds.add(MapUtil.getLong(userMap, account)); |
| | | } |
| | | } |
| | | issueForm.setUserIds(userIds); |
| | | } |
| | | } |
| | | |
| | | // 담당부서를 IssueForm 에 저장한다. |
| | | private void setIssueFormDepartment(Cell cell, Map<String, DepartmentVo> departmentMaps, IssueForm issueForm, Project project) { |
| | | if (cell != null) { |
| | | String[] splitDepartment = CommonUtil.convertExcelStringToCell(cell).split("#"); |
| | | |
| | | // 값이 공백이면 중지 |
| | | String cellValue = CommonUtil.convertExcelStringToCell(cell); |
| | | if (StringUtils.isEmpty(cellValue)) { |
| | | return; |
| | | } |
| | | |
| | | List<Long> departmentIds = Lists.newArrayList(); |
| | | |
| | | for (String department : splitDepartment) { |
| | | DepartmentVo departmentVo = departmentMaps.get(department); |
| | | departmentIds.add(departmentVo.getId()); |
| | | } |
| | | issueForm.setDepartmentIds(departmentIds); |
| | | } |
| | | } |
| | |
| | | private void setIssueFormPeriod(Cell cell, IssueForm issueForm, Boolean checkStartDate, int rowIndex) { |
| | | if (cell != null && !cell.toString().equals("")) { |
| | | |
| | | // 값이 공백이면 중지 |
| | | String cellValue = CommonUtil.convertExcelStringToCell(cell); |
| | | if (StringUtils.isEmpty(cellValue)) { |
| | | return; |
| | | } |
| | | |
| | | Date startDate; |
| | | |
| | | try { |