| | |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("register", this.messageAccessor.message("common.register"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 등록자 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("period", this.messageAccessor.message("common.period"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 기간 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("modifyDate", this.messageAccessor.message("common.modifyDate"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 최종 변경일 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyName", this.messageAccessor.message("common.company"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 업체 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("ispName", this.messageAccessor.message("common.isp"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // ISP |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("hostingName", this.messageAccessor.message("common.hosting"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 호스팅 |
| | | |
| | | |
| | | // 사용자 정의 필드를 사용한 이슈를 찾는다. 만약 이슈가 없다면 여기서 이슈 조회가 끝난다. |
| | |
| | | issueCompanyVo.setRegionName(region.getUseValue()); |
| | | } |
| | | if (issueCompany.getStatusId() != null && issueCompany.getStatusId() != -1) { |
| | | CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId()); |
| | | issueCompanyVo.setStatusName(status.getUseValue()); |
| | | if (issueCompany.getStatusName() != null && !issueCompany.getStatusName().equals("")) { |
| | | issueCompanyVo.setStatusName(issueCompany.getStatusName()); |
| | | } else { |
| | | CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId()); |
| | | issueCompanyVo.setStatusName(status.getUseValue()); |
| | | } |
| | | } |
| | | } |
| | | issueCompanyVos.add(issueCompanyVo); |
| | |
| | | result.put("departments", CommonUtil.convertDepartmentVosToString(issueVo.getDepartmentVos())); |
| | | result.put("priorityName", issueVo.getPriorityName()); |
| | | result.put("severityName", issueVo.getSeverityName()); |
| | | result.put("companyName", issueVo.getCompanyName()); |
| | | result.put("ispName", issueVo.getIspName()); |
| | | result.put("hostingName", issueVo.getHostingName()); |
| | | |
| | | UserVo register = this.userService.removeSensitiveUser(issueVo.getRegisterId()); |
| | | // 등록자 |
| | |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.importance"), 5, ExportExcelAttrVo.ALIGN_CENTER)); // 중요도 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.startDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 시작일 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.endDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 종료일 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.company"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 업체 |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.isp"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // ISP |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.hosting"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 호스팅 |
| | | // 프로젝트에 연결된 사용자 정의 필드 정보를 추출하여 엑셀 download 템플릿을 만든다. |
| | | this.makeIssueExcelTemplateCustomFields(excelInfo, conditions); |
| | | // 엑셀에 넣을 데이터 - IssueVos 데이터를 엑셀에서 표시할 수 있는 데이터로 변경한다. |
| | |
| | | Map<Long, Long> issueNumberMaps = new HashMap<>(); // 이슈 번호 모음 |
| | | Map<String, Long> issueTypeCustomFieldMaps = new HashMap<>(); // 이슈 타입 + 사용자 정의 필드 연결 정보 |
| | | |
| | | Map<String, CompanyField> companyFieldMaps = new HashMap<>(); //업체 모음 |
| | | Map<String, IspField> ispFieldMaps = new HashMap<>(); //isp 모음 |
| | | Map<String, HostingField> hostingFieldMaps = new HashMap<>(); //호스팅 모음 |
| | | |
| | | Workspace workspace = this.workspaceService.getWorkspace(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); // 이슈를 넣으려는 업무 공간 |
| | | // 이슈의 주요 속성을 map 에 저장하여 엑셀 import 에서 지정한 대상(이슈 속성)을 빠르게 찾을 수 있게 한다. |
| | | this.IssueAttributeMapToList(issueForm, priorityMaps, severityMaps, departmentMaps, customFieldMaps, issueTypeCustomFieldMaps); |
| | | this.IssueAttributeMapToList(issueForm, priorityMaps, severityMaps, departmentMaps, customFieldMaps, |
| | | issueTypeCustomFieldMaps, companyFieldMaps, ispFieldMaps, hostingFieldMaps); |
| | | // 0.237 - 0.230 |
| | | |
| | | List<IssueForm> issueForms = Lists.newArrayList(); |
| | |
| | | // 1번 헤더부터 데이터 영역 |
| | | if (rowIndex > 1) { |
| | | // 이슈로 등록하기 위해 IssueForm 에 데이터를 셋팅한다. |
| | | IssueForm newIssueForm = this.setIssueFormToExcelField(row, (rowIndex + 1), priorityMaps, severityMaps, departmentMaps, customFieldMaps, headers); |
| | | IssueForm newIssueForm = this.setIssueFormToExcelField(row, (rowIndex + 1), priorityMaps, severityMaps, departmentMaps, customFieldMaps, |
| | | companyFieldMaps, ispFieldMaps, hostingFieldMaps, headers); |
| | | ConvertUtil.copyProperties(issueForm, newIssueForm); |
| | | |
| | | |
| | | |
| | | issueForms.add(newIssueForm); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | saveIssueForm.setIssueStatusId(issueStatus.getId()); |
| | | |
| | | this.setIssuePartners(saveIssueForm, issue); |
| | | } |
| | | |
| | | |
| | |
| | | // 이슈 담당자 벌크 등록 |
| | | this.bulkInsertIssueAssignee(issueForms, workspace); |
| | | // 0.361 - 0.705 |
| | | |
| | | |
| | | // 1.816 |
| | | /*StopWatch serviceStart = new StopWatch(); |
| | | serviceStart.start();*/ |
| | |
| | | // 증가된 이슈 번호를 업데이트 한다. |
| | | // issueNumberMaps.put(issueForm.getProjectId(), issueForm.getProjectId()); |
| | | // this.issueNumberGeneratorService.updateIssueNumber(issueNumberMaps); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 엑셀로 입력한 파트너 정보 저장 |
| | | * @param issueForm IssueForm |
| | | */ |
| | | private void setIssuePartners(IssueForm issueForm, Issue issue) { |
| | | //issueCompany 등록 |
| | | if (issueForm.getIssueCompanyFields() != null && issueForm.getIssueCompanyFields().size() > 0) { |
| | | for (Map<String, Object> issueCompanyMap : issueForm.getIssueCompanyFields()) { |
| | | CompanyField companyField = ConvertUtil.convertMapToClass(issueCompanyMap, CompanyField.class); |
| | | IssueCompany issueCompany = ConvertUtil.convertMapToClass(issueCompanyMap, IssueCompany.class); |
| | | issueCompany.setCompanyField(companyField); |
| | | issueCompany.setIssue(issue); |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | |
| | | // 업체의 ISP가 있는 경우 issueISP 등록 |
| | | if (companyField.getIspId() != null) { |
| | | IspField ispField = this.ispFieldService.getIsp(companyField.getIspId()); |
| | | IssueIsp issueIsp = ConvertUtil.copyProperties(ispField, IssueIsp.class); |
| | | issueIsp.setIspField(ispField); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | | } |
| | | // 업체의 호스팅이 있는 경우 issueHosting 등록 |
| | | if (companyField.getHostingId() != null) { |
| | | HostingField hostingField = this.hostingFieldService.getHosting(companyField.getHostingId()); |
| | | IssueHosting issueHosting = ConvertUtil.copyProperties(hostingField, IssueHosting.class); |
| | | issueHosting.setHostingField(hostingField); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |
| | | //issueIsp 등록 |
| | | if (issueForm.getIssueIspFields() != null && issueForm.getIssueIspFields().size() > 0) { |
| | | for (Map<String, Object> issueIspMap : issueForm.getIssueIspFields()) { |
| | | IssueIsp issueIsp = ConvertUtil.convertMapToClass(issueIspMap, IssueIsp.class); |
| | | IspField ispField = ConvertUtil.convertMapToClass(issueIspMap, IspField.class); |
| | | issueIsp.setIspField(ispField); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | | } |
| | | } |
| | | //issueHosting 등록 |
| | | if (issueForm.getIssueHostingFields() != null && issueForm.getIssueHostingFields().size() > 0) { |
| | | for (Map<String, Object> issueHostingMap : issueForm.getIssueHostingFields()) { |
| | | IssueHosting issueHosting = ConvertUtil.convertMapToClass(issueHostingMap, IssueHosting.class); |
| | | HostingField hostingField = ConvertUtil.convertMapToClass(issueHostingMap, HostingField.class); |
| | | issueHosting.setHostingField(hostingField); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | issueCustomField.put("registerId", this.webAppUtil.getLoginId()); |
| | | issueCustomFieldValueMaps.add(issueCustomField); |
| | | } |
| | | IssueForm partners = this.findCompanyField(issueForm); // 같은 도메인 업체 찾기 |
| | | Issue issue = this.findOne(issueForm.getId()); |
| | | if (partners.getIssueCompanyFields() != null && partners.getIssueCompanyFields().size() > 0) { |
| | | for (Map<String, Object> company : partners.getIssueCompanyFields()) { |
| | | IssueCompany issueCompany = ConvertUtil.convertMapToClass(company, IssueCompany.class); |
| | | issueCompany.setIssue(issue); |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | |
| | | // 엑셀에 업체명을 입력하지 않았을 경우 같은 도메인 업체 찾기 |
| | | if (issueForm.getIssueCompanyFields() == null || issueForm.getIssueCompanyFields().size() < 1) { |
| | | // 같은 도메인 업체 찾기 |
| | | IssueForm partners = this.findCompanyField(issueForm); |
| | | Issue issue = this.findOne(issueForm.getId()); |
| | | if (partners.getIssueCompanyFields() != null && partners.getIssueCompanyFields().size() > 0) { |
| | | for (Map<String, Object> company : partners.getIssueCompanyFields()) { |
| | | IssueCompany issueCompany = ConvertUtil.convertMapToClass(company, IssueCompany.class); |
| | | CompanyField companyField = ConvertUtil.convertMapToClass(company, CompanyField.class); |
| | | issueCompany.setCompanyField(companyField); |
| | | issueCompany.setIssue(issue); |
| | | |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | } |
| | | } |
| | | } |
| | | if (partners.getIssueIspFields() != null && partners.getIssueIspFields().size() > 0) { |
| | | for (Map<String, Object> isp : partners.getIssueIspFields()) { |
| | | IssueIsp issueIsp = ConvertUtil.convertMapToClass(isp, IssueIsp.class); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | | if (partners.getIssueIspFields() != null && partners.getIssueIspFields().size() > 0) { |
| | | for (Map<String, Object> isp : partners.getIssueIspFields()) { |
| | | IssueIsp issueIsp = ConvertUtil.convertMapToClass(isp, IssueIsp.class); |
| | | IspField ispField = ConvertUtil.convertMapToClass(isp, IspField.class); |
| | | issueIsp.setIspField(ispField); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | | } |
| | | } |
| | | } |
| | | if (partners.getIssueHostingFields() != null && partners.getIssueHostingFields().size() > 0) { |
| | | for (Map<String, Object> hosting : partners.getIssueHostingFields()) { |
| | | IssueHosting issueHosting = ConvertUtil.convertMapToClass(hosting, IssueHosting.class); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | if (partners.getIssueHostingFields() != null && partners.getIssueHostingFields().size() > 0) { |
| | | for (Map<String, Object> hosting : partners.getIssueHostingFields()) { |
| | | IssueHosting issueHosting = ConvertUtil.convertMapToClass(hosting, IssueHosting.class); |
| | | HostingField hostingField = ConvertUtil.convertMapToClass(hosting, HostingField.class); |
| | | issueHosting.setHostingField(hostingField); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // 이슈의 주요 속성을 map 에 저장하여 엑셀 import 에서 지정한 대상(이슈 속성)을 빠르게 찾을 수 있게 한다. |
| | | private void IssueAttributeMapToList(IssueForm issueForm, Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps, |
| | | Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps,Map<String, Long> issueTypeCustomFieldMaps) { |
| | | Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps,Map<String, Long> issueTypeCustomFieldMaps, |
| | | Map<String, CompanyField> companyFieldMaps, Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps) { |
| | | |
| | | Project project = this.projectService.getProject(issueForm.getProjectId()); |
| | | |
| | |
| | | for (CustomField customField : customFields) { |
| | | customFieldMaps.put(customField.getName(), customField); |
| | | } |
| | | |
| | | // 업체 정보를 바로 찾을 수 있게 준비 |
| | | List<CompanyField> companyFields = this.companyFieldService.findAll(); |
| | | for (CompanyField companyField : companyFields) { |
| | | companyFieldMaps.put(companyField.getName(), companyField); |
| | | } |
| | | // ISP 정보를 바로 찾을 수 있게 준비 |
| | | List<IspField> ispFields = this.ispFieldService.findAll(); |
| | | for (IspField ispField : ispFields) { |
| | | ispFieldMaps.put(ispField.getName(), ispField); |
| | | } |
| | | // 호스팅 정보를 바로 찾을 수 있게 준비 |
| | | List<HostingField> hostingFields = this.hostingFieldService.findAll(); |
| | | for (HostingField hostingField : hostingFields) { |
| | | hostingFieldMaps.put(hostingField.getName(), hostingField); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | // 엑셀 필드에 있는 정보를 이슈 form 으로 옮긴다. |
| | | private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps, |
| | | Map<String, Severity> severityMaps, Map<String, DepartmentVo> departmentMaps, |
| | | Map<String, CustomField> customFieldMaps, List<String> headers) { |
| | | Map<String, CustomField> customFieldMaps, Map<String, CompanyField> companyFieldMaps, |
| | | Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps, |
| | | List<String> headers) { |
| | | IssueForm issueForm = new IssueForm(); |
| | | issueForm.setRegisterId(this.webAppUtil.getLoginId()); |
| | | Project project = null; |
| | |
| | | this.setIssueFormPeriod(cell, issueForm, false, rowIndex); |
| | | } |
| | | break; |
| | | case 6: |
| | | // 업체를 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | this.setIssueFormCompanyField(cell, companyFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | | case 7: |
| | | // ISP를 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | this.setIssueFormIspField(cell, ispFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | | case 8: |
| | | // 호스팅을 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | this.setIssueFormHostingField(cell, hostingFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | | default: |
| | | // 9번 부터는 사용자 정의 필드. 사용자 정의 필드 정보를 IssueForm 에 저장한다. |
| | | this.setIssueFormCustomFieldValue(cell, customFieldMaps, issueForm, headers.get(cellIndex), rowIndex); |
| | |
| | | return issueForm; |
| | | } |
| | | |
| | | private void setIssueFormHostingField(Cell cell, Map<String, HostingField> hostingFieldMaps, IssueForm issueForm, int rowIndex) { |
| | | if (cell != null) { |
| | | Map<String, Object> issueHostingFields = new HashMap<>(); |
| | | HostingField hostingFieldMap = hostingFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); |
| | | if (hostingFieldMap == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_HOSTING_NOT_EXIST, rowIndex)); |
| | | } |
| | | ConvertUtil.copyProperties(hostingFieldMap, issueHostingFields); |
| | | issueForm.addIssueHostingField(issueHostingFields); |
| | | } |
| | | } |
| | | |
| | | private void setIssueFormIspField(Cell cell, Map<String, IspField> ispFieldMaps, IssueForm issueForm, int rowIndex) { |
| | | if (cell != null) { |
| | | Map<String, Object> issueIspFields = new HashMap<>(); |
| | | IspField ispFieldMap = ispFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); |
| | | if (ispFieldMap == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISP_NOT_EXIST, rowIndex)); |
| | | } |
| | | ConvertUtil.copyProperties(ispFieldMap, issueIspFields); |
| | | issueForm.addIssueIspField(issueIspFields); |
| | | } |
| | | } |
| | | |
| | | private void setIssueFormCompanyField(Cell cell, Map<String, CompanyField> companyFieldMaps, IssueForm issueForm, int rowIndex) { |
| | | if (cell != null) { |
| | | Map<String, Object> issueCompanyFields = new HashMap<>(); |
| | | CompanyField companyFieldMap = companyFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); |
| | | if (companyFieldMap == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_NOT_EXIST, rowIndex)); |
| | | } |
| | | ConvertUtil.copyProperties(companyFieldMap, issueCompanyFields); |
| | | issueForm.addissueCompanyField(issueCompanyFields); |
| | | } |
| | | } |
| | | |
| | | // 이슈 제목을 IssueForm 에 저장한다. |
| | | private void setIssueFormTitle(Cell cell, IssueForm issueForm, int rowIndex) { |
| | | if (cell == null) { |