| | |
| | | |
| | | Workbook workbook; |
| | | |
| | | IssueType issueType = new IssueType(); |
| | | Workflow workflow = new Workflow(); |
| | | |
| | | workbook = WorkbookFactory.create(multipartFile.getInputStream()); |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int lastRowNum = sheet.getLastRowNum() + 1; |
| | |
| | | companyFieldMaps, ispFieldMaps, hostingFieldMaps, headers); |
| | | ConvertUtil.copyProperties(issueForm, newIssueForm); |
| | | |
| | | Project project = this.projectService.getProject(newIssueForm.getProjectId()); |
| | | Long issueNumber = this.issueNumberGeneratorService.generateIssueNumber(project); |
| | | newIssueForm.setIssueNumber(issueNumber); |
| | | |
| | | issueType = this.issueTypeService.getIssueType(newIssueForm.getIssueTypeId()); |
| | | workflow = issueType.getWorkflow(); |
| | | IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(workflow); |
| | | |
| | | newIssueForm.setIssueStatusId(issueStatus.getId()); |
| | | issueForms.add(newIssueForm); |
| | | } |
| | | } |
| | |
| | | } |
| | | // 1.176 |
| | | |
| | | |
| | | // 이슈 등록 |
| | | // this.issueMapper.insertBatch(issueForms); |
| | | this.issueMapper.insertBatch(issueForms); |
| | | |
| | | for (IssueForm saveIssueForm : issueForms) { |
| | | Issue issue = new Issue(); |
| | | ConvertUtil.copyProperties(saveIssueForm, issue); |
| | | |
| | | IssueType issueType = this.issueTypeService.getIssueType(saveIssueForm.getIssueTypeId()); |
| | | Workflow workflow = issueType.getWorkflow(); |
| | | |
| | | Project project = this.projectService.getProject(saveIssueForm.getProjectId()); |
| | | Long issueNumber = this.issueNumberGeneratorService.generateIssueNumber(project); |
| | | |
| | | IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(workflow); |
| | | |
| | | issue.setPriority(this.priorityService.getPriority(saveIssueForm.getPriorityId())); |
| | | issue.setSeverity(this.severityService.getSeverity(saveIssueForm.getSeverityId())); |
| | | issue.setIssueStatus(issueStatus); |
| | | issue.setIssueType(issueType); |
| | | issue.setProject(project); |
| | | issue.setIssueNumber(issueNumber); |
| | | if (saveIssueForm.getParentIssueId() != null && saveIssueForm.getParentIssueId() > -1) { |
| | | issue.setParentIssue(this.getIssue(saveIssueForm.getParentIssueId())); |
| | | } |
| | | |
| | | issue = this.issueRepository.saveAndFlush(issue); |
| | | |
| | | if (issueForm.getInheritYn() != null && issueForm.getInheritYn() && issue.getParentIssue() != null) { |
| | | if (issueForm.getInheritYn() != null && issueForm.getInheritYn() && issueForm.getParentIssueId() != null) { |
| | | Issue parentIssue = this.getIssue(issueForm.getParentIssueId()); |
| | | // 상위이슈의 파트너 정보 상속 |
| | | this.inheritPartners(issue, issue.getParentIssue()); |
| | | this.inheritPartners(issue, parentIssue); |
| | | } |
| | | |
| | | saveIssueForm.setId(issue.getId()); |
| | |
| | | issueDepartment.setIssue(issue); |
| | | issueDepartment.setWorkspace(workspace); |
| | | |
| | | |
| | | List<Long> departmentsIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow); |
| | | if (departmentsIds != null && departmentsIds.size() > 0) { |
| | | for (Long departmentId : departmentsIds) { |
| | |
| | | } |
| | | issue.addIssueDepartment(issueDepartment); |
| | | } |
| | | |
| | | saveIssueForm.setIssueStatusId(issueStatus.getId()); |
| | | |
| | | this.setIssuePartners(saveIssueForm, issue); |
| | | } |
| | |
| | | * @param issueForm IssueForm |
| | | */ |
| | | private void setIssuePartners(IssueForm issueForm, Issue issue) { |
| | | IssueCompany issueCompany = new IssueCompany(); |
| | | IssueIsp issueIsp = new IssueIsp(); |
| | | IssueHosting issueHosting = new IssueHosting(); |
| | | //issueCompany 등록 |
| | | if (issueForm.getIssueCompanyFields() != null && issueForm.getIssueCompanyFields().size() > 0) { |
| | | for (Map<String, Object> issueCompanyMap : issueForm.getIssueCompanyFields()) { |
| | | CompanyField companyField = ConvertUtil.convertMapToClass(issueCompanyMap, CompanyField.class); |
| | | issueCompany = ConvertUtil.convertMapToClass(issueCompanyMap, IssueCompany.class, "id"); |
| | | IssueCompany issueCompany = ConvertUtil.convertMapToClass(issueCompanyMap, IssueCompany.class, "id", "registerDate", "modifyDate"); |
| | | issueCompany.setCompanyField(companyField); |
| | | issueCompany.setIssue(issue); |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | |
| | | // 사용자가 ISP를 직접 입력하지 않았을 경우 업체에 등록되어있는 ISP 설정 |
| | | // 사용자가 ISP를 직접 입력하지 않았을 경우 업체에 등록되어있는 ISP 설정 |
| | | if (issueForm.getIssueIspFields() == null || issueForm.getIssueIspFields().size() < 1) { |
| | | // 업체의 ISP가 있는 경우 issueISP 등록 |
| | | if (companyField.getIspId() != null && companyField.getIspId() != -1) { |
| | | IspField ispField = this.ispFieldService.getIsp(companyField.getIspId()); |
| | | issueIsp = ConvertUtil.copyProperties(ispField, IssueIsp.class, "id"); |
| | | IssueIsp issueIsp = ConvertUtil.copyProperties(ispField, IssueIsp.class, "id", "registerDate", "modifyDate"); |
| | | issueIsp.setIspField(ispField); |
| | | issueIsp.setIssue(issue); |
| | | this.issueIspRepository.saveAndFlush(issueIsp); |
| | |
| | | // 업체의 호스팅이 있는 경우 issueHosting 등록 |
| | | if (companyField.getHostingId() != null && companyField.getHostingId() != -1) { |
| | | HostingField hostingField = this.hostingFieldService.getHosting(companyField.getHostingId()); |
| | | issueHosting = ConvertUtil.copyProperties(hostingField, IssueHosting.class, "id"); |
| | | IssueHosting issueHosting = ConvertUtil.copyProperties(hostingField, IssueHosting.class, "id", "registerDate", "modifyDate"); |
| | | 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 = ConvertUtil.convertMapToClass(issueIspMap, IssueIsp.class, "id"); |
| | | IssueIsp issueIsp = ConvertUtil.convertMapToClass(issueIspMap, IssueIsp.class, "id", "registerDate", "modifyDate"); |
| | | IspField ispField = ConvertUtil.convertMapToClass(issueIspMap, IspField.class); |
| | | issueIsp.setIspField(ispField); |
| | | issueIsp.setIssue(issue); |
| | |
| | | //issueHosting 등록 |
| | | if (issueForm.getIssueHostingFields() != null && issueForm.getIssueHostingFields().size() > 0) { |
| | | for (Map<String, Object> issueHostingMap : issueForm.getIssueHostingFields()) { |
| | | issueHosting = ConvertUtil.convertMapToClass(issueHostingMap, IssueHosting.class, "id"); |
| | | IssueHosting issueHosting = ConvertUtil.convertMapToClass(issueHostingMap, IssueHosting.class, "id", "registerDate", "modifyDate"); |
| | | HostingField hostingField = ConvertUtil.convertMapToClass(issueHostingMap, HostingField.class); |
| | | issueHosting.setHostingField(hostingField); |
| | | issueHosting.setIssue(issue); |
| | |
| | | } |
| | | |
| | | // 엑셀에 업체명을 입력하지 않았을 경우 같은 도메인 업체 찾기 |
| | | 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); |
| | | 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); |
| | | HostingField hostingField = ConvertUtil.convertMapToClass(hosting, HostingField.class); |
| | | issueHosting.setHostingField(hostingField); |
| | | issueHosting.setIssue(issue); |
| | | this.issueHostingRepository.saveAndFlush(issueHosting); |
| | | } |
| | | } |
| | | } |
| | | this.findPartnerByDomain(issueForm); |
| | | } |
| | | |
| | | if (issueCustomFieldValueMaps.size() > 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 엑셀에 업체명을 입력하지 않았을 경우 같은 도메인 업체 찾기 |
| | | * @param issueForm IssueForm |
| | | */ |
| | | private void findPartnerByDomain(IssueForm issueForm) { |
| | | 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); |
| | | 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); |
| | | 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, |