From dea4bb128425e06684bf95e8e97613a20cf3bcfa Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 월, 24 1월 2022 18:10:31 +0900 Subject: [PATCH] 이슈 테이블 표시 설정 10 이상 정렬 오류 해결 --- src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java | 129 ++++++++++++++++++++++++++++--------------- 1 files changed, 84 insertions(+), 45 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java index a5a4271..80f374d 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java @@ -142,6 +142,40 @@ return this.companyFieldMapper.find(condition); } + /** + * companyFieldCategory Name �꽕�젙 + * @param companyFieldVo CompanyFieldVo + * @param companyField CompanyField + */ + @Override + public CompanyFieldVo CreateCompanyFieldCategory(CompanyFieldVo companyFieldVo, CompanyField companyField) { + if (companyField.getCompanyTypeId() != null && companyField.getCompanyTypeId() != -1) { + CompanyFieldCategory companyType = this.companyFieldCategoryService.find(companyField.getCompanyTypeId()); + if (companyType != null) { + companyFieldVo.setCompanyTypeName(companyType.getUseValue()); + } + } + if (companyField.getParentSectorId() != null && companyField.getParentSectorId() != -1) { + CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(companyField.getParentSectorId()); + if (parentSector != null) { + companyFieldVo.setParentSectorName(parentSector.getUseValue()); + } + } + if (companyField.getChildSectorId() != null && companyField.getChildSectorId() != -1) { + CompanyFieldCategory childSector = this.companyFieldCategoryService.find(companyField.getChildSectorId()); + if (childSector != null) { + companyFieldVo.setChildSectorName(childSector.getUseValue()); + } + } + if (companyField.getRegionId() != null && companyField.getRegionId() != -1) { + CompanyFieldCategory region = this.companyFieldCategoryService.find(companyField.getRegionId()); + if (region != null) { + companyFieldVo.setRegionName(region.getUseValue()); + } + } + return companyFieldVo; + } + // �뾽泥� �긽�꽭 議고쉶�븳�떎. @Override @Transactional @@ -166,36 +200,7 @@ ispFieldVo = ConvertUtil.copyProperties(ispField, IspFieldVo.class); hostingFieldVo = ConvertUtil.copyProperties(hostingField, HostingFieldVo.class); - if (companyField.getCompanyTypeId() != null && companyField.getCompanyTypeId() != -1) { - CompanyFieldCategory companyType = this.companyFieldCategoryService.find(companyField.getCompanyTypeId()); - if (companyType != null) { - companyFieldVo.setCompanyTypeName(companyType.getUseValue()); - } - } - if (companyField.getParentSectorId() != null && companyField.getParentSectorId() != -1) { - CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(companyField.getParentSectorId()); - if (parentSector != null) { - companyFieldVo.setParentSectorName(parentSector.getUseValue()); - } - } - if (companyField.getChildSectorId() != null && companyField.getChildSectorId() != -1) { - CompanyFieldCategory childSector = this.companyFieldCategoryService.find(companyField.getChildSectorId()); - if (childSector != null) { - companyFieldVo.setChildSectorName(childSector.getUseValue()); - } - } - if (companyField.getRegionId() != null && companyField.getRegionId() != -1) { - CompanyFieldCategory region = this.companyFieldCategoryService.find(companyField.getRegionId()); - if (region != null) { - companyFieldVo.setRegionName(region.getUseValue()); - } - } - /*if (companyField.getStatusId() != null && companyField.getStatusId() != -1) { - CompanyFieldCategory status = this.companyFieldCategoryService.find(companyField.getStatusId()); - if (status != null) { - companyFieldVo.setStatusName(status.getUseValue()); - } - }*/ + CreateCompanyFieldCategory(companyFieldVo, companyField); companyFieldVo.setIspFieldVo(ispFieldVo); companyFieldVo.setHostingFieldVo(hostingFieldVo); @@ -414,6 +419,15 @@ } } + /** + * cell NULL 泥댄겕 �븿�닔 + * @param cell Cell + * @return boolean + */ + private Boolean cellNullCheck (Cell cell) { + return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK; + } + // �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �뾽泥� form �쑝濡� �삷湲대떎. private CompanyFieldForm setCompanyFieldFormToExcelField(Row row, int rowIndex, Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps, Map<String, Map<String, Object>> companyTypeMaps, Map<String, Map<String, Object>> parentSectorMaps, @@ -438,76 +452,76 @@ case 2: // isp紐� - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormIspName(cell, ispFieldMaps, companyFieldForm, rowIndex); } break; case 3: // �샇�뒪�똿紐� - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormHostingName(cell, hostingFieldMaps, companyFieldForm, rowIndex); } break; case 4: // �뿰�씫泥� - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormTel(cell, companyFieldForm, rowIndex); } break; case 5: // �씠硫붿씪 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormEmail(cell, companyFieldForm, rowIndex); } break; case 6: // �떞�떦�옄 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormManager(cell, companyFieldForm, rowIndex); } break; case 7: // 湲곗뾽援щ텇 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormCompanyType(cell, companyTypeMaps, companyFieldForm, rowIndex); } break; case 8: // �뾽醫�(��遺꾨쪟) - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormParentSector(cell, parentSectorMaps, companyFieldForm, rowIndex); } break; case 9: // �뾽醫�(以묐텇瑜�) - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormChildSector(cell, childSectorMaps, companyFieldForm, rowIndex); } break; case 10: // 吏��뿭 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormRegion(cell, regionMaps, companyFieldForm, rowIndex); } break; case 11: // �긽�깭 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormStatus(cell, statusMaps, companyFieldForm, rowIndex); } case 12: // 鍮꾧퀬 - if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { + if (cellNullCheck(cell)) { this.setCompanyFormMemo(cell, companyFieldForm, rowIndex); } break; @@ -585,19 +599,29 @@ private void setCompanyFormEmail(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { if (cell != null) { - companyFieldForm.setEmail(CommonUtil.convertExcelStringToCell(cell)); + String email = CommonUtil.convertExcelStringToCell(cell); + if (CommonUtil.convertExcelStringToCell(cell).contains(" ")) { + email = CommonUtil.convertExcelStringToCell(cell).replace(" ", ""); + } + companyFieldForm.setEmail(email); } } private void setCompanyFormTel(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { if (cell != null) { - companyFieldForm.setTel(CommonUtil.convertExcelStringToCell(cell)); + String tel = CommonUtil.convertExcelStringToCell(cell); + if (tel.contains("-")) { + tel = tel.replace("-", ""); + } + if (tel.contains(" ")) { + tel = tel.replace(" ", ""); + } + companyFieldForm.setTel(tel); } } private void setCompanyFormHostingName(Cell cell, Map<String, HostingField> hostingFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex) { if (cell != null) { - HostingField hostingField = hostingFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); if (hostingField == null) { throw new OwlRuntimeException( @@ -609,7 +633,6 @@ private void setCompanyFormIspName(Cell cell, Map<String, IspField> ispFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex) { if (cell != null) { - IspField ispField = ispFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); if (ispField == null) { throw new OwlRuntimeException( @@ -638,6 +661,9 @@ this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_URL_IS_NULL, rowIndex)); } String url = CommonUtil.convertExcelStringToCell(cell); + if (url.contains(" ")) { + url = url.replace(" ", ""); + } this.verifyUrl(url, null); //url �쑀�슚�꽦 寃��궗 companyFieldForm.setUrl(url); @@ -673,6 +699,19 @@ CompanyFieldCondition companyFieldCondition = CompanyFieldCondition.make(conditions); List<Map<String, Object>> results = this.companyFieldMapper.find(companyFieldCondition); + CompanyFieldVo companyFieldVo = new CompanyFieldVo(); + + if (results != null && results.size() > 0) { + for (Map<String, Object> result : results) { + CompanyField companyField = ConvertUtil.convertMapToClass(result, CompanyField.class); + CompanyFieldVo companyFieldVo2 = CreateCompanyFieldCategory(companyFieldVo, companyField); + + result.put("companyTypeName", companyFieldVo2.getCompanyTypeName()); + result.put("parentSectorName", companyFieldVo2.getParentSectorName()); + result.put("childSectorName", companyFieldVo2.getChildSectorName()); + result.put("regionName", companyFieldVo2.getRegionName()); + } + } List<CompanyFieldVo> companyFieldVos = ConvertUtil.convertListToListClass(results, CompanyFieldVo.class); // code_ko_KR �뿉 code紐� �꽕�젙 -- Gitblit v1.8.0