| | |
| | | * @param cell Cell |
| | | * @return boolean |
| | | */ |
| | | private Boolean cellNullCheck (Cell cell) { |
| | | if (cell != null && cell.getStringCellValue() != null) { |
| | | cell.setCellValue(cell.getStringCellValue().trim());//셀 값 공백 제거 |
| | | private Boolean cellNullCheck (Cell cell, int rowIndex) { |
| | | boolean result = false; |
| | | |
| | | // 문자형식인지 체크 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && cell.getCellType() != Cell.CELL_TYPE_STRING) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_NOT_STRING_TYPE, rowIndex)); |
| | | } |
| | | return cell != null && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("") && cell.getCellType() != Cell.CELL_TYPE_BLANK; |
| | | // 공백 제거 |
| | | if (cell != null && cell.getStringCellValue() != null) { |
| | | cell.setCellValue(cell.getStringCellValue().trim()); |
| | | } |
| | | |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && cell.getCellType() == cell.CELL_TYPE_STRING |
| | | && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("")) { |
| | | result = true; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | // 엑셀 필드에 있는 정보를 이슈 form 으로 옮긴다. |
| | |
| | | break; |
| | | |
| | | case 1: // 내용 |
| | | if (cellNullCheck(cell)) { |
| | | if (cellNullCheck(cell, rowIndex)) { |
| | | issueForm.setDescription(CommonUtil.convertExcelStringToCell(cell)); |
| | | } else { |
| | | // null 입력 방지 |
| | |
| | | break;*/ |
| | | case 4: |
| | | // 시작일을 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | this.setIssueFormPeriod(cell, issueForm, true, rowIndex); |
| | | } |
| | | break; |
| | | case 5: |
| | | // 종료일을 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | this.setIssueFormPeriod(cell, issueForm, false, rowIndex); |
| | | } |
| | | break; |
| | | case 6: |
| | | // 업체를 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | if (cellNullCheck(cell, rowIndex)) { |
| | | this.setIssueFormCompanyField(cell, companyFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | | case 7: |
| | | // ISP를 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | if (cellNullCheck(cell, rowIndex)) { |
| | | this.setIssueFormIspField(cell, ispFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | | case 8: |
| | | // 호스팅을 IssueForm 에 저장한다. |
| | | if (cellNullCheck(cell)) { |
| | | if (cellNullCheck(cell, rowIndex)) { |
| | | this.setIssueFormHostingField(cell, hostingFieldMaps, issueForm, rowIndex); |
| | | } |
| | | break; |
| | |
| | | |
| | | // 이슈 제목을 IssueForm 에 저장한다. |
| | | private void setIssueFormTitle(Cell cell, IssueForm issueForm, int rowIndex) { |
| | | if (!cellNullCheck(cell)) { |
| | | if (!cellNullCheck(cell, rowIndex)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TITLE_IS_NULL, rowIndex)); |
| | | } |
| | |
| | | |
| | | // 우선순위를 IssueForm 에 저장한다. |
| | | private void setIssueFormPriority(Cell cell, Map<String, Priority> priorityMaps, IssueForm issueForm, int rowIndex) { |
| | | if (!cellNullCheck(cell)) { |
| | | if (!cellNullCheck(cell, rowIndex)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PRIORITY_IS_NULL, rowIndex)); |
| | | } |
| | |
| | | |
| | | // 중요도를 IssueForm 에 저장한다. |
| | | private void setIssueFormSeverity(Cell cell, Map<String, Severity> severityMaps, IssueForm issueForm, int rowIndex) { |
| | | if (!cellNullCheck(cell)) { |
| | | if (!cellNullCheck(cell, rowIndex)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_SEVERITY_IS_NULL, rowIndex)); |
| | | } |
| | |
| | | |
| | | // 값이 공백이면 중지 |
| | | String cellValue = CommonUtil.convertExcelStringToCell(cell); |
| | | if (StringUtils.isEmpty(cellValue) || !cell.toString().equals("null")) { |
| | | if (StringUtils.isEmpty(cellValue) || cell.toString().equals("null")) { |
| | | return; |
| | | } |
| | | |
| | | if (cell.toString().length() < 10 && cell.toString().contains("-")) { //날짜 형식 체크 |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PERIOD_NOT_DASH, rowIndex)); |
| | | } |
| | | |
| | | Date startDate; |
| | |
| | | issueForm.setStartDate(DateUtil.convertDateToStr(startDate, "yyyy-MM-dd")); |
| | | } else { |
| | | issueForm.setCompleteDate(DateUtil.convertDateToStr(startDate, "yyyy-MM-dd")); |
| | | |
| | | // 종료일만 입력 했을 경우 |
| | | if (issueForm.getCompleteDate() != null && issueForm.getStartDate() == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PERIOD_NOT_VALIDITY_EMPTY_START, rowIndex)); |
| | | } |
| | | |
| | | try { |
| | | // 날짜 유효성 체크 |
| | |
| | | |
| | | // 사용자 정의 필드 정보를 IssueForm 에 저장한다.- |
| | | private void setIssueFormCustomFieldValue(Cell cell, Map<String, CustomField> customFieldMaps, IssueForm issueForm, String customFieldName, int rowIndex) { |
| | | if (!cellNullCheck(cell)) { |
| | | if (cell != null) { |
| | | String cellValue = CommonUtil.convertExcelStringToCell(cell); |
| | | Map<String, Object> issueCustomFieldMap = new HashMap<>(); |
| | | CustomField customField = customFieldMaps.get(customFieldName); |
| | |
| | | } |
| | | |
| | | if (customField.getCustomFieldType() == DATETIME) { //DATETIME일 경우 format 변경 |
| | | if (cell.toString().length() < 10 && cell.toString().contains("-")) { //날짜 형식 체크 |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_DATETIME_NOT_DASH, rowIndex)); |
| | | } |
| | | Date date = cell.getDateCellValue(); |
| | | cellValue = new SimpleDateFormat("yyyy-MM-dd H:mm:ss").format(date); |
| | | } |