| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import static kr.wisestone.owl.domain.enumType.CustomFieldType.DATETIME; |
| | | import static kr.wisestone.owl.domain.enumType.CustomFieldType.INPUT; |
| | | import static kr.wisestone.owl.domain.enumType.CustomFieldType.*; |
| | | |
| | | @Service |
| | | public class IssueServiceImpl extends AbstractServiceImpl<Issue, Long, JpaRepository<Issue, Long>> implements IssueService { |
| | |
| | | issueApiForm.addUseIssueCustomFieldId(customFieldApiOverlap.getCustomField().getId()); |
| | | } |
| | | |
| | | // 종료상태가 아닌 중복된 상위 이슈검색 |
| | | // 중복된 상위 이슈검색 |
| | | List<Issue> issues = this.findIssue(issueApiForm, customFieldApiOverlaps, user.getId()); |
| | | int size = issues.size(); |
| | | if (size > 0) { |
| | |
| | | issueCustomFieldValueCondition.setUseValue(concatUseValue); |
| | | issueCustomFieldValueCondition.setUseValues(userValues); |
| | | issueCustomFieldValueCondition.setIssueTypeId(issueApiform.getIssueTypeId()); |
| | | issueCustomFieldValueCondition.setIssueStatusType("CLOSE"); |
| | | // issueCustomFieldValueCondition.setIssueStatusType("CLOSE"); |
| | | List<Map<String, Object>> results = this.issueMapper.findByCustomFieldValue(issueCustomFieldValueCondition); |
| | | if (results != null && results.size() > 0) { |
| | | for (Map<String, Object> result : results) { |
| | |
| | | if (issueForm.getParentIssueId() != null){ |
| | | Issue parentIssue = this.getIssue(issueForm.getParentIssueId()); |
| | | issue.setParentIssue(parentIssue); |
| | | |
| | | // 상위 이슈가 종료일경우 대기로 변경 |
| | | IssueStatus parentIssueStatus = parentIssue.getIssueStatus(); |
| | | if (parentIssueStatus.getIssueStatusType().equals(IssueStatusType.CLOSE)) { |
| | | parentIssue.setIssueStatus(issueStatus); |
| | | } |
| | | } |
| | | |
| | | issue.setIssueNumber(this.issueNumberGeneratorService.generateIssueNumber(project)); // 각 프로젝트의 고유 이슈 번호 생성 |
| | |
| | | // 이슈 담당자 벌크 등록 |
| | | this.bulkInsertIssueAssignee(issueForms, workspace); |
| | | // 0.361 - 0.705 |
| | | |
| | | |
| | | // 1.816 |
| | | /*StopWatch serviceStart = new StopWatch(); |
| | | serviceStart.start();*/ |
| | |
| | | issueCompany.setCompanyField(companyField); |
| | | issueCompany.setIssue(issue); |
| | | this.issueCompanyRepository.saveAndFlush(issueCompany); |
| | | |
| | | |
| | | // 사용자가 ISP를 직접 입력하지 않았을 경우 업체에 등록되어있는 ISP 설정 |
| | | if (issueForm.getIssueIspFields() == null || issueForm.getIssueIspFields().size() < 1) { |
| | | // 업체의 ISP가 있는 경우 issueISP 등록 |
| | |
| | | issueCustomField.put("registerId", this.webAppUtil.getLoginId()); |
| | | issueCustomFieldValueMaps.add(issueCustomField); |
| | | } |
| | | |
| | | |
| | | // 엑셀에 업체명을 입력하지 않았을 경우 같은 도메인 업체 찾기 |
| | | if (issueForm.getIssueCompanyFields() == null || issueForm.getIssueCompanyFields().size() < 1) { |
| | | // 같은 도메인 업체 찾기 |
| | |
| | | |
| | | /** |
| | | * cell NULL 체크 함수 |
| | | * 문자형식 cell 체크 |
| | | * 빈 값이 아닌 cell 체크 |
| | | * @param cell Cell |
| | | * @return boolean |
| | | */ |
| | | private Boolean cellNullCheck (Cell cell) { |
| | | if (cell != null ) { |
| | | if (cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cell.getCellType() == Cell.CELL_TYPE_STRING && cell.getStringCellValue() != null) { |
| | | int cellType = cell.getCellType(); |
| | | if (cellType < Cell.CELL_TYPE_BLANK) { |
| | | if (cellType == Cell.CELL_TYPE_STRING) |
| | | { |
| | | if (cell.getStringCellValue() != null && !cell.getStringCellValue().equals("")) { |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 엑셀 필드에 있는 정보를 이슈 form 으로 옮긴다. |
| | | private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps, |
| | |
| | | boolean isNull = cellNullCheck(cell); |
| | | |
| | | String cellStr = ""; |
| | | |
| | | if (!isNull) { |
| | | cellStr = CommonUtil.convertExcelStringToCell(cell); |
| | | |
| | |
| | | } |
| | | |
| | | if (checkStartDate) { |
| | | issueForm.setStartDate(periodDate); |
| | | issueForm.setStartDate(DateUtil.convertDateToStr(startDate, "yyyy-MM-dd")); |
| | | } else { |
| | | issueForm.setCompleteDate(periodDate); |
| | | |
| | | issueForm.setCompleteDate(DateUtil.convertDateToStr(startDate, "yyyy-MM-dd")); |
| | | |
| | | // 종료일만 입력 했을 경우 |
| | | if (issueForm.getCompleteDate() != null && issueForm.getStartDate() == null) { |
| | | throw new OwlRuntimeException( |
| | |
| | | this.checkStartCompleteDate(issueForm.getStartDate(), issueForm.getCompleteDate()); |
| | | } catch (OwlRuntimeException e) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PERIOD_NOT_VALIDITY, rowIndex)); |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PERIOD_NOT_VALID, rowIndex)); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.messageAccessor.getMessage(MsgConstants.CUSTOM_FIELD_TEXT_TYPE_MAX_LENGTH_OUT)); |
| | | } |
| | | |
| | | if (customField.getCustomFieldType() == DATETIME) { //DATETIME일 경우 format 변경 |
| | | //DATETIME일 경우 format 변경 |
| | | if (customField.getCustomFieldType() == DATETIME) { |
| | | Date date = DateUtil.convertStrToDate(cellValue); |
| | | if (date == null) { |
| | | throw new OwlRuntimeException( |
| | |
| | | } |
| | | } |
| | | |
| | | //IP_ADDRESS일 경우 정규표현식 체크 |
| | | if (customField.getCustomFieldType() == IP_ADDRESS) { |
| | | String regExp = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." |
| | | + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." |
| | | + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." |
| | | + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"; |
| | | |
| | | if (!cellValue.matches(regExp)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_IP_ADDRESS_NOT_VALIDITY, rowIndex)); |
| | | } |
| | | } |
| | | |
| | | issueCustomFieldMap.put("customFieldId", customField.getId()); |
| | | issueCustomFieldMap.put("useValue", cellValue); |
| | | issueForm.addIssueCustomFields(issueCustomFieldMap); |